How to Install osTicket on Ubuntu 16.04

OsTicket is a free and open source ticketing tool written in PHP. It is a simple and lightweight tool that allows you to manage, organize and archive your support request.

In this tutorial, you will learn how to install and configure osTicket on Ubuntu 16.04.


  • A Vultr Ubuntu 16.04 server instance.
  • A sudo user with root privileges.

Step 1: System update

Before starting, it is recommended to update the system with the latest stable version. Login with sudo user and run the following commands to update the system.

sudo apt-get update -ysudo apt-get upgrade -y

Step 2: Install LEMP Server

First, you will need to install Nginx, Mysql, PHP, PHP-FPM and other required PHP modules on your system. You can install all of them with the following command:

sudo apt-get install -y nginx mysql-server 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 -y

Once the installation is complete, start the Nginx and MySQL service and add them to start at boot time:

sudo systemctl start nginxsudo systemctl start mysqlsudo systemctl enable nginxsudo systemctl enable mysql

Next, you will need to modify the php.ini file:

sudo nano /etc/php/7.0/fpm/php.ini

Uncomment the following line and change its value to 0:


Save and close the file, then restart the php7-fpm service and add it to start at boot time:

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

Step 3: Configure database for osTicket

By default, MySQL is not secured. You can secure it by running the mysql_secure_installation script.

sudo mysql_secure_installation

Answer all of the questions as shown below:

Set root password? [Y/n] YNew password:Re-enter new password:Remove anonymous users? [Y/n] YDisallow root login remotely? [Y/n] YRemove test database and access to it? [Y/n] YReload privilege tables now? [Y/n] Y

When all is done, connect with MySQL shell with the following command:

mysql -u root -p

Enter your password, then create a new database and user for osTicket:

mysql> create database osticketdb;mysql> create user osticket@localhost identified by 'password';mysql> grant all privileges on osticketdb.* to osticket@localhost identified by 'password';mysql> flush privileges;mysql> exit;

Step 4: Download osTicket

First, you will need to create a directory for osTicket:

sudo mkdir /var/www/html/osticket

Next, change the directory to osTicket and download osTicket with the following commands:

cd /var/www/html/osticketwget

Note: Be sure to get the latest version from osTicket’s download page here.

Once the download is completed, extract the downloaded file.

sudo unzip

Next, copy the sample config file:

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

Change the owner of all osticket files and directories to the ‘www-data’ user and group.

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

Step 5: Configure Nginx for osTicket

You will need to create a new virtual host configuration for osTicket:

sudo nano /etc/nginx/sites-available/osticket

Add the following lines:

server {  listen 80;        server_name;        root   /var/www/html/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;      }}

Save and close the file, then activate the virtual host with the following command:

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

Finally, restart the Nginx service:

sudo systemctl restart nginx

Step 6: Access osTicket web interface

Once everything is configured, it’s time to access osTicket web installation wizard.

Open your web browser and type the URL, you can see the osTicket installation wizard. Follow each instruction carefully and complete the installation.

Once the installation has completed, remove the setup directory and change the permission of the osTicket config file:

sudo rm -rf /var/www/html/osticket/upload/setupsudo chmod 0644 /var/www/html/osticket/include/ost-config.php

Congratulations! You have successfully installed osTicket on your Ubuntu 16.04 server.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.