How to Install osTicket on Ubuntu 16.04

how to install osticket on ubuntu 16.04

In this tutorial, we will show you, how to install  osTicket on Ubuntu 16.04, using a LEMP stack, with Nginx as a web server, MySQL database server and PHP 7.0. osTicket is a free and open source support ticket system written in PHP. It’s a simple and lightweight tool, which you can use to manage, organize and archive your support ticket requests. Installing osTicket on Ubuntu 16.04, is an easy task if you carefully follow this tutorial below. Let’s get started.

1. Login via SSH and update the system

Before we begin, you will need to login to your server via SSH as user root:

ssh root@IP_ADDRESS -p PORT_NUMBER

and replace “IP_ADDRESS” and “PORT_NUMBER” with your actual server IP address and SSH port number.

Let’s also make sure that your Ubuntu 16.04 server is up-to-date by running the following commands:

apt-get update
apt-get upgrade

2. Install Nginx

To install the latest stable Nginx version on your server, simply run the following command:

apt-get install nginx

3. Install and Configure MySQL Database Server

To install the MySQL database server, run the following command:

apt-get install mysql-client mysql-server

After the installation, you can run the mysql_secure_installation script to set your MySQL root password and secure your MySQL installation.

mysql_secure_installation

4. Install PHP and PHP-FPM

Next, we will install PHP 7.0, PHP-FPM and some additional PHP modules which are required for OsTicket to run properly:

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

5.  Download a fresh copy of osTicket

Before we download osTicket we need to create a new directory. We can do this with the following command:

mkdir /var/www/osticket

We can change our current working directory with:

cd /var/www/osticket

Now we can download the latest OsTicket version inside this directory with:

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

6. Extract and configure osTicket

To extract the archive run:

unzip osTicket-v1.10.1.zip

Next, you need to make a copy of the sample configuration file:

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

And finaly, we need to change ownerhsip of our osticket directory with:

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

6. Create a new database for OsTicket

To setup a new database for our osTicket installation, we first need to login to our MySQL server with:

mysql -u root -p

And then run the following commands to create the database:

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

Don’t forget to replace ‘PASSWORD’ with an actual strong password.

7. Configure the Nginx virtual host

To create a new Nginx server block, run the following command:

nano /etc/nginx/sites-available/osticket

And then enter the following (make sure that you replace my-domain.com with your actual 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 creating a symbolic link:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
ln -s /etc/nginx/sites-available/osticket /etc/nginx/sites-enabled/osticket

You can teste the nginx configuration with

nginx -t

If there are no erros you can then restart nginx with:

service nginx restart

8. Install osTicket on your Ubuntu 16.04 server

You can now open http://my-domain.com in your favorite web browser in order to finish the osTicket installation (my-domain.com beeing your actual domain name).

Just follow the instructions provided in order to finish the installation.

That’s it. If you followed all of the instructions carefully, osTicket should be successfully installed on your Ubuntu 16.04 server.

 

how to isntall osticket on ubuntu 16.04Of course you don’t have to install osTicket on Ubuntu 16.04, if you use one of our managed Ubuntu VPS hosting services, in which case you can simply ask our expert Linux admins to setup osTicket for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, on how to install osTicket on Ubuntu 16.04, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

 

4 thoughts on “How to Install osTicket on Ubuntu 16.04”

  1. Great Tutorial.

    Please fix the command below (../html/.. is not in the initial path created):

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

    Reply
  2. I am getting access denied during step number 8. Please help. Thanks

    ==================
    8. Install osTicket on your Ubuntu 16.04 server

    You can now open http://my-domain.com in your favorite web browser in order to finish the osTicket installation (my-domain.com beeing your actual domain name).

    Reply
    • Make sure you have followed the instructions in all of the steps as shown in our tutorial and make sure your Nginx virtual host is configured properly. You can also check your Nginx error log at /var/log/nginx/error.log for more information about the issue.

      Reply

Leave a Comment