Samuli Natri
Nov. 11, 2015
Updated: Oct. 26, 2016
2
By Samuli NatriNov. 11, 2015
(Updated: Oct. 26, 2016)
2

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

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:

 tasksel

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

Apache

You can get the server ip with this command: ifconfig (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:

mysql -uroot -p

Create a database:

CREATE DATABASE tut_d8_02 CHARACTER SET utf8;

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
        </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.

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:
How to install Drupal 8 with MAMP (Article + Video)

Samuli Natri is the founder of WDTutorials.com. He started building Drupal sites in 2010 with Drupal 6. He attended Helsinki University and Helsinki University of Technology (Social Sciences and Computer Science). Read more...

Comments

One of the most difficult operations for a Drupal Server is setting the correct choices for Postfix MTA (Message Transfer Agent), as most email sever and Virtual host supplies disable port 25 SMTP (Simple Mail Transfer Protocol). That means you need setup mail out for Postfix in order to make use of it rich host of features using secure mail protocols. Such a tutorial for 14.04 and 16.04 server installs I have yet to find. As this is part of getting a Drupal server to work I thing its worth bringing some light to this dark Postfix mystery.

Unfortunately this is beyond me. I have had success using the SMTP module https://www.drupal.org/project/smtp for basic mailing needs.

Add new comment