TestRail: QA Test Case Management installation on Linux
Tags: exim, nginx, mysql, ssl
Published: 2019-03-24 10:18:32

---
title: TestRail: QA Test Case Management installation on Linux
published: true
tags: Exim,NGINX,MySQL,SSL
canonical_url: https://rtfm.co.ua/en/testrail-qa-test-case-management-installation-on-linux/
---

_![](https://rtfm.co.ua/wp-content/uploads/2019/03/testrail-logo.png)TestRail – Test Case Management Software for QA and Development Teams._

Well – that’s all needed as a description)

Below – its installation on Debian Linux with NGINX, Let’s Encrypt, PHP-FPM, MariaDB, and Exim.

As the TestRail is just a simple PHP/MySQL application - so this post might be interesting more as an example of a quick LEMP with SSL setup process description then TestRail's itself.

Project’s homepage – [www.gurock.com/testrail](https://www.gurock.com/testrail)

Installation official documentation – [here>>>](http://docs.gurock.com/testrail-admin/start).

Setup will be on an AWS EC2.

### LEMP and SSL

Log in to the EC2:

```
ssh admin@testrail.example.com -i bttrm-testrail-eu-west-1.pem
```

Update packages list and installed packages:

```
root@ip-172-31-25-137:/home/admin# apt update && apt upgrade
```

#### Let’s Encrypt

Install Let’s Encrypt client:

```
root@ip-172-31-25-137:/home/admin# apt install -y git unzip
root@ip-172-31-25-137:/home/admin# git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
```

Obtain a certificate using the standalone authenticator:

```
root@ip-172-31-25-137:/home/admin# /opt/letsencrypt/letsencrypt-auto certonly -d testrail.example.com
...
1: Spin up a temporary webserver (standalone)
2: Place files in webroot directory (webroot)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1
...
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/testrail.example.comd/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/testrail.example.com/privkey.pem
Your cert will expire on 2019-06-19.
...
```

#### NGINX

Install NGINX:

```
root@ip-172-31-25-137:/home/admin# apt -y install nginx
```

Will configure it a bit later.

#### PHP

Add the PHP 7.2 repository:

```
root@ip-172-31-25-137:/home/admin# wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
OK
root@ip-172-31-25-137:/home/admin# echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
deb https://packages.sury.org/php/ stretch main
```

Update the available packages list:

```
root@ip-172-31-25-137:/home/admin# apt update
```

Install PHP and necessary for the TestRail modules:

```
root@ip-172-31-25-137:/home/admin# apt -y install php7.2 php7.2-fpm php7.2-mysql php7.2-curl php7.2-json php7.2-mbstring php7.2-xml php7.2-zip
```

Find PHP configs:

```
root@ip-172-31-25-137:/home/admin# find /etc/ -name php.ini
/etc/php/7.2/cli/php.ini
/etc/php/7.2/fpm/php.ini
```

Edit both `/etc/php/7.2/fpm/php.ini` and `/etc/php/7.2/cli/php.ini` and add libraries load:

```
...
extension=mysql.so
extension=curl.so
```

##### ionCube install

Download its archive:

```
root@ip-172-31-25-137:/home/admin# cd /tmp/
root@ip-172-31-25-137:/tmp# wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
```

Unpack it and move to the `/opt`:

```
root@ip-172-31-25-137:/tmp# tar xfpz ioncube_loaders_lin_x86-64.tar.gz
root@ip-172-31-25-137:/tmp# mv ioncube /opt/
```

Add `zend_extension` to both ini-files as in the example above:

```
...
extension=mysql.so
extension=curl.so
zend_extension=/opt/ioncube/ioncube_loader_lin_7.2.so
```

#### NGINX virtual host configuration

Generate DF-key:

```
root@ip-172-31-25-137:/tmp# openssl dhparam -out /etc/nginx/dhparams.pem 2048
```

Add a virtual host config `/etc/nginx/conf.d/testrail.example.com`:

```
server {
    listen 80;
    server_name testrail.example.com;
    # Lets Encrypt Webroot
    location ~ /.well-known {
        root /var/www/html;
        allow all;
    }
    location / {
        # office1
        allow 194.***.***.24/29;
        # office2
        allow 91.***.***.78/32;
        # arseny home
        allow 188.***.***.48/32;
        deny  all;
        return 301 https://testrail.example.com;
    }
}
server {
    listen       443 ssl;
    server_name  testrail.example.com;
    root /var/www/testrail.example.com;
    access_log  /var/log/nginx/testrail.example.com-access.log;
    error_log /var/log/nginx/testrail.example.com-error.log warn;
    # office1
    allow 194.***.***.24/29;
    # office2
    allow 91.***.***.78/32;
    # arseny home
    allow 188.***.***.48/32;
    deny  all;
    ssl_certificate /etc/letsencrypt/live/testrail.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/testrail.example.com/privkey.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;
    ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
    ssl_session_timeout 1d;
    ssl_stapling on;
    ssl_stapling_verify on;
    location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar|otf|ttf)\$ {
        try_files \$uri =404;
    }
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|js|woff)$ {
        access_log off;
        log_not_found off;
        expires max;
    }
    location ~ \.php(?:/|$) {
        try_files $uri =404;
        fastcgi_pass unix:/run/php/testrail.example.com.sock;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
        fastcgi_index index.php;
    }
}
```

Check syntax and reload config files:

```
root@ip-172-31-25-137:/tmp# nginx -t && service nginx reload
```

#### PHP-FPM configuration

Create a pool’s config file `/etc/php/7.2/fpm/pool.d/testrail.example.com.conf`:

```
[testrail.example.com]
user = www-data
group = www-data
listen = /run/php/testrail.example.com.sock
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M
```

Restart FPM and check if the new pool started:

```
root@ip-172-31-25-137:/tmp# service php7.2-fpm restart
root@ip-172-31-25-137:/tmp# ps aux | grep fpm
root     15008  0.5  2.7 400684 28368 ?        Ss   11:00   0:00 php-fpm: master process (/etc/php/7.2/fpm/php-fpm.conf)
www-data 15010  0.0  0.6 400676  6904 ?        S    11:00   0:00 php-fpm: pool testrail.example.com
www-data 15011  0.0  0.6 400676  6904 ?        S    11:00   0:00 php-fpm: pool testrail.example.com
www-data 15012  0.0  0.6 400676  6904 ?        S    11:00   0:00 php-fpm: pool www
www-data 15013  0.0  0.6 400676  6904 ?        S    11:00   0:00 php-fpm: pool www
```

##### PHP test

Create a working directory:

```
root@ip-172-31-25-137:/tmp# mkdir -p /var/www/testrail.example.com

```
Create the `/var/www/testrail.example.com/info.php` file:

```
<?php
phpinfo()
?>
```

Check in a browser:

[![](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_131113.png "TestRail: QA Test Case Management система - установка на Linux")](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_131113.png)

### MySQL

Install it:

```
root@ip-172-31-25-137:/tmp# apt -y install mariadb-server
```

Run initial config:

```
root@ip-172-31-25-137:/tmp# mysql_secure_installation
```

Create a database and user:

```
MariaDB [(none)]> CREATE DATABASE testrail DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT ALL ON testrail.* TO 'testrail'@'localhost' identified by 'uo***8a';
Query OK, 0 rows affected (0.00 sec)
```

### TestRail installation

Get your trial [here>>>](https://secure.gurock.com/customers/testrail/trial/).

You’ll get an email with the download link and trial-key.

Download archive:

```
root@ip-172-31-25-137:/tmp# wget https://secure.gurock.com/downloads/testrail/testrail-latest-ion70.zip
```

Unpack it and move to the project’s directory:

```
root@ip-172-31-25-137:/tmp# unzip testrail-latest-ion70.zip
root@ip-172-31-25-137:/tmp# cp -r testrail/* /var/www/testrail.example.com/
root@ip-172-31-25-137:/tmp# chown -R www-data:www-data /var/www/testrail.example.com/
```

Open your URL in a browser and proceed with the installation there:

[![](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_133214.png "TestRail: QA Test Case Management система - установка на Linux")](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_133214.png)

Configure the database connection details:

[![](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_134833.png "TestRail: QA Test Case Management система - установка на Linux")](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_134833.png)

Create logs directory:

```
root@ip-172-31-25-137:/tmp# mkdir /var/www/testrail.example.com/logs
root@ip-172-31-25-137:/tmp# chown -R www-data:www-data /var/www/testrail.example.com/
```

Set your project’s details:

[![](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_134913.png "TestRail: QA Test Case Management система - установка на Linux")](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_134913.png)

An email will be set later, skip it for now:

[![](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_135019.png "TestRail: QA Test Case Management система - установка на Linux")](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_135019.png)

Add an admin user, the trial key was sent in an email:

[![](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_135048.png "TestRail: QA Test Case Management система - установка на Linux")](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_135048.png)

Ready:

[![](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_135141.png "TestRail: QA Test Case Management система - установка на Linux")](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_135141.png)

Log in:

[![](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_135226.png "TestRail: QA Test Case Management система - установка на Linux")](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190321_135226.png)

#### Cron jobs

Now – add a cronjob to run TestRail’s tasks.

Check if `task.php` works:

```
root@ip-172-31-25-137:/home/admin# php /var/www/testrail.example.com/task.php
root@ip-172-31-25-137:/home/admin# echo $?
```

If no errors here – it can be added to a crontab:

```
* * * * * www-data /usr/bin/php /var/www/testrail.example.com/task.php
```

#### Exim and email settings

To send emails – a local Exim will be used.

Install it:

```
root@ip-172-31-25-137:/home/admin# apt -y install exim4-base
```

[Configure](https://rtfm.co.ua/exim-mailing-to-remote-domains-not-supported/) it:

```
root@ip-172-31-25-137:/home/admin# dpkg-reconfigure exim4-config
```

Check if email sending works:

```
root@ip-172-31-25-137:/home/admin# echo "Exim test" | mailx -s "Exim test" admin@example.com
```

Go to the TestRail admin page – _Administration > Site Settings > Email_:

[![](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190322_143224.png "TestRail: QA Test Case Management система - установка на Linux")](https://rtfm.co.ua/wp-content/uploads/2019/03/Screenshot_20190322_143224.png)

Done.

### Similar posts

- <small>02/15/2016</small> [Debian: установка LEMP – NGINX + PHP-FPM + MariaDB](https://rtfm.co.ua/debian-ustanovka-lamp-nginx-php-fpm-mariadb/)<small> (0)</small>  
- <small>02/10/2018</small> [Ansible: миграция RTFM 2.10 – Let’s Encrypt, NGINX SSL, hostname и exim](https://rtfm.co.ua/ansible-migraciya-rtfm-2-10-lets-encrypt-nginx-ssl-hostname-i-exim/)<small> (0)</small>  
- <small>02/26/2019</small> [OpenVPN: SSL and hostname configuration](https://dev.to/setevoy/openvpn-ssl-and-hostname-configuration-2nb9)<small> (0)</small>  
- <small>04/12/2016</small> [TLS/SSL: NGINX – настройка SSL от Let’s Encrypt на Debian 8](https://rtfm.co.ua/nginx-nastrojka-lets-encrypt-na-debian-8/)<small> (0)</small>