Learn How To Install osTicket on Debian 10

March 14, 2019

Table of Contents

If you are using a different system, please check our other tutorials.

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 Debian 10 (buster).

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 Debian version.

lsb_release -ds
# Debian GNU/Linux 10 (buster)

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 php php-cli php-fpm php-common php-mbstring php-curl php-gd php-mysql php-json php-xml php-imap php-intl php-apcu

Check the version.

php -v
# PHP 7.3.4-2 (cli) (built: Apr 13 2019 19:05:48) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies
#    with Zend OPcache v7.3.4-2, Copyright (c) 1999-2018, by Zend Technologies

Check installed PHP extensions.

php -m
# mbstring
# curl
# gd
# PDO
# mysqli
# openssl
# . . .

Install MariaDB

Install MariaDB.

sudo apt install -y mariadb-server

Check the version.

mysql --version
# mysql  Ver 15.1 Distrib 10.3.15-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

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

sudo mysql_secure_installation

Log into MariaDB as the root user.

sudo mysql -u root -p
# Enter password:

Create a new MariaDB 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.2

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.3-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

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!