In this Drupal tutorial i will help you how you can configure Drupal on an Ubuntu 16 VPS Server from VPSServer.com. It is a free and a very populair PHP-based CMS worldwide. It is used for all kind of websites.
This article assumes that you have:
1. An Ubuntu VPS server ready to be configured and installed with Drupal. If you don't have one, you can order from vpsserver.com.
2. Have basic knowledge with Linux, knows how to handle a command line interface.
3. You have an ssh client ready to be used (bitvise or putty).
Before we can install Drupal we must first update our Ubuntu packages to the latest by running the below commands:
sudo apt-get update
Now let us upgrade all existing installed packages. Lets do this by:
sudo apt-get upgrade
Before we can serve Drupal to our clients or website visitors we must first install the necessary packages that will enable your server to serve web pages on the internet.
We will need to install a LAMP (Linux, Apache, Mysql, Php) server on our Ubuntu 16. To do this we should go back to another tutorial on installing LAMP server on Ubuntu.
The tutorial is for an Ubuntu 14 server but basically the process for Ubuntu 16 is the same.
Once you have installed the necessary packages and you have tested your LAMP server we can now go on installing the PHP-modules.
To install our php modules we run:
apt-get install php5 php5-mysql php5-gd php5-curl libssh2-php
Once installation is finished we can now install Drupal on our new LAMP server.
To install Drupal we need to download the latest Drupal package from their website. Go to https://www.drupal.org/download and download the latest package.
The latest version used in this guide is version 8.2.1 so we will download that version using wget.
Next stap, let us unpack our files into the document root (/var/www/html) directory of your server.
cp -rf drupal*/* /var/www/html/
Afterwards let us change the directory permissions so we can access the folder without problems.
chown www-data:www-data -R /var/www/html/
chmod -R 755 /var/www/html/
Our Drupal installation will not be able to work yet since we will need a database for all the values Drupal will store later on such as user credentials and many more.
In this guide we will have to create a database and add a database user. These values will be later used by Drupal during the installation process.
Let us login to the mysql as administrator user by:
mysql -u root -p
Enter your MySQL root password to login to mysql cli admin area.
Afterwards we will create a Drupal database. We can do this inside the mysql admin interface using the command:
create database drupal;
grant all privileges on drupal.* to drupaluser@localhost identified by 'your_password';
Once all is done we can now exit mysql by typing:
Let us create a new Apache virtual host configuration named drupal.conf. In this file we will fill all information regarding our drupal virtual host configuration. To start with we will do:
sudo a2enmod rewrite
Next, create a file named drupal.conf:
Afterwards we will need to link this new configuration file in another folder.
ln -s /etc/apache2/sites-available/drupal.conf /etc/apache2/sites-enabled/drupal.conf
Now open and edit the file drupal.conf:
Inside we will put the configuration values for our new virtual host:
<VirtualHost *:80> ServerAdmin email@example.com DocumentRoot /var/www/html/ ServerName your-domain.com ServerAlias www.your-domain.com <Directory /var/www/html/> Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/your-domain.com-error_log CustomLog /var/log/apache2/your-domain.com-access_log common </VirtualHost>
Then restart Apache to reflect our changes.
systemctl restart apache2.service
To access Drupal, go to your web browser and enter your domain or ip address like:
an example would be:
You will see an installation profile page like below:
To determine which profile you can use please read more details on the installation profiles can be read at the Drupal Website.
Next, enter the database values you earlier configured in the mysql administrator cli. make sure you select Mysql/MariaDB for the database.
Click on "Save & Continue to go to the next step.
Now, you set up some basic information for your website.
Please enter a fill every fields necessary to properly configure your website such as your website name, email address and your username & password credentials.
Click on 'Save & Continue" button to complete your installation.
Once done, you can now visit your website:
That is a long tutorial but worth the time reading, on our future article we will show you how you can further secure Drupal and other websites and applications.