Install Drupal 8 for Local Development (Alongside WordPress)

Using a Digital Ocean doc as a guide

check the status of the mysql server

sudo service mysql status
● mysql.service – MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2017-02-05 09:14:49 PST; 5 days ago
Process: 1515 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
Process: 1510 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 1514 (mysqld)
CGroup: /system.slice/mysql.service
└─1514 /usr/sbin/mysqld

Feb 05 09:14:48 wordpress-dev systemd[1]: Starting MySQL Community Server…
Feb 05 09:14:49 wordpress-dev systemd[1]: Started MySQL Community Server.

Login to mysql server as root

mysql -u root -p

Create a mysql database

CREATE DATABASE drupal8_folkbot;

Create a database user

CREATE USER [email protected] IDENTIFIED BY ‘your_complex_password’;

Assign this user rights over the database

Query OK, 0 rows affected (0.00 sec)

Flush and exit

Query OK, 0 rows affected (0.00 sec)

mysql> exit

This server already runs WordPress, so I have LAMP installed, for that use this doc

Php & SSH modules

sudo apt-get install php-gd php-curl php-ssh2

Make changes for Drupal specific PHP config

sudo vi /etc/php/7.0/apache2/php.ini

and change this setting to

allow_url_fopen = Off

Ensure Apache mod_rewrite is on

sudo a2enmod rewrite

sudo service apache2 reload && sudo service apache2 restart

Now we create a vhost

sudo cp -ar /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/folkbot_drupal8.conf

and we edit this file

[code lang=text]
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/folkbot_drupal8
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /var/www/folkbot_drupal8>
AllowOverride All

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

and pull down the code from gitlab

sudo mkdir /var/www/folkbot_drupal8
cd /var
sudo chown -R $USER:www-data www/folkbot_drupal8
cd www/folkbot_drupal8
git remote add gitlab_com [email protected]:folkbot/folkbot_drupal8.git
fatal: Not a git repository (or any of the parent directories): .git
128 [email protected]:/var/www/folkbot_drupal8⟫ git init
Initialized empty Git repository in /var/www/folkbot_drupal8/.git/
git remote add gitlab_com [email protected]:folkbot/folkbot_drupal8.git
git status
On branch master

Initial commit

nothing to commit (create/copy files and use “git add” to track)
git pull gitlab_com master
remote: Counting objects: 525019, done.
remote: Compressing objects: 100% (100744/100744), done.
Receiving objects: 100% (525019/525019), 107.63 MiB | 18.54 MiB/s, done.
remote: Total 525019 (delta 375958), reused 525013 (delta 375957)
Resolving deltas: 100% (375958/375958), done.
* branch master -> FETCH_HEAD
* [new branch] master -> gitlab_com/master

new site

sudo a2ensite folkbot_drupal8.conf
Enabling site folkbot_drupal8.
To activate the new configuration, you need to run:
service apache2 reload
sudo service apache2 reload

add this to vhosts wordpress-dev localhost