Set Up a Help Desk System using osTicket on Ubuntu 18.04

osTicket is a widely-used open source support desk system. It seamlessly integrates inquiries created via email, phone and web-based forms into a simple easy-to-use multi-user web interface. Manage, organize and archive all your support requests and responses in one place while providing your customers with accountability and responsiveness they deserve.

This tutorial will walk you through the steps to set up a help desk system using osTicket on Ubuntu 18.04.


You will need one (physical or virtual) machine installed with Ubuntu or Debian having sudo non-root user privileges.

Set Timezone

You can correct your Ubuntu server timezone using the following command, but make sure you replace Asia/Karachi with yours:
sudo timedatectl set-timezone Asia/Karachi

Installing PHP

You will need to install these important PHP dependencies commonly used with osTicket:
sudo apt -y install php php-fpm php-mysqlnd php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-apcu php-intl php-opcache php-json php-curl

Installing Apache

To make osTicket web interface available to your users and customers, you need to install Apache web server:
sudo apt -y install apache2 apache2-ssl-dev openssl apache2-dev

Installing MySQL

You can install MySQL database by executing the following command:
sudo apt -y install mysql-server

Securing MySQL

By default, MySQL root user has blank password and anyone can intrude into your database, so make it secure by executing the following script and follow on screen instruction to complete.
sudo mysql_secure_installation
Response to the following prompts on your server
Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Please set the password for root here.

New password:

Re-enter new password:

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...

 - Removing privileges on test database...

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

All done!

Downloading osTicket

You can download latest version of osTicket from the official website . At the time of writing this tutorial, the latest release of osTicket is 1.14.1:
When download finished, extract it into the following directory and set the appropriate permission:
sudo mkdir /var/www/osTicket
sudo unzip -d /var/www/osTicket/ osTicket-*.zip

sudo cp /var/www/osTicket/upload/include/ost-sampleconfig.php /var/www/osTicket/upload/include/ost-config.php

sudo chown -R www-data:www-data /var/www/osTicket
sudo chmod 0666 /var/www/osTicket/upload/include/ost-config.php

Creating Database

You can create a database for osticket using the below commands under mysql prompt and you should replace following highlighted parameter to reflect yours:
sudo mysql -u root -p
create database osticket;
create user 'osticket'@'localhost' identified by 'P@ssw0rd';
grant all privileges on osticket.* to 'osticket'@'localhost';
flush privileges;
sudo mysql -u root -p osticket
alter user 'osticket'@'localhost' IDENTIFIED WITH mysql_native_password BY 'P@ssw0rd';

Configuring Apache

Now, you need to edit /etc/apache2/sites-available/000-default.conf file and change DocumentRoot directive like below:
sudo nano /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/osTicket/upload

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
Save and close file when you are finished.

Type the following commands to make PHP available for Apache:
sudo a2enmod proxy_fcgi setenvif

sudo a2enconf php7.3-fpm

sudo systemctl reload apache2
Update firewall rules to allow HTTP traffic on port 80:
ufw allow http
Now open up your preferred web browser and navigate to http://your_server_ip or http://your_server_name and you will see the below osticket installer page:

Make sure all prerequisites are green as shown in above screenshot then click Continue

Please fill out the information below and make sure you provide correct credentials in database field as you have created in earlier step. Also, do not change MySQL Table Prefix and keep it default.

When done, click Install Now button.

Wait while...let the installer complete it

You will see the below page contains information to access osTicket administrative control panel and users/customer support center:

Write it down to remember it

Now go back to command line terminal and change permission of ost-config.php to remove write access as shown below:
sudo chmod 0644 /var/www/osTicket/upload/include/ost-config.php
Also remove setup directory as we do not need it anymore:
sudo rm -rf /var/www/osTicket/upload/setup/
Now navigate back to http://your_server_name/scp or http://your_server_ip/scp and you will see the following login page. Login with the username and password you created in earlier web installer step.

In our case, the username is helpdesk and password also helpdesk

Once log in, you will see the below dashboard of admin panel. From here you can control, customize and manage your osTicket support desk according to your organizational need.

Navigate to http://your_server_name or http://your_server_ip and you will see the below support center page. From here users and customers can create support ticket, check status of already created tickets etc.

Securing osTicket

By default osTicket web interface is accessible via HTTP protocol which is not secure. In this step we will enable HTTPS to secure it.

Edit /etc/apache2/sites-available/default-ssl.conf file like below:
sudo nano /etc/apache2/sites-available/default-ssl.conf
Change DocumentRoot directive like below:
DocumentRoot /var/www/osTicket/upload
Save and close file when you are finished.

Type the following commands to activate SSL module:
sudo a2enmod ssl
sudo a2ensite default-ssl.conf

sudo systemctl restart apache2
sudo ufw allow https
sudo ufw deny http

sudo ufw reload 
Now you can access your osticket web interface securely with HTTPS like https://your_server_name or https://your_server_ip 

Wrapping up

Your osTicket installation has been completed successfully. Your next step is to fully configure your new support ticket system for use.

No comments:

Powered by Blogger.