OsTicket

Cara Install OsTicket di Ubuntu 22

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

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.

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

Installasi osTicket dari How To Forge

How to Install osTicket on Ubuntu 22.04

On this page

osTicket is an open-source and one of the most widely used ticketing systems by small and medium-sized businesses. It is a simple and easy-to-use web-based customer support portal that helps you to manage and track all tickets. osTicket allows you to define ticket routing rules to send tickets to the correct person. You can customize and add your logo, images, and videos to tickets. osTicket supports many database types, such as MySQL and PostgreSQL, and can be integrated with LDAP/Active directory for central authentication.

This post will explain how to install osTicket with Apache on Ubuntu 22.04.

Prerequisites

Install Apache, MariaDB, and PHP

First, you will need to install the Apache web server, MariaDB, PHP, and other PHP extensions to your server. You can install all the packages using the following command.

apt install apache2 mariadb-server php libapache2-mod-php php-mysql php-cgi php-fpm php-cli php-curl php-gd php-imap php-mbstring php-pear php-intl php-apcu php-common php-bcmath -y

Once all the packages are installed, start and enable the Apache and MariaDB service using the following command.

systemctl start apache2
systemctl enable apache2
systemctl start mariadb
systemctl enable mariadb

Create a Database for osTicket

First, secure the MariaDB installation with the following command.

mysql_secure_installation

Answer all the questions to set a MariaDB root password and secure the installation:

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!

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 now? [Y/n] Y

Next, log in to the MariaDB shell with the following command.

mysql -u root -p

Once logged in, create a database and user for osTicket with the following command.

MariaDB [(none)]> CREATE DATABASE osticket;
MariaDB [(none)]> CREATE USER 'osticket'@'localhost' IDENTIFIED BY 'securepassword';

Next, grant all the privileges to the osTicket database with the following command.

MariaDB [(none)]> GRANT ALL PRIVILEGES ON osticket.* TO osticket@localhost IDENTIFIED BY "securepassword";

Next, flush the privileges and exit from the MariaDB shell with the following command.

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Once you are done, you can proceed to the next step.

Download osTicket

First, download the latest version of osTicket with the following command.

wget https://github.com/osTicket/osTicket/releases/download/v1.17.2/osTicket-v1.17.2.zip

Once the osTicket is downloaded, create a directory of osTicket and extract the downloaded file inside that directory.

mkdir /var/www/html/osticket
unzip osTicket-v1.17.2.zip -d /var/www/html/osticket

Next, change the ownership and permission of the osTicket directory with the following command:

chown -R www-data:www-data /var/www/html/osticket
chmod -R 755 /var/www/html/osticket

Now, rename the osTicket sample configuration file using the command given below:

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

Once you are finished, you can proceed to the next step.

Create Apache Virtual Host

Next, you will need to create an Apache virtual host configuration file for osTicket. You can create it with the following command.

nano /etc/apache2/sites-available/osticket.conf

Add the following lines:

<VirtualHost *:80>
        ServerName osticket.example.com
        ServerAdmin admin@localhost
        DocumentRoot /var/www/html/osticket/upload

        <Directory /var/www/html/osticket/upload>
                Require all granted
                Options FollowSymlinks
                AllowOverride All
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/osticket.error.log
        CustomLog ${APACHE_LOG_DIR}/osticket.access.log combined
</VirtualHost>

Save and close the file when you are done. Then, activate the osTicket virtual host and enable the Apache rewrite module with the following command:

a2ensite osticket.conf
a2enmod rewrite

Next, restart the Apache service to apply the configuration changes:

systemctl restart apache2

You can check the Apache status with the following command.

systemctl status apache2

You should get the following output.

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-12-21 07:20:15 UTC; 3s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 62019 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 62023 (apache2)
      Tasks: 6 (limit: 2238)
     Memory: 15.4M
        CPU: 42ms
     CGroup: /system.slice/apache2.service
             ??62023 /usr/sbin/apache2 -k start
             ??62024 /usr/sbin/apache2 -k start
             ??62025 /usr/sbin/apache2 -k start
             ??62026 /usr/sbin/apache2 -k start
             ??62027 /usr/sbin/apache2 -k start
             ??62028 /usr/sbin/apache2 -k start

Dec 21 07:20:15 ubuntu2204 systemd[1]: apache2.service: Deactivated successfully.
Dec 21 07:20:15 ubuntu2204 systemd[1]: Stopped The Apache HTTP Server.
Dec 21 07:20:15 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

Launch osTicket Installation Wizard

You can now launch the osTicket installation wizard using the URL http://osticket.example.com. You should see the following page.

Click on the Continue. You should see the basic installation page.

Define your helpdesk URL, name, email, database name, username, password, then click on the Install Now button to start the installation. Once the osTicket is installed, you should see the following page.

To access the osTicket control panel, type the URL http://osticket.example.com/scp in your web browser. You should see the osTicket login page.

Provide your admin username, password and click on the Login button. You should see the osTicket dashboard on the following screen.

You can also access the osTicket default page using the URL http://osticket.example.com

Secure osTicket with Let's Encrypt SSL

To secure your website with the Let's Encrypt SSL, you will need to install the certbot package on your server.

First, install the Snap package manager with the following command:

apt install snapd

Next, update the Snap package to the latest version:

snap install core
snap refresh core

Next, install the certbot package using the following command:

snap install --classic certbot

Next, create a symbolic link for Certbot binary to the system location:

ln -s /snap/bin/certbot /usr/bin/certbot

Next, run the following command to download and install Let's Encrypt SSL certificates:

certbot --apache -d osticket.example.com

You will be asked to provide your email address and accept the term of service:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): hitjethva@gmail.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y

Type Y and press the Enter key to download and install the SSL certificates for your domain:

Account registered.
Requesting a certificate for osticket.example.com

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/osticket.example.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/osticket.example.com/privkey.pem
This certificate expires on 2023-03-22.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for osticket.example.com to /etc/apache2/sites-enable/osticket.conf
Congratulations! You have successfully enabled HTTPS on https://osticket.example.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Conclusion

In this post, we showed you how to install osTicket with Apache on Ubuntu 22.04 server. You can now deploy osTicket in your organization to scale and streamline your customer service and drastically improve your customer experience.