Install LAMP

An easy way to install LAMP (Linux Apache MySQL PHP) is to use Tasksel:

1
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:

Note: In this tutorial I’m accessing a physical server in the local network from my Mac. You can get the server ip with ifconfig command (search for a line like this: inet addr:192.168.10.12). 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:

1
mysql -uroot -p

Create a database:

1
CREATE DATABASE tut_d8_02 CHARACTER SET utf8;

Grant permissions:

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

Tthe first tut_d8_02 is the database name, second tut_d8_02 is the username and the last one is the password.

Tip: You can use Ctrl + R to search for previous commands so you don’t have to memorize these.

Setup folder structure and Download the core

Create a folder for Drupal sites:

1
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 from here https://www.drupal.org/project/drupal and download the package:

1
2
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:

1
2
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:

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

Setup virtual hosts

Copy 000-default.conf as drupal.conf:

1
2
3
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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<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
        </Directory>

        ServerAdmin mail@example.com

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

dev1 is the hostname of my server. I have this line in my Mac /etc/hosts file: SERVER_IP drupal.dev1. Replace SERVER_IP with your server ip.

Enable the configuration and reload apache:

1
2
sudo a2ensite drupal
sudo service apache2 reload

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.

Read more about the installation process here: /drupal/8/installation/mamp/.