How To Install OTRS on Ubuntu 22.04

This guide intends to teach you to Install and Configure OTRS (OpenSource Trouble Ticket System) on Ubuntu 22.04.

The OpenSource Ticket System or OTRS, are free applications that allow us to manage incidents and requests for services in an organized and automated way in order to provide adequate technical support and facilitate any other interaction with your customers or users. These incidents and requests are received based on tickets sent by users, which are stored and delivered in various ways such as by telephone or email, to the operator in charge of managing it, keeping track of each activity.

Steps To Install OTRS on Ubuntu 22.04

To complete this guide, log in to your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow our guide on Initial Server Setup with Ubuntu 22.04.

In this guide, we will show you to install the OTRS Community edition from the source on Ubuntu 22.04. To do this, follow the steps below.

Install Required Packages For OTRS

First, you need to update your local package index with the following command:

sudo apt update

Then, use the following command to install the required build tools on your Ubuntu system:

sudo apt install perl libapache2-mod-perl2 libdbd-mysql-perl libtimedate-perl \
libnet-dns-perl libnet-ldap-perl libio-socket-ssl-perl libpdf-api2-perl \
libdbd-mysql-perl libsoap-lite-perl libtext-csv-xs-perl libjson-xs-perl \
libapache-dbi-perl libxml-libxml-perl libxml-libxslt-perl libyaml-perl \
libarchive-zip-perl libcrypt-eksblowfish-perl libencode-hanextra-perl \
libmail-imapclient-perl libtemplate-perl libmoo-perl libauthen-ntlm-perl \
libjavascript-minifier-xs-perl libdbd-odbc-perl  libcss-minifier-xs-perl \
libdbd-pg-perl libdatetime-perl apache2 mariadb-server mariadb-client -y

Download the latest OTRS Source Code

At this point, you need to create an OTRS system user account by using the command below:

sudo useradd -r -m -d /opt/otrs -c "OTRS User" -s /usr/sbin/nologin otrs

Then, visit the OTRS Community Edition Downloads page and get the latest package by using the wget command and extract it in the /opt/otrs directory:

# sudo wget https://otrscommunityedition.com/download/otrs-community-edition-6.0.39.tar.gz
# sudo tar xvfz otrs-community-edition-6.0.39.tar.gz -C /opt/otrs --strip-components=1

Next, run the OTRS Perl script on Ubuntu 22.04 to check if all required modules are in place:

sudo perl /opt/otrs/bin/otrs.CheckModules.pl
Output
 o Apache::DBI......................ok (v1.12)
  o Apache2::Reload..................ok (v0.13)
  o Archive::Tar.....................ok (v2.38)
  o Archive::Zip.....................ok (v1.68)
  o Crypt::Eksblowfish::Bcrypt.......ok (v0.009)
  o CSS::Minifier::XS................ok (v0.13)
  o Date::Format.....................ok (v2.24)
  o DateTime.........................ok (v1.55)
    o DateTime::TimeZone.............ok (v2.51)
  o DBI..............................ok (v1.643)
  o DBD::mysql.......................ok (v4.050)
  o DBD::ODBC........................ok (v1.61)
...

Note: If any Perl module is missing, install them using the package manager.

Activate Default OTRS Configuration

At this point, you need to activate the default OTRS configuration, /opt/otrs/Kernel/Config.pm.dist, by renaming it to remove the .dist extension. To do this, run the following command:

sudo cp /opt/otrs/Kernel/Config.pm{.dist,}

When you are done, check other required modules are ok by using the following command:

# sudo perl -cw /opt/otrs/bin/cgi-bin/index.pl
# sudo perl -cw /opt/otrs/bin/cgi-bin/customer.pl
# sudo perl -cw /opt/otrs/bin/otrs.Console.pl
# sudo perl /opt/otrs/bin/otrs.SetPermissions.pl

Create OTRS Database User on Ubuntu 22.04

At this point, you need to run the MySQL security script:

sudo mysql_secure_installation

Set a password for your MariaDB and answer the question by entering the y.

 Enter current password for root (enter for none):
    Set root password? [Y/n]: Y
    Enter Password:
    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

Then, log in to your MariaDB shell with the following command

sudo mysql -u root -p

Now use the following command to create the OTRS database on Ubuntu 22.04:

MariaDB [(none)]> create database otrsdb character set utf8 collate utf8_general_ci;

Next, use the following command to create the database user and grant all the privileges to it:

MariaDB [(none)]> grant all on otrsdb.* to otrsuser@localhost identified by 'password';

Flush the privileges and exit from the MariaDB shell:

MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;

At this point, edit the MariaDB configuration file and tweak some settings:

sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf

Update the following lines inside the [mysqld] section as shown below:

max_allowed_packet   = 64M
query_cache_size     = 32M
innodb_log_file_size = 256M

When you are done, save and close the file.

To apply the changes, restart the MariaDB service:

sudo systemctl restart mariadb

Configure Apache For OTRS on Ubuntu 22.04

At this point, you need to link the OTRS Apache configuration file to the Apache web root directory to serve OTRS via Apache. To do this, run the command below:

sudo ln -s /opt/otrs/scripts/apache2-httpd.include.conf /etc/apache2/sites-enabled/

Disable the default Apache site by running the command below:

sudo a2dissite 000-default.conf

Next, enable the required Apache modules with the following command:

sudo a2enmod perl version deflate filter headers

Set the correct ownership for the /opt/otrs directory:

# sudo chown -R otrs: /opt/otrs/
# sudo usermod -aG www-data otrs

Update OTRS Files Permissions by using the command below on Ubuntu 22.04:

sudo /opt/otrs/bin/otrs.SetPermissions.pl --web-group=www-data

Check Apache configuration for any error:

sudo apachectl -t
Output
Syntax OK

To apply the changes, restart the Apache service:

sudo systemctl restart apache2

If you have a firewall running on your server, you need to allow external access to Apache service:

sudo ufw allow 80/tcp

Access OTRS Web Interface

At this point, you can access your OTRS through the web interface by typing your server’s IP address in your web browser followed by /otrs/installer.pl:

You will see the OTRS Welcome screen on Ubuntu 22.04. Click Next to continue.

OTRS Welcome screen ubuntu 22.04
OTRS Welcome screen

Next, Accept the license and Continue.

OTRS License Agreement
License Agreement

Then, you will see the database selection. Choose MySQL, Use an existing database for OTRS, and click Next. At this point, you need to enter the OTRS Database credentials and click Next.

OTRS Database Configuration Ubuntu 22.04
Database Configuration

In the next screen, you should see the database setup is successful. Then, click Next.

OTRS Database Setup
Database Setup

Now you should see the system settings screen. Define your required settings and click Next.

System Settings for OTRS Ubuntu 22.04
System Settings

Define your SMTP server or leave it blank and click on the Skip this step button.

Mail Configuration for OTRS
Mail Configuration

Once the installation has been completed, you should see the server URL with the login username and password. Click on the provided URL.

OTRS URL
OTRS URL

You will be redirected to the OTRS login screen on Ubuntu 22.04. Enter the username and password and click Login.

OTRS Login Screen
OTRS Login Screen

You should see the OTRS dashboard on Ubuntu 22.04.

OTRS Dashboard
OTRS Dashboard

You can see the “OTRS Daemon not running error” on the above screen.

To resolve this error, run the following commands on your server:

# sudo -Hiu otrs /opt/otrs/bin/otrs.Daemon.pl start
# sudo cp /opt/otrs/var/cron/otrs_daemon{.dist,}
# sudo -Hiu otrs /opt/otrs/bin/Cron.sh start

Now, refresh the OTRS screen. You should see that the error is now gone.

Conclusion

At this point, you have learned to Install and Configure OTRS (OpenSource Trouble Ticket System) on Ubuntu 22.04.

Hope you enjoy it. You may be interested in these articles on the Orcacore website:

Install Varnish Cache with Nginx on Ubuntu 22.04

Set up PowerDNS on Ubuntu 22.04

Install PHP 7.3 on Ubuntu 22.04

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!