Most companies, especially those that deploy in-house built software, depend upon a ticketing system. These systems allow users to report problems with software or hardware, and make it easier for developers and technicians to stay on top of issues. Some of these systems can be very complex, both to install and use. Fortunately, we have Linux and a slew of ticketing server software to choose from. One such choice is osTicket. This open source, free solution easily rivals those costing hundreds of dollars more.

I want to walk you through the process of installing osTicket on a fresh install of Ubuntu Server 16.04. Once installed, you can begin the process of customizing osTicket to meet and exceed your needs.

What you’ll need

All you will need is a working Ubuntu Server 16.04 platform. Either have this installed on dedicated hardware or a virtual machine with plenty of resources. Either way, osTicket will need access to port 80. That’s it. Let’s install.

Update and upgrade

The first thing we’re going to do is update and upgrade Ubuntu. On the off-chance this process updates the kernel, the server will need a reboot. To run the update/upgrade, open a terminal and issue the following commands:

sudo apt update
sudo apt upgrade

NGINX/mysql

Next we’re going to install NGINX and MySQL. From your terminal window, issue the following command:

sudo apt-get install -y nginx mysql-server

During the above installation, you will be prompted to create a password for the MySQL root user. Once you’ve done that, restart both services with the following commands:

sudo systemctl restart nginx
sudo systemctl restart mysql

Next enable both services with the commands:

sudo systemctl enable nginx
sudo systemctl enable mysql

PHP-FPM7

For our next trick, we’ll install the necessary PHP extensions. This can be done with the single command:

sudo apt-get install -y php7.0-cli php7.0-mysql php7.0-cgi php7.0-fpm php7.0-gd php7.0-imap php7.0-xml php7.0-mbstring php7.0-intl php-apcu

PHP must also be configured. Change into the php directory, with the command cd /etc/php/7.0/fpm and open the php.ini file for editing with the command sudo nano php.ini. Around line 760, you’ll see the entry:

#cgi.fix_pathinfo=1

Remove the # character and change the 1 to a 0. Save and close the file. Restart and enable php7-fpm with the commands:

systemctl restart php7.0-fpm
systemctl enable php7.0-fpm

NGINX

Now it’s time to configure NGINX. Change into the sites-available directory with the command cd /etc/nginx/sites-available. Open the default file with the command sudo nano default. Locate the PHP 7 configuration section and make sure to uncomment it (remove the necessary # characters) like so:

server {
listen 80;
server_name DOMAIN_OR_IP;

root /var/www/osticket/upload;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

index index.php;
client_max_body_size 2000M;
client_body_buffer_size 100M;
client_header_buffer_size 10M;
large_client_header_buffers 2 10M;

client_body_timeout 12;
client_header_timeout 12;
keepalive_timeout 15;
send_timeout 10;

gzip on;
gzip_comp_level 2;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/x-javascript text/xml text/css application/xml;

set $path_info "";

location ~ /include {
deny all;
return 403;
}

if ($request_uri ~ "^/api(/[^\?]+)") {
set $path_info $1;
}

location ~ ^/api/(?:tickets|tasks).*$ {
try_files $uri $uri/ /api/http.php?$query_string;
}

if ($request_uri ~ "^/scp/.*\.php(/[^\?]+)") {
set $path_info $1;
}

location ~ ^/scp/ajax.php/.*$ {
try_files $uri $uri/ /scp/ajax.php?$query_string;
}

location / {
try_files $uri $uri/ index.php;
}

location ~ \.php$ {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param PATH_INFO $path_info;
}
}

Where DOMAIN_OR_IP is either the domain name or the IP address of your osTicket server.

Save and close that file. Enable the virtual host by adding a link to sites-enabled with the command:

sudo ln -s /etc/nginx/sites-available/osticket /etc/nginx/sites-enabled/

Restart NGINX with the command:

sudo systemctl restart nginx

OSTICKET

Now it’s time to download and configure osTicket. Change into the document root with the command cd /var/www. Create a new directory with the command sudo mkdir -p osticket. Change into that newly created directory with the command cd osticket. Download osTicket with the command:

sudo wget http://osticket.com/sites/default/files/download/osTicket-v1.10.1.zip

NOTE: You might want to check the osTicket download to see if it has been upgraded since this writing. Go to the osTicket download page to find out. If there’s a newer release than 1.10.1, make sure the wget command reflects that. Unzip the downloaded file with the command:

sudo unzip osTicket-v1.10.1.zip

If you receive an error that unzip isn’t installed, resolve that with the command sudo apt install unzip.

Change into the newly created upload directory and issue the command:

sudo cp include/ost-sampleconfig.php include/ost-config.php

Change the permissions of the upload directory with the command:

sudo chown -R www-data:www-data upload/

Install

Open up a browser and point it to http://SERVER_IP (Where SERVER_IP is the IP address of your osTicket server). You should automatically be redirected to http://SERVER_IP/setup. If you’re not redirected, point your browser to http://SERVER_IP/setup. You will find yourself on the installation checklist. Everything should be green (Figure A), so you can click Continue.

Figure A

In the next screen (Figure B), you must configure all the necessary options. One thing of note, you cannot use the same email address for the Default email and the Admin user. If you do, the installation will error out and you’ll have to re-configure this section.

Figure B

Make sure to scroll down and configure the database settings (Figure C).

Figure C

Click the Install Now button and the installation will complete. Once it finishes, go back to the terminal window, change into the upload directory with the command cd /var/www/osticket/upload and rename the setup directory with the command sudo mv setup setup-bak. Change the permission of the ost-config.php file with the command

sudo chmod 0644 include/ost-config.php

It’s all yours

That’s it. You should be able to point your web browser to http://SERVER_IP and start using osTicket. This osTicket installation is now all yours to configure and make available to all necessary parties. Congratulations.