This brief tutorial shows students and new users how to install Drupal content management system (CMS) on Ubuntu 18.04 | 20.04 with Nginx HTTP server and Let’s encrypt wildcard SSL certificates.
Drupal, a free and open source content management system built with PHP is easy to install and manage.
The minimum PHP version supported by Drupal 7 is 5.2.5. The minimum recommended PHP version for Drupal 7 is PHP 7.1.x, until December 1, 2019. After that date,PHP 7.1 will only receive security fixes, and it should not be anymore used for new sites. For Drupal 7, it is fixed in the current release (Drupal 7.57) for jQuery 1.4.4 (the version that ships with Drupal 7 core) as well as for other newer versions of jQuery that might be used on the site, for example using the jQuery Update module. 9 CVE-2017-6928: 732: Bypass 2018-03-01: 2019-10-02.
Drupal 6 support was dropped before php 7 release and if you add to that the contribued modules wich might be totally incompatible, the cost of going to php 7 will not be light. It might be easier to go from drupal 6 to 7 (not much changed btw these 2 versions) or if you have more time to remake your site go for drupal 8 (drupal 7 and 8 are. Vendor/ behat/ mink/ src/ Exception/ ExpectationException.php: function: since 1.7, to be removed in 2.0. Use getDriver and the driver API instead. FakeRecord: core/ modules/ system/ src/ Tests/ Database/ FakeRecord.php: class: in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead use DrupalTestssystemFunctionalDatabase.
You can use Drupal to run your content websites and build amazing digital experiences with little efforts.
When you’re looking for a CMS to run your content online, Drupal should probably be a starting point for you. And if you want to learn how to easily install and mange it, then this post is all you need.
For more about Drupal, please check their Homepage
To get started with installing Drupal, follow the steps below:
Step 1: Install Nginx HTTP Server
Drupal requires a web server to function, and Nginx is one of the most popular opensource web server available today.
To install Nginx on Ubuntu, run the commands below:
After installing Nginx, the commands below can be used to stop, start and enable Nginx service to always start up with the server boots.
To test whether Nginx is installed and functioning, open your web browser and browse to the server’s IP address or hostname.
http://localhost
If you see the above page in your browser, then Nginx is working as expected.
Step 2: Install MariaDB Database Server
You’ll also need a database server to run Drupal. A database server is where Drupal content get stored.
A true open source database server that you can use with Drupal is MariaDB database server. It is fast, secure and the default server for almost all Linux servers.
To install MariaDB, run the commands below:
sudo apt-get install mariadb-server mariadb-client
After installing MariaDB, the commands below can be used to stop, start and enable MariaDB service to always start up when the server boots.
Next, run the commands below to secure the database server with a root password if you were not prompted to do so during the installation.
sudo mysql_secure_installation
When prompted, answer the questions below by following the guide.
- Enter current password for root (enter for none): Just press the Enter
- Set root password? [Y/n]: Y
- New password: Enter password
- Re-enter new password: Repeat password
- Remove anonymous users? [Y/n]: Y
- Disallow root login remotely? [Y/n]: Y
- Remove test database and access to it? [Y/n]: Y
- Reload privilege tables now? [Y/n]: Y
To verify and validate that MariaDB is installed and working, login to the database console using the commands below:
sudo mysql -u root -p
type the root password when prompted.
![Drupal 7 Php 7.4 Drupal 7 Php 7.4](/uploads/1/3/7/7/137789355/660525200.png)
If you see a similar screen as shown above, then the server was successfully installed.
Step 3: Install PHP 7.4 and Related Modules
Drupal is a PHP based application, and PHP is required to run it. Since some versions of Ubuntu don’t have the latest version of PHP, you can add a third-party PPA repository to install PHP from there.
The command below will add a third-party PPA to Ubuntu.
Then update and upgrade to PHP 7.4
sudo apt update
Next, run the commands below to install PHP 7.4 and related modules.
sudo apt install php7.4-fpm php7.4-common php7.4-mysql php7.4-gmp php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-gd php7.4-xml php7.4-cli php7.4-zip
After installing PHP 7.4, go and configure some basic settings that may be required for Drupal to function properly.
Run the commands below to open PHP
Below are good settings to configure for most Drupal websites.
That should get PHP 7.4 installed with some basic settings to allow Drupal to function.
Step 4: Create Drupal Database
When all the servers installed above, it’s now time to begin setting up Drupal environment. First, run the steps below to create a blank database for Drupal to use.
Logon to MariaDB database console using the commands below:
sudo mysql -u root -p
Then create a database called drupal
CREATE DATABASE drupal;
Next, create a database user called drupaluser and set password
CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'new_password_here';
Then grant the user full access to the database.
GRANT ALL ON drupal.* TO 'drupaluser'@'localhost' WITH GRANT OPTION;
Finally, save your changes and exit.
Step 5: Download Drupal
At this point, Drupal is ready to be downloaded and installed. Use the commands below to download the latest version of Drupal.
To get Drupal latest release you may want to use Github repository… Install Composer, Curl and other dependencies to get started…
After installing curl and Composer above, change into the Nginx root directory and download Drupal packages from Github… Always replace the branch number with the latest branch.
To view Drupal releases, see this page.
Then run command below to allow www-data user to own the Drupal directory.
Step 6: Configure Nginx
Below is where you configure Nginx VirtualHost file for the Drupal site you’re creating. This file defines how client requests are handled and processed.
Run the commands below to create a new VirtualHost file called drupal in the /etc/nginx/sites-available/ directory.
sudo nano /etc/nginx/sites-available/drupal
A very good configuration settings for most Drupal site on Nginx server is below. This configuration should work great.
Copy the content below and save into the file created above.
Save the file and exit.
After saving the file above, run the commands below to enable the new site, then restart Nginx server.
At this stage, drupal is ready and can be launched by going to the server’s IP or hostname.
http://localhost
However, if you want to enable SSL or accept web traffic over HTTPS, then you can continue below to install and configure Let’s Encrypt free SSL certificates.
Step 7: Install Let’s Encrypt Wildcard Certificates
At step 6, Drupal is ready to use without SSL. However, if you want to serve web traffic over HTTPS, then installing and configuring Let’s Encrypt SSL certificate or other public certificates is a must.
To install Let’s Encrypt, run the commands below.
The commands above will install certbot tool and all dependencies that will be allowed to make the tool function.
Let’s Encrypt provides many ways to challenge you to validate that you own the domain you want to provide SSL certificates for. You will not be able to generate certificates if you can’t prove that you own the domain you want to secure.
For wildcard certificates, the only challenge method Let’s Encrypt accepts is the DNS challenge, which we can invoke via the preferred-challenges=dns flag.
So, to generate a wildcard cert for domain *.example.com, you run the commands below:
sudo certbot certonly --manual --preferred-challenges=dns --email [email protected] --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -d example.com -d *.example.com
The command options above are explained below:
- certonly: Obtain or renew a certificate, but do not install
- –manual: Obtain certificates interactively
- –preferred-challenges=dns: Use dns to authenticate domain ownership
- –server: Specify the endpoint to use to generate
- –agree-tos: Agree to the ACME server’s subscriber terms
- -d: Domain name to provide certificates for
After executing the command above, Let’s Encrypt will provide a text string to add a text record to your DNS entry…
Example:
Go to your DNS provider portal and add a text record for the string above and save…
Wait a few mins before continuing from the prompt.
Some DNS providers take a wile to propagate changes so it may depend on your provider’s platform.
After the changes above and Let’s encrypt is able to validate that you own the domain, you should see a successful message as below:
The wildcard certificate is now generated and ready to be used.
To verify that the certificate is ready, run the commands below:
sudo certbot certificates
That should display similar screen as below:
Now, Let’s Encrypt’s certificates are valid for 90 days… You’ll want to setup a crob job to automate the renewal process… To do that, open crontab and add the entry below:
sudo crontab -e
Then add the line below and save…
0 1 * * * /usr/bin/certbot renew >> /var/log/letsencrypt/renew.log
Save and you’re done!
With Let’s Encrypt installed, reopen Nginx VirtualHost file created above and add Let’s Encrypt configurations to secure your website.
Run the commands below open the file.
sudo nano /etc/nginx/sites-available/drupal
Then add the highlighted lines to the VirtualHost file as shown below:
After the above, restart Nginx and PHP 7.4-FPM
Next, open your browser and browse to the server domain name. You should see Drupal setup wizard to complete. Please follow the wizard carefully.
https://example.com/
Then follow the on-screen instructions… Select the installation language then click Save and Continue.
On the next screen, choose the Standard installation option to include commonly used features that are pre-configured.
This is the most popular options for most website running Drupal CMS.
Next, type in the database connection info and click Save and continue.
After that, enter the site information, including Site name, Site admin email address, username and password and continue.
When you’re done, Drupal should be installed and ready to use. Login as admin and begin configuring your site.
In the future when you want to upgrade to a new released version, simply run the commands below to upgrade…
That’s it!
Congratulation! You have successfully installed Drupal CMS on Ubuntu 18.04 | 20.04. If you find any error above, please use the comment form below to report it.
Drupal 7 Php 7.4 Free
Thanks,
Drupal 7 Php 7.4 Download
You may also like the post below: