1. Ensure the correct LAMP environment
  2. Install Drupal Manually - Did not work
  3. Install Drupal with Composer
  4. Configure the installation
  5. Post installation configuration
  6. Conclusion

 

1. Ensure LAMP environment:

Before installing Drupal we need to have the correct LAMP packages installed, specifically;

  • Apache web server
  • MariaDB database
  • PHP

Web server:

logged in as root

root# yum install httpd
root# systemctl start httpd.service
root# systemctl enable httpd.service

The last command ensures that the web server is started on boot.
To check that the web server is running open up a web browser (Firefox) and type "localhost" into the url bar - you should see the "testing 123..." test page.

Database:

logged in as root

root# yum install mariadb mariadb-server mod_ssl
root# systemctl enable mariadb.service

The last command ensures that the web server is started on boot.
To create a secure environment

root# mysql_secure_environment

The prompt will ask you for your current root password. Since you just installed MySQL, you most likely won’t have one, so leave it blank by pressing enter. Put in your password and press enter for other questions.

PHP:

Make sure you have the correct repositories to get PHP7

root# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
root# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Go ahead and install php

root# yum install php70w

and the other php packages we will need

root# yum install php70w-opcache php70w-mysql php70w-dom php70w-gd

 2. Install Drupal 8: This did not work!

Note: This failed because of a library requirement

Requirements problem
Errors found
Address requires the commerceguys/addressing library.
Address requires the commerceguys/zone library.

After research the libraries cannot be simply uploaded - they have to be installed using composer.

In this example I am installing a distribution of Drupal from openY. The file I downloaded was openy-8.x-1.1-core.tar.gz

The file was extracted,moved to the web server directory and renamed:

root# tar -zxvf openy-8.x-1.1-core.tar.gz
root# mv openy-8.x-1.1 /var/www/html/
root# cd /var/www/html/
root# mv openy-8.x-1.1 drupal8

Some permissions need to be modified for selinux and ownership:

root# chcon -R –-type=httpd_sys_rw_content_t /var/www/html/
root# chown -R apache:apache /var/www/html/

Edit the apache conf file and change the document root to the Drupal8 folder /etc/httpd/conf/httpd.conf

3. Install Drupal 8 using Composer:

Install composer by creating a /tmp directory and using cURL:

root# cd /tmp
root# curl -sS https://getcomposer.org/installer | php

To make composer globally accessible:

root# mv composer.phar /usr/local/bin/composer

Will also need git installed:

root# yum install git git-core

Now use composer to install the distribution after disabling selinux firwall:

root# setenforce 0
root# sestatus
root# cd /var/www/html/
root# composer create-project ymcatwincities/openy-project drupal8 --no-interaction --no-dev

Edit the apache conf file and change the document root to the Drupal8/webroot folder /etc/httpd/conf/httpd.conf

4. Configure the Drupal installation:

Before we start we should restart the apache web server:

root# service httpd restart

Now we can create the maria databse and the user for drupal - log into mysql:

root# mysql -u root -p
mysql# CREATE DATABASE mydatabase;
mysql# CREAT USER 'campuser'@'localhost' IDENTIFIED BY 'examplepassword';
mysql# GRANT ALL ON camp.* TO 'campuser'@'localhost';

To finish the install/config open a web browser (Firefox) and type "localhost" into the url bar - you should see the Drupal installation script...

I had a problem with an Uncaught exception which stated "MYSQL server has gone away. After reseaching on Google I did the following (In hind sight I may have forgotten to restart the mariadb service prior to using the installation script)

root# vi /etc/my.cnf

Added max_allowed_packet=100M

The next running of the script gave a strange login requirement to openY - After consulting with the openY tech they said I had installed incorrectly and to run a Drush command to fix - since I do not have Drush installed I decided to drop the database and retry:

root# mysql -u root -p
mysql# DROP DATABASE mydatabase;
mysql# CREATE DATABASE mydatabase;
root# service mariadb restart

The installation script ran all the way through and installed openY 8.3.7 correctly

5. Post installation configuration:

Rewrite the permissions on sites/default and the setting file:

root# cd /var/www/html/drupal8/docroot
root# chmod a-w sites/default
root# chmod a-w sites/default/settings.php

 Edit for trusted host:

root# cd /var/www/html/drupal8/docroot/sites/default
root# chmod a+w settings.php
root# vi settings.php

Add the following:
$settings['trusted_host_patterns'] = array(
  '^localhost$',
);

</>root# chmod a-w settings.php

6. Conclusion:

The install was fairly complicated, partly because I had never used composer before and was new to Drupal.

My original intention was to create the test site on my shared hosting account with Hostgator. This quickly became a "Let's install the test site on my local machine" project due to the fact that Hostgator (shared hosting) does not currently support:

  • Drupal8
  • PHP7
  • PHP OPcache
  • Installing composer

The openY team has decided to use very cutting edge technologies (Drupal8, composer) and I can anticipate a LOT of problems when trying to migrate the test site to a production site on Hostgator!

Having said that the test site is now installed correctly and running (except for drupal and module updates).

Stay posted to these articles for more fun soon...