Manual Ubuntu w/ Nginx Deployment

Install on Ubuntu Linux

The guide aims to help install Deskpro manually using Nginx as the Webserver. If you are looking to install Deskpro with Apache please use this link.

Run these commands to install PHP 7.1, MySQL, Nginx, and some dependencies.

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install wget unzip mlocate wget nginx php7.1 php7.1-gd php7.1-mysql php7.1-curl php7.1-cli php7.1-cgi php7.1-dev php7.1-ldap php7.1-gd php7.1-json php7.0-apcu php7.1-xml php7.1-mbstring php7.1-soap php7.1-intl php7.1-zip php7.1-fpm mysql-server mysql-client

You will be asked to set a root password for mySQL. Remember this password. If you are not prompted for a new mysql root password, run the following command:

sudo mysql_secure_installation

If you plan to use an IMAP email account with Deskpro, install and enable the PHP IMAP extension:

sudo apt-get install -y php7.1-imap
sudo phpenmod imap

Update Nginx config

Obtain the latest configuration file sudo wget -P /etc/nginx/conf.d/ https://raw.githubusercontent.com/deskpro/install/master/ansible/roles/nginx/templates/deskpro.conf

sudo sed -i 's#set $fastcgi_pass unix:{{deskpro_php_fpm_socket}};#set $fastcgi_pass unix:/run/php7.1-fpm.sock;#g' /etc/nginx/conf.d/deskpro.conf
sudo sed -i 's#set $deskpro_root {{deskpro_site_root}}/www;#set $deskpro_root /usr/share/nginx/html/deskpro/www;#g' /etc/nginx/conf.d/deskpro.conf

Define the correct timezone

Run the following commands to set the correct timezone

sudo sed -i 's/;date.timezone =/date.timezone = UTC/g' /etc/php/7.1/cli/php.ini
sudo sed -i 's/;date.timezone =/date.timezone = UTC/g' /etc/php/7.1/fpm/php.ini

Restart PHP and Nginx:

sudo service nginx restart
sudo service php7.1-fpm restart

Test the nginx installation by opening the main IP: http://YOUR_UBUNTU_IP. If you see the Nginx screen, then the service was installed successfuly.

If you happen to still see the Apache page you might have an error in your Nginx setup. Check the Nginx status, if you get the message Failed to read PID from file /run/nginx.pid: Invalid argument

Please refer to https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1581864 for a workaround.

Install Deskpro

  1. Download the latest version of Deskpro:
sudo mkdir -p /usr/share/nginx/html/deskpro
sudo wget http://www.deskpro.com/downloads/deskpro.zip -O /usr/share/nginx/html/deskpro/deskpro.zip
cd /usr/share/nginx/html/deskpro
  1. Extract the zipped Deskpro files:
sudo unzip deskpro.zip 
sudo rm deskpro.zip
  1. Run the installer:
 sudo bin/install
  1. After you start the installer, you will have to enter your name and your email address image.png

  2. The installer checks the file integrity, the server requirements and the paths to a few utilities image.png

  3. Select the address that suits the best your organization image.png

  4. Select the preferred database location. The most comon is localhost image.png

  5. Enter MySQL details: Username, Password and Database. image.png

  6. After the database schema is installed, your system is ready. You can cancel the cron at this time. image.png

Set up cron job

Set a cron job to run your PHP CLI executable using the cron.php file in the install folder as an argument:

sudo echo "* * * * * deskpro /usr/bin/php7.1' '/usr/share/nginx/html/deskpro/bin/cron" | sudo tee /etc/cron.d/deskpro
sudo service cron restart

This makes the cron job run once per minute to carry out tasks like processing email.

Complete installation

Your Deskpro helpdesk is now installed. You should open Deskpro in your web browser at the relevant URL (or IP address) for the server and follow the final steps.

For production use, you should change ownership of the installed files so they are owned by the web server user or by a dedicated DeskPRO user account:

e.g. sudo chown -R deskpro:deskpro /usr/share/nginx/html/deskpro/

You should also have DeskPRO access the database through a MySQL user with more limited privileges than the root user.

After installation, you will have a MySQL client installed on your system. Type:

sudo mysql -uroot -p 

Execute the following MySQL commands, replacing password1 with a secure password:

CREATE USER 'deskpro'@'localhost' IDENTIFIED BY 'password1';

(replacing “password1” with a more complex password of your choice).

GRANT ALL PRIVILEGES ON deskpro.* TO  'deskpro'@'localhost';

(this assumes the default database name ‘deskpro’ is being used: if you have changed the DeskPRO database, you should replace ‘deskpro’ in the deskpro.* part above with whatever name you used).

FLUSH PRIVILEGES;

Now edit the configuration file using the command sudo nano /usr/share/nginx/html/deskpro/config/config.database.php to reference the new MySQL user.

image.png

Install Elasticsearch

You should now install Elasticsearch to greatly improve the search features of your helpdesk. This is optional, but strongly recommended.

Note

Without Elasticsearch, Deskpro search will still function, but searching will only match certain helpdesk content (e.g ticket titles instead of the full text of a ticket) and it will be slower.

For best performance, you should run Elasticsearch on a local server (the same server where you installed Deskpro, or one on the same network). You can also use a third-party hosted Elasticsearch service - see Using hosted Elasticsearch with Deskpro for an example of how to set this up.

To install Elasticsearch on the same server and connect it to your helpdesk:

1. Install OpenJDK

sudo add-apt-repository ppa:openjdk-r/ppa && sudo apt-get -y install openjdk-8-jre-headless

2. Check that Java is working

`java -version`

3. Install required dependencies

sudo apt-get install apt-transport-https

4. Add keys and repository

sudo apt-key adv --fetch-keys https://artifacts.elastic.co/GPG-KEY-elasticsearch

sudo add-apt-repository "deb https://packages.elastic.co/elasticsearch/2.x/debian stable main"

sudo apt-get -y install elasticsearch

sudo service elasticsearch restart

5. To check that Elasticsearch is running correctly

curl -X GET http://localhost:9200/

You should get output similar to this:
{
  "name" : "Scott Summers",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "6LniY0VoTKOoh4rLT6h50A",
  "version" : {
    "number" : "2.4.6",
    "build_hash" : "5376dca9f70f3abef96a77f4bb22720ace8240fd",
    "build_timestamp" : "2017-07-18T12:17:44Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.4"
  },
  "tagline" : "You Know, for Search"
}

6. Configure ElasticSearch in Deskpro

In the Deskpro admin interface, go to Server > Elasticsearch, check Enable Elasticsearch and enter the URL of the service (e.g. http://localhost if it is running on the same server).

Warning

Depending on the Elasticsearch configuration, you may need to specify the port to connect to as well, e.g. `http://my-es-host:80/` or `https://my-es-host:443/`.

7. Confirm that Elasticsearch is working

Click Test Settings to check that your DeskPRO installation can connect to Elasticsearch, then Save Settings.

For production use, we recommend that you consult the Elasticsearch documentation for more information about configuration and running Elasticsearch as a service on Linux.

Note

If the Elasticsearch service stops or crashes, Deskpro will revert to using the more limited, default search system.

Published: 28/06/2019

Last updated: 02/07/2019