Drupal 8 Installation With Linux (Drupal 8 Tutorial #2) (Article + Video)

Submitted by TheMain on Wed, 11/11/2015 - 08:57

How to install Drupal 8 in Linux server (Ubuntu 14.04.3 LTS), set permissions and setup virtual hosts. In the video I also show how to remotely edit the files from Mac with Atom editor.

Install LAMP

An easy way to install LAMP is to use Tasksel:

sudo tasksel

You can install tasksel with sudo apt-get install tasksel

Just select LAMP server with space and go through the installation:


After the installation you should see the default apache landing page in http://:


You can get the server ip with this command: ifconfig (search for a line like this: inet addr:
If you are accessing the web server from a local machine, then navigate to: http://localhost
This default page is located in /var/www/html/index.html

Create database and grant permissions

Access MySQL with the password you created in the LAMP installation:

mysql -uroot -p

Create a database:


Grant permissions:

GRANT ALL PRIVILEGES ON tut_d8_02.* TO 'tut_d8_02'@'localhost' IDENTIFIED BY 'tut_d8_02';

TIP: You can use Ctrl + R to search for previous commands so you don't have to memorize these. In my privileges example the first tut_d8_02  is the database name, second tut_d8_02 is the username and the last one is the password.

Setup folder structure and Download the core

Create a folder for Drupal sites:

sudo mkdir /var/www/drupal

You can create subfolders here like /var/www/drupal/clients. I will use a subfolder /var/www/drupal/tut/d8 in this example.

Copy the download address for Drupal core here https://www.drupal.org/project/drupal and download the package:

cd /var/www/drupal/tut/d8
sudo wget http://ftp.drupal.org/files/projects/drupal-8.0.0-rc1.tar.gz

Extract it and rename the folder:

sudo tar -zxvf drupal-8.0.0-rc1.tar.gz 
sudo mv drupal-8.0.0-rc1 tut_d8_02

Setup permissions

Change the owner of the site folder and files to www-data:

sudo chown -R www-data:www-data tut_d8_02 

Setup virtual hosts

Copy the 000-default.conf as drupal.conf:

cd /etc/apache2/sites-available 
sudo cp 000-default.conf drupal.conf 
sudo nano drupal.conf 

Here is an example of my drupal.conf file:

<VirtualHost *:80>
        ServerName drupal.dev1
        DocumentRoot /var/www/drupal

        <Directory /var/www/drupal>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

        ServerAdmin mail@example.com

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

dev1 is the hostname of my server.

sudo a2ensite drupal
sudo service apache2 reload

I have this line in my Mac /etc/hosts file:

server-ip drupal.dev1

So now I can access the sites in /var/www/drupal from my Mac with this address: http://drupal.dev1

Go through the installation

Navigate to the site http://drupal.dev1/tut/d8/tut_d8_02/ and go through the installation.

I already went through the installation in my previous tutorial so check it out:

Posted by Samuli Natri on 11 November 2015