How to Install osTicket on Ubuntu 22.04

how to install osticket on ubuntu 22.04

osTicket is an open-source software for ticketing systems. It is written in PHP and the data can be stored in MySQL or PostgreSQL database. osTicket offers a variety of features such as Ticket Filters, Service Level Agreements, Queues, Advanced Search, etc. In this blog post, we are going to use the LAMP stack for our osTicket system. In this tutorial, we are going to explain in detail how to install osTicket on Ubuntu 22.04.

Installing osTicket with the LAMP stack on Ubuntu 22.04 is straightforward, and the process will take up to 15 minutes. Let’s get things done!

Prerequisites

  • A server running Ubuntu 22.04 or an Ubuntu VPS
  • User privileges: root or non-root user with sudo privileges

Step 1. Update the System

Since we have a fresh installation of Ubuntu 22.04, we need to update the packages to the latest versions available:

sudo apt update -y && sudo apt upgrade -y

Step 2. Install LAMP Stack

First part of installing the LAMP stack will be the Apache web server. To install it, execute the following command:

sudo apt install apache2 -y

Once installed, start and enable the service.

sudo systemctl enable apache2 && sudo systemctl start apache2

Check if the service is up and running:

sudo systemctl status apache2

You should receive the following output:

root@host:~# sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2023-10-19 04:50:18 CDT; 1s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 50686 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 50690 (apache2)
      Tasks: 6 (limit: 4558)
     Memory: 10.0M
        CPU: 203ms
     CGroup: /system.slice/apache2.service

Next is PHP with its extensions. To install PHP 8.1 completely, execute the following command:

sudo apt-get install php8.1 php8.1-cli php8.1-common php8.1-imap php8.1-redis php8.1-snmp php8.1-xml php8.1-zip php8.1-mbstring php8.1-curl php8.1-mysqli php8.1-gd php8.1-intl php8.1-apcu libapache2-mod-php -y

To check the installed PHP version, execute the following command, php -v:

root@host:~# php -v
Created directory: /var/lib/snmp/cert_indexes
PHP 8.1.2-1ubuntu2.14 (cli) (built: Aug 18 2023 11:41:11) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.14, Copyright (c), by Zend Technologies

The last component of the LAMP stack is the MariaDB (or MySQL) database server. To install the MariaDB database server, execute the command below.

sudo apt install mariadb-server -y

Start and enable the mariadb.service with the following commands:

sudo systemctl start mariadb && sudo systemctl enable mariadb

Check the status of the mariadb.service

sudo systemctl status mariadb

You should receive the following output:

root@host:~# sudo systemctl status mariadb
● mariadb.service - MariaDB 10.6.12 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2023-10-19 04:58:18 CDT; 22s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 55172 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 15 (limit: 4558)
     Memory: 61.2M
        CPU: 1.921s
     CGroup: /system.slice/mariadb.service
             └─55172 /usr/sbin/mariadbd

Step 3. Create osTicket database and database user

Next is to create the MariaDB database, the database user and grant permissions to that user for access to our osTicket database. Log in to the MariaDB console and execute the commands below:

CREATE DATABASE osticket;
GRANT ALL PRIVILEGES ON osticket.* TO osticket@localhost IDENTIFIED BY "YourStrongPasswordHere";
FLUSH PRIVILEGES;
EXIT;

Make sure to replace YourStrongPasswordHere with your own strong password. Make sure to note which password you used; you’ll need it later.

Step 4. Install osTicket on Ubuntu 22.04

First, we need to download the latest osTicket version into our Apache web document root.

cd /var/www/html

curl -s https://api.github.com/repos/osTicket/osTicket/releases/latest | grep browser_download_url | cut -d '"' -f 4 | wget -i -

Unzip the file and copy the configuration:

unzip osTicket-v1.18.zip -d osTicket

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

rm osTicket-v1.18.zip

Set the right permissions to files and folders.

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

find . -type d -exec chmod 755 {} \;

find . -type f -exec chmod 644 {} \;

Step 5. Create Apache Virtual Host File

Go into the Apache directory and create a configuration file for osTicket.

cd /etc/apache2/sites-available/

touch osticket.conf

Open the file, paste the following lines of code, save the file and close it.

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
<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /var/www/html/osTicket/upload

<Directory /var/www/html/osTicket>
AllowOverride All
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Enable the Apache configuration for osTicket and enable the Apache rewrite module.

sudo a2enmod rewrite

sudo a2ensite osticket.conf

Use this command to check your syntax for any errors:

apachectl -t

You should receive the following output:

root@vps:~# apachectl -t
Syntax OK

If the syntax is OK, you can restart the Apache service.

systemctl reload apache2

Once the Apache service is restarted, you can finish the osTicket installation at http://yourdomain.com. You must set a Name, Email, Username, and a strong password for your ticketing system. Also, you will be asked for the database credentials you set in step three during the installation. Congrats! You can now start using osTicket.

If you do not want to configure osTicket on your own, you can sign up for one of our NVMe VPS plans and submit a support ticket. Our admins are available 24/7 and will start work on your request immediately. You can always trust our epic support.

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

Leave a Comment