To get started, log into the MySQL root (administrative) account by issuing the following command: sudo mysql -u root -p
To create a database, database user, and grant all privileges to the database user run the following commands:
mysql> CREATE DATABASE drupal DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
mysql> CREATE USER 'drupaluser'@'%' IDENTIFIED WITH mysql_native_password BY 'your_password';
mysql> GRANT ALL ON drupal.* TO 'drupaluser'@'%';
mysql> FLUSH PRIVILEGES;
mysql> \q
sudo apt update
sudo apt install php libapache2-mod-php php-dev php-bcmath php-intl php-soap php-zip php-curl php-mbstring php-mysql php-gd php-xml
We will now download Drupal from the Drupal Official site. Use the following command to download Drupal:
sudo wget https://ftp.drupal.org/files/projects/drupal-9.4.4.zip
Extract file into the folder /var/www/html/ with the following command:
sudo apt -y install unzip
sudo unzip drupal-9.4.4.zip -d /var/www/html/
To make things simpler, rename the extracted directory drupal-9.4.4
to just drupal
:
sudo mv /var/www/html/drupal-9.4.4/ /var/www/html/drupal/
Enable permission for the Apache webserver user to access the files:
sudo chown -R www-data:www-data /var/www/html/drupal/
Navigate to /etc/apache2/sites-available
directory and run the following command to create a configuration file for your installation:
sudo nano /etc/apache2/sites-available/drupal.conf
Add the following content:
<VirtualHost *:80>
ServerAdmin webmaster@your-domain.com
ServerName your-domain.com
ServerAlias www.your-domain.com
DocumentRoot /var/www/html/drupal
<Directory /var/www/html/drupal/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/your-domain.com_error.log
CustomLog ${APACHE_LOG_DIR}/your-domain.com_access.log combined
</VirtualHost>
Enable the Drupal virtual host: sudo a2ensite drupal.conf
Restart the Apache web server: sudo systemctl restart apache2
Open your browser type your domain e.g http://your-domain.com
and complete the required steps to finish the installation.
Choose your preferred language and hit
Save and continue
, you will get the following screen:
Choose Standard and hit
Save and continue
. Error appear:
- First confirm that you have directory /var/www/html/drupal/sites/default/files. If doesn't exist you should create it by doing:
sudo mkdir /var/www/html/drupal/sites/default/files
sudo chmod -R 777 /var/www/html/drupal/sites/default/files
- Secondly copy settings template to another file by doing:
cp /var/www/html/drupal/sites/default/default.settings.php /var/www/html/drupal/sites/default/settings.php
sudo chmod -R 777 /var/www/html/drupal/sites/default/settings.php
Enter DB, User, password as created below:
Fill in your database settings and hit
Save and continue
.
Fill in some basic information about your site and then hit
Save and continue
. You will get the dashboard in the following screen:
Installation of Drupal has been completed. Now revert the permissions for the settings.php file:
sudo chmod 644 /var/www/html/drupal/sites/default/settings.php
When configuring the drupal system, I get an error: "Page Not Found" Errors on every page except homepage
To fix this error:
Top comments (0)