osTicket is a PHP-based open-source ticketing system for the Linux platform. It can interface with LDAP / Active Directory for central authentication and supports various databases such as MySQL and PostgreSQL. It’s a straightforward and light-weight web application. You can manage, organize, and archive your support requests with OsTicket. It integrates customer support requests received by email, web forms, and phone calls into a simple, easy-to-use, multi-user web-based platform.
Here at Ibmi Media, we shall look into how to install osTicket on Ubuntu 20.04, using MariaDB as a database server and PHP.
Steps to Install Open Source osTicket on Ubuntu
1. Perform System Update
Start by updating the system with the latest release packages by the given command:
$ sudo apt-get update
2. Install all PHP and extensions
osTicket application needs the php extensions in order to run the application. Here, all the extensions needed are given and installed:
$ sudo apt install -y php-common php-fpm php-pear php-cgi php-net-socket php-bcmath php-gd php-imap php-intl php-apcu php-cli php-mbstring php-curl php-mysql php-json php-xml
You can check the version of php and all the php extensions with the below command:
$ php -v
3. Install Apache server
Apache web server is installed for the official apt repository:
$ sudo apt install apache2
To start and enable the apache server manually here are the commands listed below. (The service is started on boot by default):
$ sudo systemctl start apache2
$ sudo systemctl enable apache2
To check the status of the apache server to check whether it is running or stopped:
$ sudo systemctl status apache2
4. Install MariaDB database and configure
MariaDB database server is needed with a valid username, password, and hostname during the installation process. The user should be given full privileges on the database created.
Here, the command is used to install the MariaDB server:
$ sudo apt install mariadb-server
To secure the MariaDB server here are the following steps to be done:
$ sudo mysql_secure_installation
After entering the password for root some questions are asked before securing the server. We need to apply yes for all the given questions like:
- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables
Here, the authentication plugin is changed to be able to login as the normal user:
$ sudo mysql -u root
MariaDB [(none)]> UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE User = 'root';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> QUIT;
The confirmation of the database working with the below command:
$ mysql -u root -p
Here, a database is created for the osTicket application:
MariaDB [(none)]> CREATE DATABASE osTicket_database;
After the completion of the creating database, we need to create a user osTicket_user for connecting the database and grant privileges. Following queries are for creating a user and connecting it to the database with full privileges granted:
MariaDB [(none)]> CREATE USER ‘osTicket_user’@‘localhost’ IDENTIFIED BY ‘password’;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON osTicket_database.* TO osTicket_user@localhost IDENTIFIED BY “password”;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> QUIT;
5. Create Directory for osTicket
The directory is created for the osTicket application giving the path where the directory is being created:
$ sudo mkdir -p /var/www/os_ticket
The directory ownership is changed to the Linux user for further modifications easily without any permission issues:
$ sudo chown -R $USER:$USER /var/www/os_ticket
Now, path to the os_ticket directory using the cd command and pull the latest osTicket installation archive from GitHub using wget command:
$ cd /var/www/os_ticket
$ wget https://github.com/osTicket/osTicket/releases/download/v1.15.2/osTicket-v1.15.2.zip
Extract the download file using the unzip command:
$ unzip osTicket-v1.15.2.zip
(Here, the version must be given according to the file you have downloaded.)
After the archive file is extracted you can delete the zip file:
$ rm osTicket-v1.15.2.zip
osTicket has its own sample configuration file by default. We need to copy the file in the same directories and change its names:
$ sudo cp upload/include/ost-sampleconfig.php upload/include/ost-config.php
chown command is used to assign the owner to the apache server user – www-data and chmod command is used for the appropriate permissions required:
$ sudo chown -R www-data:www-data /var/www/os_ticket
$ sudo chmod -R 755 /var/www/os_ticket
6. Create a Virtual Host File
A configuration file should be created under the path /etc/apache2/sites-available directory in order to run osTicket with apache server.
Here, a2dissite command is used to disable the default Apache configuration file.(In our case it is already disabled).
$ sudo a2dissite 000-default.conf
vim command is used to open the configuration file for editing the information:
$ sudo vim /etc/apache2/sites-enabled/os_ticket.conf
All the information is given below with the necessary permissions and directories. The server name and server alias must be replaced with your domain name and public IP address:
<VirtualHost *:80>
ServerName 192.168.120.129 #localhost
ServerAlias www.osticket.com #Your domain name
DocumentRoot "/var/www/os_ticket/upload"
<Directory "/var/www/os_ticket/upload">
Require all granted
Options Indexes FollowSymLinks
AllowOverride All
Order allow, deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
After the configuration file is done and saved, a2ensite command is used to enable the configuration file.(In my case it is already enabled):
$ sudo a2ensite os_ticket.conf
Finally, restart the apache service to reload the new configuration file:
$ sudo systemctl restart apache2
The firewall is enabled by default so, to get access to the site you can either disable the firewall with the command below or can assign the designated port for the site:
$ ufw disable
7. Install Osticket on the system
- After the installation process is done, open the firefox app and visit the site using the servername.
- Now, the following page is opened.
- Click continue to proceed to the next page.
- Now, enter all the credentials given and complete the form. Here, you should provide all the information as per the requirement.
- The database created before in the system should be written in the osTicket Basic Installation form.
- The confirmation page is opened after the form is filled with the right credentials.
- Next, you will see the dashboard of the admin.
8. Configure HTTPS / SSL Certificate for Osticket
We should enable a secure HTTPS connection on PrestaShop. We can obtain a free TLS certificate from Let’s Encrypt. Install Let's Encrypt client (Certbot) from Ubuntu 20.04 repository:
$ sudo apt install certbot python3-certbot-apache
Next, run the following command to obtain a free TLS certificate using the Apache plugin:
$ sudo certbot --apache --agree-tos --redirect --staple-ocsp --email you@example.com -d example.com
If the test is successful, reload Apache for the change to take effect:
$ sudo apache2ctl -t
$ sudo systemctl reload apache2
How to access osTicket Web Interface ?
osTicket will be available on HTTP port 80 by default. Open your favorite browser and navigate to https://your-domain.com or https://server-ip-address.