Installation of Drupal

Drupal is a free open source content-management framework written in PHP and distributed under the GNU General Public License. Drupal provides a back-end framework for at least 2.3% of all websites

Drupal database

First let's create Drupal's database in command line. We connect to Drupal database instance running on 3307

$ mysql -u root -p -h 127.0.0.1 --port=3307

Remember the password of the user root is devopstask

Then we create a database for Drupal called drupal_db

> CREATE DATABASE drupal_db;

We create a user drupal with new password drupal_pswd

> CREATE USER 'drupal'@'127.0.0.1' IDENTIFIED BY 'drupal_pswd';

Then we grant the user drupal full access to the drupal_db

> GRANT ALL ON drupal_db.* TO drupal@127.0.0.1 IDENTIFIED BY "drupal_pswd" WITH GRANT OPTION;

Drupal installation

We download a package of drupal 7 from Drupal's website , we unzip it and then move it to /var/www/drupal

$ cd /tmp && wget https://ftp.drupal.org/files/projects/drupal-7.61.tar.gz
$ tar -zxvf drupal-7.61.tar.gz
$ sudo mv drupal-7.61 /var/www/drupal

We set this permission to drupal folder

$ sudo chmod -R 755 /var/www/drupal/
$ sudo chown -R www-data:www-data /var/www/drupal/

Now we update our task.woezzon.com.conf virtual host file to serve the drupal website. We change the root directory to root /var/www/drupal;

$ sudo nano /etc/nginx/sites-enabled/task.woezzon.com.conf

And restart the server with :

$ sudo /etc/init.d/nginx restart

To access the Drupal website, we go to http://task.woezzon.com

When running the website, some PHP extensions like gd, xml, SimpleXML, dom are missing. We install them with

$ sudo apt-get install php-xml php-gd php-dom php-simplexml

We also install the Unicode PHP library extension and php-curl

$ sudo apt-get install php-mbstring php-curl

After all requirements are verified, we set up the database with the database name , database username and password previously created.

Database name

drupal_db

Database username

drupal

Database password

drupal_pswd

Database host

127.0.0.1

Database port

3307

Table prefix

dp

We save and continue

Configure site

We set these information

SITE INFORMATION

     Site name : Task for Junior Devops/Sysadmin 
     Site e-mail address : info@task.woezzon.com
     SITE MAINTENANCE ACCOUNT
     Username : admin
     E-mail address : info@task.woezzon.com
     Password : drupal_site_pswd

     SERVER SETTINGS
     Default country : United Kingdom
     Default time zone : Europe/London

After this, we have our Drupal site successfully configured

Drupal private files folder

To configure private file, we create a private folder completly outsite the server root at /home/ubuntu/drupal_private_files/ which can not be directly accessed by Nginx. And we set the right permission.

$ mkdir /home/ubuntu/drupal_private_files
$ sudo chown -R www-data /home/ubuntu/drupal_private_files/

Then on Drupal website we go to Configuration --> Media --> File system . We set "Private file system path" to /home/ubuntu/drupal_private_files/

And we choose "Private local files served by Drupal." as Default download method

Installation of Drush

Drush (for Drupal Shell) is a command line shell and scripting interface for Drupal We install it with the terminal via apt package manager

$ sudo apt-get update
$ sudo apt-get install drush

https://www.newmediacampaigns.com/blog/install-drush-for-drupal-7

Drupal views can use the CiviCRM database

We modify the Drupal settings files so that Drupal views can use the CiviCRM database

We first install the Views module in Drupal http://drupal.org/project/views We log into the Drupal site as admin an go to https://task.woezzon.com/index.php?q=civicrm/admin/setting/uf?reset=1

On this page, we copy the output $databases['default']['default']['prefix']= array(...

and paste it into Drupal settings file at /var/www/drupal/sites/default/settings.php , so that Drupal views can use the CiviCRM database.

Last updated

Was this helpful?