Drupal Setup Guide
This Document explains how to install Drupal 8 in Ubuntu 16.04 LTS Server, along with installing and setting Apache 2, PHP and MySQL.
Installation Overview
Before installing Drupal 8, check the requirements on Drupal requirements. This guide uses Apache/2.4.18, PHP 7.0.8 , MySQL v5.7 as the development environment.
Note: Ubuntu 16.04 LTS Server includes Apache 2, PHP, MySQL by default, you can select to include them while installing the Ubuntu on your PC.
Before You Begin
- The Drupal installation consists the usage of browser, so you should have GUI (instead of pure CLI interface) first. For Ubuntu 16.04 LTS Server does NOT contain a GUI interface, you may pick KDE, Gnome, Lxde as Desktop Environment first.
- Most command below needs the
sudo
permission, if the terminal returnsPermission denied
, remember to usesudo
as possible.
Install MySQL, Apache2, PHP
MySQL
Install MySQL
12345678910# sudo apt-get update# sudo apt-get install mysql-server# sudo apt-get install mysql-client-core5.7```*Note: remember to set root password while installing mysql-server** Config MySQL* Remember setup MySQL user and password after installation.* Log into MySQL server with `mysql -u root -p`, enter the* Create a database. You can create datebase with any name you like(assuming '**drupal**' here).CREATE DATABASE drupal;
123#### Apache2* Install Apache2sudo apt-get update
sudo apt-get install apache2
12345678*Note: you can check the Apache running by visiting the `http://localhost`. If a 'Apache2 Ubuntu Default Page' shows, the Apache server works.** Config Apache2* mod\_rewriteTo enable mod_rewrite:# sudo a2enmod rewrite # sudo service apache2 restart
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>1234567*Note: the command a2enmod rewrite is unique to the Debian Linux based systems.** clean\_urlsAssuming to set `/var/www/` as the folder to install Drupal 8.To get clean URLs working, modify `/etc/apache2/apache2.conf`, the result should be like123456(otherwise the .htaccess file won't take effect.)After modify the config file, remember to restarting the apache2 server with `sudo service apache2 restart`*Note: Also you should change the permission of `/var/www/` folder using `# sudo chmod 777 /var/www/` for the installation of Drupal 8.*#### PHPsudo apt-get update
sudo apt-get install php php-gd php-dom php-simplexml php-xml php-mysql
1234567891011121314151617181920212223242526272829303132333435363738394041After installing`php-gd php-dom php-simplexml php-xml` extensions, remember to reboot the computer to make sure the extension makes effect.*Note: To make sure PHP works, you can create a `info.php` in `/var/www/html/` using `echo "<?php phpinfo(); ?>" > /var/www/html/info.php`, then visit `http://localhost/info.php`. If a PHP info page shows up, PHP works on your PC.*Install Drupal 8---* Download Drupal 8 from [Download & Extend](https://www.drupal.org/download).* After download the file `drupal-8.2.1.tar.gz`, extract the file(you will get `drupal-8.2.1`),rename it as `drupal` and move it into `/var/www/html/`.* Open the browser, visit `http://localhost/drupal/`, and you will see a brand new GUI SETUP interface like:![](http://imgur.com/IocReLZ.jpg)Choose English.![](http://imgur.com/s6oaQXZ.jpg)Select Standard.*Note: you may face some problems while the verify requirements step, try checking the Troubleshoot to solve them*![](http://imgur.com/SXUAQTY.jpg)Fill in the Database name and username as set before.![](http://imgur.com/5zTFAAh.jpg)Happy installing :)![](http://imgur.com/Vhbzecq.jpg)After installation completes, you will configure site as you like.![](http://imgur.com/8LEYBob.jpg)After all the things set up, the site should be like this.Enjoy it!Troubleshoot---### Why I can not extract the drupal-8.2.1.tar.gz fileExtract it with `tar -zxvf drupal-x.y.z.tar.gz` (considering `x.y.z` is the version you downloaded.)### Why I can not move the folder to `/var/www/html/`Use`sudo mv ~/Downloads/drupal /var/www/html/drupal`### When I visit 'http://localhost/info.php', nothing shows up.Execute `sudo apt-get install libapache2-mod-php` in the command line.### When I visit `http://localhost/drupal/`, it only shows `handle($request) $response- send() $kernel- terminate($request $response);`make sure you have install `php-gd`, which is a php graphicslibrary.### Why I meet with a File system warnup during Verify requirementsCreate a folder as `/var/www/html/drupal/sites/default/files`, then grant it the permission by using the following commands.
cd /var/www/html/drupal/sites/default/
sudo mkdir files
sudo chmod 777 files
cd /var/www/html/drupal/sites/default/
sudo cp default.settings.php setttings.php
sudo chmod 777 settings.php
```