Article

Table of Contents
Theme:
Was this article helpful?
Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $300 by adding new articles!

How to Install osTicket on Ubuntu 18.04 LTS

Last Updated: Wed, Jan 29, 2020
Business Linux Guides System Admin Ubuntu

osTicket is an open-source customer support ticketing system. osTicket source code is publicly hosted on Github. In this tutorial, you will learn how to install and configure osTicket on Ubuntu 18.04 LTS.

Requirements

  • HTTP server running Nginx or Apache. This guide will use Nginx.
  • PHP version 5.6 or greater
  • mysqli, gd, gettext, imap, json, mbstring, and xml extensions for PHP
  • MySQL database version 5.0 or greater

Before you begin

Check the Ubuntu version.

lsb_release -ds
# Ubuntu 18.04.2 LTS

Create a new non-root user account with sudo access and switch to it.

adduser johndoe --gecos "John Doe"
usermod -aG sudo johndoe
su - johndoe

NOTE: Replace johndoe with your username.

Set up the timezone.

sudo dpkg-reconfigure tzdata

Ensure that your system is up to date.

sudo apt update && sudo apt upgrade -y

Install the needed packages.

sudo apt install -y zip unzip curl wget git

Install PHP

Install PHP, as well as the necessary PHP extensions.

sudo apt install -y php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-mbstring php7.2-curl php7.2-gd php7.2-mysql php7.2-json php7.2-xml php7.2-imap php7.2-intl php-apcu

Check the version.

php -v
# PHP 7.2.19-0ubuntu0.18.04.2 (cli) (built: Aug 12 2019 19:34:28) ( NTS )

Check installed PHP extensions.

php -m

# mbstring
# curl
# gd
# PDO
# mysqli
# openssl
# . . .

Install MySQL

Install MySQL.

sudo apt install -y mysql-server

Check the version.

mysql --version
# mysql  Ver 14.14 Distrib 5.7.27, for Linux (x86_64) using  EditLine wrapper

Run the mysql_secure_installation script to improve the security of your MySQL installation.

sudo mysql_secure_installation

Log into MySQL as the root user.

sudo mysql -u root -p
# Enter password:

Create a new MySQL database and user and remember the credentials.

CREATE DATABASE dbname;
GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit;

Install Nginx

Install Nginx.

sudo apt install -y nginx

Check the version.

sudo nginx -v
# nginx version: nginx/1.14.0 (Ubuntu)

Configure Nginx for use with the Osticket.

sudo vim /etc/nginx/sites-available/osticket.conf

Populate the file with the following.

server {

  listen 80;
  server_name example.com;

  root /var/www/osticket/upload;
  index index.php index.html;

  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;
  }

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

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

  location ~ ^/ajax.php/.*$ {
    try_files $uri $uri/ /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;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
  }

}

Activate the new osticket.conf configuration by linking the file to the sites-enabled directory.

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

Test the configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install osTicket

Create a document root directory.

sudo mkdir -p /var/www/osticket

Change ownership of the /var/www/osticket directory to johndoe.

sudo chown -R johndoe:johndoe /var/www/osticket

Navigate to the document root folder.

cd /var/www/osticket

Download and unzip the latest release of osTicket.

wget https://github.com/osTicket/osTicket/releases/download/v1.12.2/osTicket-v1.12.2.zip
unzip osTicket-v1.12.2.zip
rm osTicket-v1.12.2.zip

Copy the sample config file.

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

Change ownership of the /var/www/osticket directory to www-data.

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

Once everything is configured, it's time to access the osTicket web installation wizard. Open your site in a web browser and follow the instructions on the screen to finish the installation.

After the installation for security reasons, delete setup directory.

sudo rm -rf upload/setup
sudo chmod 0644 upload/include/ost-config.php

Want to contribute?

You could earn up to $300 by adding new articles