# Installation of Drupal

### Drupal database

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

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

{% hint style="info" %}
Remember the password of the user root is **devopstask**
{% endhint %}

Then we create a database for Drupal called **drupal\_db**

```sql
> CREATE DATABASE drupal_db;
```

We create a user drupal with new password **drupal\_pswd**

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

Then we grant the user drupal full access to the drupal\_db

```sql
> 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**

```bash
$ 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

```bash
$ 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;**&#x20;

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

And  restart the server with :

```bash
$ sudo /etc/init.d/nginx restart
```

To access the Drupal website, we go to <http://task.woezzon.com>&#x20;

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

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

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

```bash
$ 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

&#x20;We set these information

SITE INFORMATION&#x20;

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

```bash
$ 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/**

&#x20;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

```bash
$ 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.

{% embed url="<https://wiki.civicrm.org/confluence/display/CRMDOC/Views3+Integration>" %}

{% embed url="<https://www.drupal.org/node/2465951>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://task-devops.gitbook.io/documentation/installation-of-drupal.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
