procedures:osticket

OsTicket Install/Migration

This part is for installing the v1.10 of the osTicket software which is the one that is live at the moment of the writing of this Wiki.

System update and installing the dependecies

sudo apt update && sudo apt upgrade -y
sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2 curl wget unzip net-tools

Since it is an old version and is no longer distributed we will have to installit through a repository.

Add the key of the repository and update the packages list

curl -sSL https://packages.sury.org/php/README.txt | sudo bash -x
sudo apt update

Apche and MariaDB

sudo apt install -y apache2 mariadb-server

Now do the mariadb secure installation

mariadb-secure-installation

And to finish the mariadb config add these lines in /etc/mysql/my.cnf to enable the remote access

[mysqld]
bind-address=0.0.0.0

Php5.6 and necessary extension

sudo apt install -y php5.6 php5.6-cli php5.6-mysql php5.6-fpm php5.6-xml php5.6-mbstring php5.6-gd php5.6-imap php5.6-json php5.6-apcu php5.6-intl php5.6-mcrypt libapache2-mod-php5.6

Enable the Php module in Apache

sudo a2enmod php5.6
sudo systemctl restart apache2

For this installation we will use a dump of a already existing database.

Access MySQL

sudo mysql -u root -p

Create the user and database

CREATE DATABASE osticket_db;
CREATE USER 'osticket_user'@'localhost' IDENTIFIED BY 'password_of_ur_choice';
GRANT ALL PRIVILEGES ON osticket_db.* TO 'osticket_user'@'localhost';
CREATE USER 'root'@'%' IDENTIFIED BY 'password_of_ur_choice'; (to have a user with the remote access)
GRANT ALL PRIVILEGES ON osticket_db.* TO 'root'@'%';
FLUSH PRIVILEGES;
EXIT;

Now we can import the dump.sql into the databse we just created (if you don't have a dump skip this).

mysql -u osticket_user -p osticket_db < /path/to/dump.sql

Dowload the .zip

wget https://github.com/osTicket/osTicket/releases/download/v1.10/osTicket-v1.10.zip
unzip osTicket-v1.10.zip -d osticket
sudo mv osticket/upload /var/www/html/osticket

Rename the config file

sudo mv /var/www/html/osticket/include/ost-sampleconfig.php /var/www/html/osticket/include/ost-config.php

Edit the file (only if you have the sql dump)

sudo vim /var/www/html/osticket/include/ost-config.php
define('DBTYPE','mysql');
define('DBHOST','localhost');
define('DBNAME','osticket_db');
define('DBUSER','osticket_user');
define('DBPASS','password_of_ur_choice');
define('TABLE_PREFIX','ost_');
define('OSTINSTALLED',TRUE);
define('SECRET_SALT','uKVB7ZnvozppfEOzuyWVVZlZX81thj6p'); (put this exact string to uncrypt the tickets)
define('ADMIN_EMAIL','ur_email@example.com');

Set Apache propriety

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

Set config file to only read

sudo chmod 0644 /var/www/html/osticket/include/ost-config.php

Remove setup fodler (ONLY IF YOU HAD THE SQL DUMP)

sudo rm -rf /var/www/html/osticket/setup/

Search on a browser the URL/osticket and if you had the sql dump everything should be operative. If this was the first install follow the instruction the osTicket wizard tells you.

OsTicket Update

This section is for the OsTicket and Php update (only for OsTicket version older than the 1.6). The first thing to do is to on the admin pannel and disable the service.

Install the new version and extension

sudo apt update
sudo apt install -y php8.4 php8.4-cli php8.4-mysql php8.4-fpm php8.4-xml php8.4-mbstring php8.4-gd php8.4-intl php8.4-apcu php8.4-bcmath libapache2-mod-php8.4

Activate the new version

sudo a2dismod php5.6
sudo a2enmod php8.4
sudo systemctl restart apache2

Install the files

cd /tmp
wget https://github.com/osTicket/osTicket/releases/download/v1.18.4/osTicket-v1.18.4.zip

(ofc check if the link is the right version)

Change the files

Unzip the files

unzip osTicket-v1.18.4.zip -d osticket_new

Save a config copy

cp /var/www/html/osticket/include/ost-config.php /tmp/ost-config.bak

Overwrite the files in the osticket folder

sudo cp -r /tmp/osticket_new/upload/* /var/www/html/osticket/

Put the old config file

sudo cp /tmp/ost-config.bak /var/www/html/osticket/include/ost-config.php

Reset the Apache permission

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

Now you will have to access the admin pannel and there will be a voice that says to start the update. Do it.

Remove the setup folder

Do this only after a few minutes the end of the update on the platform

sudo rm -rf /var/www/html/osticket/setup/

Make sure the config file is only readble

sudo chmod 0644 /var/www/html/osticket/include/ost-config.php

Nginx migration

Now the migration from apache2 to nginx

sudo apt update
sudo apt install nginx -y
sudo systemctl stop apache2
sudo systemctl disable apache2
sudo systemctl enable --now phpx.x-fpm
sudo rm /etc/nginx/sites-enabled/default

Create a new config file

sudo vim /etc/nginx/sites-available/osticket
server {
    listen 80;
    server_name your_URL_or_IP;
    root /var/www/html;
    index index.php index.html index.htm;

    access_log /var/log/nginx/osticket_access.log;
    error_log /var/log/nginx/osticket_error.log;

    location ~ ^/osticket/(include|setup|pages|plugins)/ {
        deny all;
        return 403;
    }

    location /osticket/ {
        try_files $uri $uri/ /osticket/index.php?$query_string;
    }
    location ~ ^/osticket/(api|apps|include/plugins)/ {
        try_files $uri $uri/ @osticket-api;
    }

    location @osticket-api {
        rewrite ^/osticket/api/(.*)$ /osticket/api/http.php/$1 last;
        rewrite ^/osticket/apps/(.*)$ /osticket/apps/dispatcher.php/$1 last;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/phpx.x-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;

        fastcgi_read_timeout 300;
    }

    location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
        expires 30d;
    }

    location ~ /\. {
        deny all;
    }
}

Enable the website

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

Test the config and start Nginx

sudo nginx -t

If the result is positive then start nginx

sudo systemctl enable --now nginx
sudo chown -R www-data:www-data /var/www/html/osticket/
sudo chmod -R 755 /var/www/html/osticket/

Install certbot

apt install -y python3-certbot python3-certbot-nginx

Use certbot

After you run this command follow the instructions

sudo certbot certonly --nginx

Update the Nginx configuration file

server {
    server_name your_URL_or_IP;

    root /var/www/html;
    index index.php index.html index.htm;

    access_log /var/log/nginx/osticket_access.log;
    error_log /var/log/nginx/osticket_error.log;

    location ~ ^/osticket/(include|setup|pages|plugins)/ {
        deny all;
        return 403;
    }

    location /osticket/ {
        try_files $uri $uri/ /osticket/index.php?$query_string;
    }
    location ~ ^/osticket/(api|apps|include/plugins)/ {
        try_files $uri $uri/ @osticket-api;
    }

    location @osticket-api {
        rewrite ^/osticket/api/(.*)$ /osticket/api/http.php/$1 last;
        rewrite ^/osticket/apps/(.*)$ /osticket/apps/dispatcher.php/$1 last;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/phpx.x-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;

        fastcgi_read_timeout 300;
    }

    location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
        expires 30d;
    }

    location ~ /\. {
        deny all;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/your_URL/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/your_URL/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    #if ($host = your_URL) {
    #    return 301 https://$host$request_uri;
    #} # managed by Certbot


    listen 80;
    server_name your_URL your_IP;
    return 301 http://$host$request_uri;
}

Restart nginx

sudo systemctl restart nginx
  • procedures/osticket.txt
  • Last modified: 2026/07/03 10:54
  • by mattia.stalio