In this post, we are going to install Drupal on Ubuntu 18.04. Drupal is a web-based Content Management System.
Preparing Your Server
You will want a fresh install of Ubuntu Server 18.04 that is fully updated.
Be sure to reboot to use any new Linux Kernel updates.
apt update && apt upgrade -y reboot
Wait for the server to finish rebooting.
Since Drupal is a PHP based application we need to install a LAMP stack first.
Follow this article to Install a LAMP Stack: Install LAMP on Ubuntu 18.04
In addition to the base LAMP stack we will need to install several PHP modules required by Drupal.
apt install php-dompdf php-gd php-xml php-mysql
We also need to enable the Apache Rewrite module for Drupal to have Clean URLs.
Open the default Apache site configure file /etc/apache2/sites-enabled/000-default.conf.
Add the following lines before the closing </VirtualHost> tag:
<Directory /var/www/html> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
Next, enable the rewrite module.
Restart Apache for the modules to be loaded.
systemctl restart apache2
We can now download and install Drupal
Ensure you are logged in and sudo as root.
sudo su -
Download the latest version of Drupal (v 8.5.6 as of this writing) using this command.
You can get the latest version link by going to the Drupal Downloads Page.
After the file is done downloading we need to unpack the tarball.
tar -xzvf drupal-8.5.6.tar.gz
Move the contents to your web root directory.
mv drupal-8.5.6/* /var/www/html mv drupal-8.5.6/.htaccess /var/www/html/
Next, we need to update the permissions of the files so Apache can access them.
chown www-data:www-data -R /var/www/html
We are now ready to create a database for Drupal.
Create Drupal Database
First, start the MySQL CLI.
# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.23-0ubuntu0.18.04.1 (Ubuntu) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
Next create the database with this command:
mysql> CREATE DATABASE drupal DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Create a Drupal user:
mysql> GRANT ALL ON drupal.* TO 'drupal'@'localhost' IDENTIFIED BY 'password';
Be sure to set a more secure password than the one I gave.
Finally, flush the privileges and exit.
mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> exit; Bye
We can now begin the web configuration of Drupal
Drupal Web Configuration
Open a web browser and go to the URL of your server.
You will see the Drupal setup wizard.
Select your language and click on the Save and continue button.
Select the profile. Typically you will select Standard.
Next, click on Save and continue.
Drupal will then verify all the requirements. They should all be OK.
Click on Save and continue.
Drupal will now ask for the database info for the database we created earlier.
Enter the database name and username as drupal. Enter the password you set earlier for the drupal database user password.
Click on Save and continue.
The last step of the setup process is configuring your Drupal site.
Enter all the details for your site then click on Save and continue to finish.
You will then seethe Admin site for your new Drupal web site.
Need More Ubuntu Training?
Checkout this Ubuntu Fundamentals course from Pluralsight. Pluralsight has great training at a great price. Free 10-day trial.
In this post you learned how to install Drupal on Ubuntu 18.04.
I hope you enjoyed this post and that it was helpful.
If you liked it then please share it and comment below.