1. Home
  2. Linux
  3. Ubuntu
  4. How to install osTicket on Ubuntu 16.04

How to install osTicket on Ubuntu 16.04

How to install osTicket on Ubuntu 16.04
How to install osTicket on Ubuntu 16.04

In this tutorial, we will teach you how to install osTicket on Ubuntu 16.04 with a LEMP stack,  Nginx as a web server, MySQL database server, and PHP 7.0.

Check out Our Best VPS Hosting and Wodpress hosting too for scalling your business needs.

osTicket

osTicket is a free and open source support ticket system which was made in PHP. This tool is simple and lightweight meaning anybody can use this to manage, organize and archive their support ticket requests.

Install osTicket on Ubuntu 16.04

Installing osTicket on Ubuntu 16.04 is a simple task following the steps of this guide.

Step 1: Login via SSH and update the system.

Before starting, you will have to log into your server via SSH as user root.

ssh root@IP_ADDRESS -p PORT_NUMBER

 
Make sure that you replace ‘IP_ADDRESS’ and ‘PORT_NUMBER’ with your own server IP address and SSH port number.
Ensure that your Ubuntu 16.04 server is up-to-date by executing the commands below.

apt-get update
apt-get upgrade

 

Step 2: Installing Nginx.

To install the latest stable Nginx version on your server, execute the command below.

apt-get install nginx

 

Step 3: Install and Configure MySQL Database Server.

Simply execute the command below to install the MySQL database server.

apt-get install mysql-client mysql-server

 
Once the installation is done, you may execute the ‘mysql_secure installation’ script so that your MySQL root password is set and your MySQL installation is secured.

mysql_secure_installation

 

Step 4: Installing PHP and PHP-FPM

Now, install PHP 7.0, PHP-FPM, and a couple of other PHP modules which are needed for osTicket to run correctly.
apt-get install php7.0-mysql php7.0-cgi php7.0-fpm php7.0-cli php7.0-curl php7.0-mcrypt php7.0-gd php7.0-imap php7.0-mbstring php7.0-xml php7.0-intl php-apcu
 

Step 5: Downloading osTicket

Before you start downloading osTicket, you have to create a new directory. You can do this with the command below.

mkdir /var/www/osticket

 
With the command below you can change our current working directory.

cd /var/www/osticket

 
Finally, download the latest osTicket version within this directory with the following command.

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

 

Step 6: Extract and configure osTicket.

To extract the archive, execute the command below.

unzip osTicket-v1.10.1.zip

 
Now, you have to create a copy of the sample configuration file.

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

 
Lastly, you will have to change the ownership of the osTicket directory with the command below.

chown -R www-data:www-data /var/www/html/osticket

 

Step 7: Creating a new database for osTicket.

In order to setup a new database for your osTicket installation, you  must first log into your MySQL server with the below.

mysql -u root -p

 
Next, execute the commands below to create the database.

CREATE DATABASE osticket;
GRANT ALL PRIVILEGES ON osticket.* TO 'osticketuser'@'localhost' IDENTIFIED BY 'PASSWORD';
FLUSH PRIVILEGES;
exit;

 
Remember to replace ‘PASSWORD’ with your own strong password.

Step 7: Configure the Nginx virtual host.

Now, create a new Nginx server block with the following command.

nano /etc/nginx/sites-available/osticket

 
Then, enter the following content (remember to replace ‘my-domain.com’ with your own domain name.

server {
listen 80;
server_name my-domain.com;
root /var/www/osticket/upload;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
/////////////////////////////////////////////
index index.php index.html index.htm;
gzip on;
gzip_min_length 1000;
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;
}
}

Activate the server block by making a symbolic link.

nano /etc/nginx/sites-available/osticket

 
Test the nginx configuration with the below.

server {
listen 80;
server_name my-domain.com;
root /var/www/osticket/upload;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
index index.php index.html index.htm;
gzip on;
gzip_min_length 1000;
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;
}
}

 
If you do not receive any errors then you can restart nginx with the following command.

service nginx restart

 
Step 8: Installing osTicket on your Ubuntu 16.04 server
You may now open ‘http://my-domain.com‘ in your web browser of choice and finish the osTicket installation.
Simply follow the instructions you are given and the installation will then finish.
If you have followed every instruction carefully, osTicket will then be installed successfully on your Ubuntu 16.04 server.
Thanks
Do let us know if you want to add any Specific Linux or Windows hosting topics into this tutorial series.

Updated on December 23, 2018

Was this article helpful?

Related Articles

Leave a Comment

[apsl-login-lite login_text='Please login with a social account']