Drupal Installation on an Ubuntu 16 VPS Server
Overview
In this Drupal tutorial, I will guide you through the process of configuring Drupal on an Ubuntu 16 VPS Server from blendhosting.com. Drupal is a widely-used, free, PHP-based Content Management System (CMS) known globally for its versatility, making it suitable for various types of websites.
Requirements
This tutorial assumes that you have the following prerequisites:
- An Ubuntu VPS server prepared for configuration and Drupal installation. If you don’t have one, you can order from blendhosting.com[1].
- Basic knowledge of Linux and familiarity with command line interfaces.
- An SSH client such as Bitvise or Putty is installed and ready for use.
Ubuntu Updating
Before proceeding with Drupal installation, it’s essential to update your Ubuntu packages to the latest versions. Run the following commands:
sudo apt-get update
Now, upgrade all existing installed packages by executing:
sudo apt-get upgrade
LAMP Installation Guide
Before making Drupal accessible to website visitors, we need to install the necessary packages to enable your server to serve web pages on the internet. To achieve this, we’ll set up a LAMP (Linux, Apache, MySQL, PHP) server on Ubuntu 16. You can refer to another tutorial on installing a LAMP server on Ubuntu[2].
Although the tutorial is for an Ubuntu 14 server, the process for Ubuntu 16 remains the same. Once you have installed the required packages and tested your LAMP server, proceed with the installation of PHP modules by running:
apt-get install php5 php5-mysql php5-gd php5-curl libssh2-php
After completing the installation of the PHP modules, proceed to install Drupal on your new LAMP server.
Drupal Installation Guide
To initiate the Drupal installation process, download the latest Drupal package from their official website. Navigate to https://www.drupal.org/download[3] and obtain the latest version. In this guide, version 8.2.1 is used, and you can download it using wget or your preferred method.
wget https://ftp.drupal.org/files/projects/drupal-8.2.1.zip
In the next step, unpack the downloaded files into the document root directory of your server, typically located at /var/www/html.
unzip drupal*.zip
cp -rf drupal*/* /var/www/html/
Subsequently, modify the directory permissions to ensure smooth access to the folder without encountering issues.
chown www-data:www-data -R /var/www/html/
chmod -R 755 /var/www/html/
Setting up MariaDB and MySQL for Use with Drupal
Before Drupal can function properly, a database is required to store values such as user credentials. In this guide, we’ll create a database and add a database user. These credentials will be utilized by Drupal during the installation process.
Begin by logging into MySQL as the administrator user using:
mysql -u root -p
Enter your MySQL root password to access the MySQL CLI admin area. Afterward, create a Drupal database using the following command within the MySQL admin interface:
create database drupal;
grant all privileges on drupal.* to drupaluser@localhost identified by 'your_password';
flush privileges;
After completing the necessary steps, exit MySQL by typing:
exit;
Setting up Apache to Use Drupal
Create a new Apache virtual host configuration file named drupal.conf. In this file, we will specify all the details related to our Drupal virtual host configuration. To begin, execute:
sudo a2enmod rewrite
Next, create a file named drupal.conf using:
touch /etc/apache2/sites-available/drupal.conf
Afterward, link this new configuration file to another folder:
ln -s /etc/apache2/sites-available/drupal.conf /etc/apache2/sites-enabled/drupal.conf
Now, open and edit the drupal.conf file:
nano /etc/apache2/sites-available/drupal.conf
Inside the drupal.conf file, input the configuration values for our new virtual host:
ServerAdmin admin@yourdomain.com
DocumentRoot /var/www/html/
ServerName your-domain.com
ServerAlias www.your-domain.com
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
ErrorLog /var/log/apache2/your-domain.com-error_log
CustomLog /var/log/apache2/your-domain.com-access_log common
Following this, restart Apache to apply the changes:
systemctl restart apache2.service
Setting up Drupal
To access Drupal, open your web browser and enter your domain or IP address in the following format: http://{your_domain_or_ip_address}. For example:
http://mydrupalwebsite.com
http://123.23.23.14
Choosing the appropriate profile
You will be directed to an installation profile page, similar to the one below:
To determine which profile to use, refer to the Drupal Website[4] for more detailed information on installation profiles.
Inputting Accurate DB Values
Next, enter the database values that you configured earlier in the MySQL administrator CLI. Ensure that you select MySQL/MariaDB as the database.
Click on ‘Save & Continue‘ to proceed to the next step.
Set Up a Website
Now, provide the necessary information to configure your website. Fill in all the required fields, including your website name, email address, and the username and password credentials.
Click on the ‘Save & Continue‘ button to finalize your installation.
Once completed, you can visit your website at:
This tutorial may be lengthy, but the time spent reading is worthwhile. In future articles, we will demonstrate how to enhance the security of Drupal and other websites and applications.
Thank you.
[1]: https://www.blendhosting.com/vps/
[2]: https://www.blendhosting.com/kb/set-up-an-ubuntu-14-04/
[3]: https://www.drupal.org/download
[4]: https://www.drupal.org/docs/7/installing-drupal-7/built-in-installation-profiles-drupal-7