3694 words
18 minutes

Install OTRS on Ubuntu Server

Cover image for Install OTRS on Ubuntu Server

This article is for those looking for a detailed and straightforward guide on installing OTRS on Ubuntu Server.

OTRS Community Edition - is a free open-source service management system that is often used by IT service management, customer service, and corporate security to structure their communications and tasks.

WARNING

The OTRS Community Edition is no longer supported by OTRS AG, the company behind the original software. Its continued development has been taken over by Znuny.

WARNING

You can install an older version of OTRS on Ubuntu Server by following this guide, or install a newer version from Znuny using my guide: Install OTRS Using Docker Compose.

IMPORTANT

OpenSSH must be installed on the server, and port 22 must be open in order to be able to connect to the server using the SSH protocol.

To install OpenSSH on a server, you can use the command:

Terminal window
sudo apt install openssh-server
NOTE

To connect to the server from a Windows system, you can use tools like PuTTY or MobaXterm.

NOTE

This guide walks you through connecting to a server with the iTerm2 terminal emulator on macOS.

CAUTION

You will need to open the following TCP ports for access to the services:

  • TCP port 80 - to receive a free cryptographic certificate through the Let’s Encrypt CA.
  • TCP port 443 - to access the OTRS web interface.

We connect to the server on which you plan to install OTRS.

Update the local package index to the latest changes in the repositories using the command:

Terminal window
sudo apt update

Install OTRS on Ubuntu Server - Step 1

This tutorial walks you through obtaining a free cryptographic certificate through the Let’s Encrypt CA. To obtain and subsequently renew a free SSL certificate, we will use the Certbot software client, which is designed to make it as easy as possible to obtain and renew a certificate through the Let’s Encrypt certification authority.

Now we will install the packages required for OTRS to work using the command:

Terminal window
sudo apt install -y postgresql apache2 zip unzip build-essential bash-completion libapache2-mod-perl2 libdbd-pg-perl libtimedate-perl libnet-dns-perl libnet-ldap-perl libio-socket-ssl-perl libpdf-api2-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 libdigest-md5-perl libcrypt-ssleay-perl libdatetime-perl libauthen-ntlm-perl libpdf-api2-simple-perl libgd-text-perl libgd-graph-perl libyaml-libyaml-perl libmoo-perl apt-transport-https certbot python3-certbot-apache
NOTE

In this tutorial, PostgreSQL will be used as a database management system, and Apache will be used as a webserver.

Install OTRS on Ubuntu Server - Step 2

Now you need to create a database that will be used by OTRS in the future, as well as a user with the necessary rights in this database.

Switch to the “postgres” user who has administrator rights in PostgreSQL using the command:

Terminal window
sudo su - postgres

Install OTRS on Ubuntu Server - Step 3

Next, switch to the PostgreSQL command line using the command:

Terminal window
psql

Install OTRS on Ubuntu Server - Step 4

We create a new user using the command:

Terminal window
CREATE USER otrsdbuser WITH PASSWORD 'dktLkE(UvUWupy3Y7d((9b';

For this tutorial, the username will be “otrsdbuser”, with the password “dktLkE(UvUWupy3Y7d((9b”.

Install OTRS on Ubuntu Server - Step 5

We create a new database and grant the rights to it to the previously created user using the command:

Terminal window
CREATE DATABASE "otrsdb" WITH OWNER "otrsdbuser" ENCODING 'UTF8';
NOTE

This tutorial will use “otrsdb” as the name for the database.

Install OTRS on Ubuntu Server - Step 6

Exit the “PostgreSQL” command line using the command:

Terminal window
\q

Install OTRS on Ubuntu Server - Step 7

Log out as user “postgres” using the command:

Terminal window
exit

Install OTRS on Ubuntu Server - Step 8

Now let’s download the “rel-6_0.zip” archive containing the files for OTRS using the command:

Terminal window
wget https://github.com/OTRS/otrs/archive/refs/heads/rel-6_0.zip

Install OTRS on Ubuntu Server - Step 9

Unpack the downloaded archive “otrs-latest.tar.gz” using the command:

Terminal window
unzip rel-6_0.zip

Install OTRS on Ubuntu Server - Step 10

Now delete the previously downloaded archive “otrs-latest.tar.gz” containing the files for OTRS to work using the command:

Terminal window
sudo rm -f rel-6_0.zip

Install OTRS on Ubuntu Server - Step 11

Move and rename the directory with files for OTRS operation, obtained from the archive, using the command:

Terminal window
sudo mv otrs-* /opt/otrs

Install OTRS on Ubuntu Server - Step 12

Now let’s create a user “otrs” that will be used to start OTRS using the command:

Terminal window
sudo useradd -d /opt/otrs -c 'OTRS user' otrs

Install OTRS on Ubuntu Server - Step 13

Next, add a new user to the “www-data” group using the command:

Terminal window
sudo usermod -G www-data otrs

Install OTRS on Ubuntu Server - Step 14

Let’s prepare the OTRS configuration file using the command:

Terminal window
sudo cp /opt/otrs/Kernel/Config.pm.dist /opt/otrs/Kernel/Config.pm

Install OTRS on Ubuntu Server - Step 15

Now you need to make changes to the OTRS configuration file by opening it in a text editor using the command:

Terminal window
sudo vim /opt/otrs/Kernel/Config.pm

Install OTRS on Ubuntu Server - Step 16

Press the “i” button to enter the edit mode, find the parameter Self>DatabaseDSN="DBI:mysql:database=Self->{'DatabaseDSN'} = "DBI:mysql:database=Self->{Database};host=$Self->{DatabaseHost}”; and comment it out by placing the ”#” symbol in front of the parameter.

Then we find the parameter Self>DatabaseDSN="DBI:Pg:dbname=Self->{DatabaseDSN} = "DBI:Pg:dbname=Self->{Database};”; and uncomment it by removing the ”#” symbol in front of the parameter.

Install OTRS on Ubuntu Server - Step 17

Now press the “Esc” button to exit edit mode, then type "" and press the “Enter” button to save your changes and exit the editor.

Install OTRS on Ubuntu Server - Step 18

Now you need to make changes to the Apache configuration file by opening it in a text editor using the command:

Terminal window
sudo vim /opt/otrs/scripts/apache2-perl-startup.pl

Install OTRS on Ubuntu Server - Step 19

Then we find the parameters “use DBD::Pg ();” and “use Kernel::System::DB::postgresql;”, and then uncomment them by removing the ”#” symbol in front of the parameters.

Install OTRS on Ubuntu Server - Step 20

Now press the “Esc” button to exit edit mode, then type "" and press the “Enter” button to save your changes and exit the editor.

Install OTRS on Ubuntu Server - Step 21

Assign correct rights for the “otrs” user to files and directories using the command:

Terminal window
sudo chown -R otrs:otrs /opt/otrs

Install OTRS on Ubuntu Server - Step 22

Now you need to check that all Perl modules required for OTRS to work are installed and do not need to be updated.

Let’s check the Perl modules required for OTRS to work using the command:

Terminal window
sudo /opt/otrs/bin/otrs.CheckModules.pl

Install OTRS on Ubuntu Server - Step 23

All Perl modules required for OTRS to run are installed and do not need to be updated.

Next, you need to do a few more checks for missing Perl dependencies and modules.

We perform the first check for missing Perl dependencies and modules using the command:

Terminal window
sudo perl -cw /opt/otrs/bin/cgi-bin/index.pl

Install OTRS on Ubuntu Server - Step 24

The first check for missing Perl dependencies and modules was successful.

We perform a second check for missing Perl dependencies and modules using the command:

Terminal window
sudo perl -cw /opt/otrs/bin/cgi-bin/customer.pl

Install OTRS on Ubuntu Server - Step 25

The second check for missing Perl dependencies and modules was successful.

We perform the third check for missing Perl dependencies and modules using the command:

Terminal window
sudo perl -cw /opt/otrs/bin/otrs.Console.pl

Install OTRS on Ubuntu Server - Step 26

The third check for missing Perl dependencies and modules was successful.

Let’s configure Apache for further work with the OTRS control panel.

We enable the Apache webserver module called “headers” using the command:

Terminal window
sudo a2enmod headers
NOTE

The “headers” module can be used to add more specific “Cache-Control” parameters.

Install OTRS on Ubuntu Server - Step 27

We enable the Apache webserver module called “rewrite” using the command:

Terminal window
sudo a2enmod rewrite
NOTE

The “rewrite” module is one of the most commonly used modules in the Apache webserver and provides a flexible and powerful way to manipulate URLs.

NOTE

Install OTRS on Ubuntu Server - Step 28

For OTRS to work correctly, you still need Apache modules such as “perl”, “deflate” and “filter”. These modules should be enabled by default, but you can check this with the commands:

Terminal window
sudo a2enmod perl
Terminal window
sudo a2enmod deflate
Terminal window
sudo a2enmod filter

Now you need to create four virtual host files (called a block in Nginx), with which OTRS will work in the future.

Two virtual host files are required to provide access to OTRS over HTTPS, as well as to redirect agents from the otrs.heyvaldemar.net subdomain to the agent address https://otrs.heyvaldemar.net/otrs/index.pl.

The other two virtual host files will be required to provide access to OTRS over HTTPS and to redirect customers from the support.heyvaldemar.net subdomain to the customer service address https://otrs.heyvaldemar.net/otrs/customer.pl.

NOTE

In this guide, agents will use the otrs.heyvaldemar.net subdomain to access the OTRS web interface from the Internet, and the support.heyvaldemar.net subdomain for client access. You will need to specify your domains or subdomains by which OTRS will be available from the Internet for agents and customers.

Let’s create the first virtual host file using a text editor using the command:

Terminal window
sudo vim /etc/apache2/sites-available/otrs.heyvaldemar.net.conf

Install OTRS on Ubuntu Server - Step 29

Hit the “i” button to go into edit mode, then insert the following configuration for the webserver to work.

NOTE

In this guide, for agents to access the OTRS web interface from the Internet, the otrs.heyvaldemar.net subdomain will be used, from which agents will be redirected to the address https://otrs.heyvaldemar.net/otrs/index.pl. You will need to specify your domain or subdomain by which OTRS will be accessible from the Internet for agents.

Install OTRS on Ubuntu Server - Step 30

Now press the “Esc” button to exit edit mode, then type "" and press the “Enter” button to save your changes and exit the editor.

Install OTRS on Ubuntu Server - Step 31

Let’s create a second virtual host file using a text editor using the command:

Terminal window
sudo vim /etc/apache2/sites-available/otrs.heyvaldemar.net-ssl.conf

Install OTRS on Ubuntu Server - Step 32

Hit the “i” button to go into edit mode, then insert the following configuration for the webserver to work.

NOTE

In this guide, for agents to access the OTRS web interface from the Internet, the otrs.heyvaldemar.net subdomain will be used, from which agents will be redirected to the address https://otrs.heyvaldemar.net/otrs/index.pl. You will need to specify your domain or subdomain by which OTRS will be accessible from the Internet for agents.

Install OTRS on Ubuntu Server - Step 33

Now press the “Esc” button to exit edit mode, then type "" and press the “Enter” button to save your changes and exit the editor.

Install OTRS on Ubuntu Server - Step 34

Let’s create a third virtual host file using a text editor using the command:

Terminal window
sudo vim /etc/apache2/sites-available/support.heyvaldemar.net.conf

Install OTRS on Ubuntu Server - Step 35

Hit the “i” button to go into edit mode, then insert the following configuration for the webserver to work.

NOTE

In this guide, customers will use the support.heyvaldemar.net subdomain to access the OTRS web interface from the Internet, from which customers will be redirected to https://otrs.heyvaldemar.net/otrs/customer.pl. You will need to specify your domain or subdomain by which OTRS will be accessible from the Internet for clients.

Install OTRS on Ubuntu Server - Step 36

Now press the “Esc” button to exit edit mode, then type "" and press the “Enter” button to save your changes and exit the editor.

Install OTRS on Ubuntu Server - Step 37

Let’s create the fourth virtual host file using a text editor using the command:

Terminal window
sudo vim /etc/apache2/sites-available/support.heyvaldemar.net-ssl.conf

Install OTRS on Ubuntu Server - Step 38

Hit the “i” button to go into edit mode, then insert the following configuration for the webserver to work.

NOTE

In this guide, customers will use the support.heyvaldemar.net subdomain to access the OTRS web interface from the Internet, from which customers will be redirected to https://otrs.heyvaldemar.net/otrs/customer.pl. You will need to specify your domain or subdomain by which OTRS will be accessible from the Internet for clients.

Install OTRS on Ubuntu Server - Step 39

Now press the “Esc” button to exit edit mode, then type "" and press the “Enter” button to save your changes and exit the editor.

Install OTRS on Ubuntu Server - Step 40

Now you need to assign the correct permissions to files and directories for the correct operation of OTRS. To do this, you need to use a special script.

Let’s go to the “otrs” folder using the command:

Terminal window
cd /opt/otrs

Install OTRS on Ubuntu Server - Step 41

Assign the correct permissions to files and directories for the correct operation of OTRS using the command:

Terminal window
sudo bin/otrs.SetPermissions.pl --otrs-user=www-data --web-group=www-data

Install OTRS on Ubuntu Server - Step 42

We activate the first virtual host using the command:

Terminal window
sudo a2ensite otrs.heyvaldemar.net.conf

Install OTRS on Ubuntu Server - Step 43

We activate the second virtual host using the command:

Terminal window
sudo a2ensite otrs.heyvaldemar.net-ssl.conf

Install OTRS on Ubuntu Server - Step 44

We activate the third virtual host using the command:

Terminal window
sudo a2ensite support.heyvaldemar.net.conf

Install OTRS on Ubuntu Server - Step 45

We activate the fourth virtual host using the command:

Terminal window
sudo a2ensite support.heyvaldemar.net-ssl.conf

Install OTRS on Ubuntu Server - Step 46

Now you need to activate the virtual host for OTRS to work, which should be loaded after all other settings. To do this, you can use a symbolic link with the “zzz” prefix.

We activate the virtual host for OTRS using the command:

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

Install OTRS on Ubuntu Server - Step 47

Deactivate the default virtual host using the command:

Terminal window
sudo a2dissite 000-default.conf

Install OTRS on Ubuntu Server - Step 48

Verify that there are no errors in the syntax of the new Apache config file using the command:

Terminal window
sudo apache2ctl configtest

Install OTRS on Ubuntu Server - Step 49

Restart Apache to apply the changes made using the command:

Terminal window
sudo systemctl restart apache2

Install OTRS on Ubuntu Server - Step 50

Let’s check that Apache has started successfully using the command:

Terminal window
sudo systemctl status apache2

Install OTRS on Ubuntu Server - Step 51

Now, in order to increase the security level of the webserver, it is necessary to obtain a cryptographic certificate for the domain or subdomain, through which the OTRS web interface will be accessible from the Internet.

NOTE

To obtain and subsequently renew a free SSL certificate, we will use the Let’s Encrypt certification authority, as well as the Certbot software client, which is designed to make it as easy as possible to obtain and renew a certificate through the Let’s Encrypt certification authority.

NOTE

In this guide, agents will use the otrs.heyvaldemar.net subdomain to access the OTRS web interface from the Internet, and the support.heyvaldemar.net subdomain will be used for client access. You will need to specify your domains or subdomains by which OTRS will be available from the Internet for agents and customers.

Request a cryptographic certificate using the command:

Terminal window
sudo certbot --apache -d otrs.heyvaldemar.net -d support.heyvaldemar.net

Install OTRS on Ubuntu Server - Step 52

Next, we indicate the email address to which Let’s Encrypt will send notifications about the expiration of the cryptographic certificate and press the “Enter” button.

Install OTRS on Ubuntu Server - Step 53

The next step is to read and accept the terms of use of the services provided.

Press the button “a”, then “Enter”, if you agree with the terms of use of the services provided.

Install OTRS on Ubuntu Server - Step 54

The next step is to choose whether you would like to share the above email address with the Electronic Frontier Foundation in order to receive newsletters.

Press the “n” button, then “Enter”.

Install OTRS on Ubuntu Server - Step 55

At the next stage, you need to choose: do you want the parameters to be automatically added to the Apache configuration file for automatically redirecting HTTP traffic to HTTPS.

Press the button “1”, then “Enter”.

Install OTRS on Ubuntu Server - Step 56

NOTE

Cryptographic certificates obtained through Let’s Encrypt CA are valid for ninety days. Certbot automatically adds a script to renew the certificate to the task scheduler and the script runs twice a day, automatically renewing any cryptographic certificate that expires within thirty days.

You can check the functionality of the cryptographic certificate renewal process using the command:

Terminal window
sudo certbot renew --dry-run

Install OTRS on Ubuntu Server - Step 57

To continue the OTRS installation process, you need to go from the workstation to the link https://otrs.heyvaldemar.net/otrs/installer.pl, where otrs.heyvaldemar.net is the name of my server. Accordingly, you need to specify the name or IP address of your server with OTRS installed.

Click on the “Next” button.

Install OTRS on Ubuntu Server - Step 58

The next step is to accept the license terms.

Click on the “Accept license and continue” button if you agree with the OTRS license agreement.

Install OTRS on Ubuntu Server - Step 59

Next, you need to specify the system for managing the databases and the previously created database that will be used to work with OTRS.

In the “Type” field, select “PostgreSQL”.

In the “Install Type” section, select “Use an existing database for OTRS”.

Click on the “Next” button.

Install OTRS on Ubuntu Server - Step 60

In the next step, you need to specify the data for connecting to the previously created database.

NOTE

In this manual, “otrsdbuser” is used as the username with database rights for OTRS.

In the “User” field, enter “otrsdbuser”.

In the “Password” field, specify the password assigned to the “otrsdbuser” user.

In the “Host” field, enter “127.0.0.1”.

This tutorial uses “otrsdb” as the database name for OTRS.

In the “Database name” field, specify “otrsdb”.

Click on the “Check database settings” button.

Install OTRS on Ubuntu Server - Step 61

The connection to the database has been successfully established.

Click on the “Next” button.

Install OTRS on Ubuntu Server - Step 62

The database has been successfully prepared to work with OTRS.

Click on the “Next” button.

Install OTRS on Ubuntu Server - Step 63

In the next step, you need to specify a few more parameters for the operation of OTRS.

In the “SystemID” field, select the desired number, which will serve as the identifier of the OTRS system. This identifier will be part of the number for all OTRS tickets.

In the “System FQDN” field, indicate the domain or subdomain by which OTRS is accessible from the Internet.

NOTE

In this manual, to access the OTRS web interface from the Internet, the otrs.heyvaldemar.net subdomain will be used. You will need to specify your domain or subdomain through which OTRS will be available from the Internet.

In the “AdminEmail” field, indicate the current email address of the OTRS administrator.

In the “Organization” field, enter the name of your organization.

In the “LogModule” field, specify “Syslog”.

In the “Default Language” field, specify the language for your OTRS system.

In the “CheckMXRecord” field, specify “Yes” to check the MX records for the email addresses specified in OTRS.

Click on the “Next” button.

Install OTRS on Ubuntu Server - Step 64

In the next step, you can specify the data that OTRS will use to send and receive emails. These settings are covered in the OTRS Configuration Guide and are best skipped for now.

Click on the “Skip this step” button.

Install OTRS on Ubuntu Server - Step 65

In the next step, you will receive the username and password of an account with OTRS administrator rights.

Save this data in a safe place.

Install OTRS on Ubuntu Server - Step 66

Now you need to start the OTRS daemon.

We return to the terminal emulator and start the OTRS daemon using the command:

Terminal window
sudo su - otrs -c "/opt/otrs/bin/otrs.Daemon.pl start"
NOTE

The daemon will run under the “otrs” user.

Install OTRS on Ubuntu Server - Step 67

Now we need to activate two files that will be used by the cron task scheduler to verify that the OTRS daemon is running.

Let’s go to the “cron” folder using the command:

Terminal window
cd /opt/otrs/var/cron

Install OTRS on Ubuntu Server - Step 68

We activate the first file for the cron task scheduler using the command:

Terminal window
sudo cp aaa_base.dist aaa_base

Install OTRS on Ubuntu Server - Step 69

We activate the second file for the cron task scheduler using the command:

Terminal window
sudo cp otrs_daemon.dist otrs_daemon

Install OTRS on Ubuntu Server - Step 70

Now, to schedule tasks in the cron task scheduler, you need to use the “Cron.sh” script using the command:

Terminal window
sudo su - otrs -c "/opt/otrs/bin/Cron.sh start"
NOTE

The scheduled tasks will run under the “otrs” user.

Install OTRS on Ubuntu Server - Step 71

OTRS installation completed successfully.

Now you need to make changes to the OTRS configuration to ensure that all internal links in OTRS will use HTTPS.

From the workstation, go to the link https://otrs.heyvaldemar.net/otrs/index.pl, where otrs.heyvaldemar.net is the name of my server. Accordingly, you need to specify the name of your server with OTRS installed.

Specify the username and password of an account with OTRS administrator rights, and click on the “Login” button.

Install OTRS on Ubuntu Server - Step 72

Welcome to the OTRS agent web interface.

Click on the “Admin” button.

Install OTRS on Ubuntu Server - Step 73

Now in the “Administration” section, select “System Configuration”.

Install OTRS on Ubuntu Server - Step 74

In the search bar, specify “HttpType” and in the presented search result, select “HttpType”

Install OTRS on Ubuntu Server - Step 75

In the “HttpType” section, specify “https”.

Install OTRS on Ubuntu Server - Step 76

Click on the checkmark to the right of the changed parameter to save the changes.

Install OTRS on Ubuntu Server - Step 77

The changes made are saved. Now you need to apply them.

Click on the notification “You have undeployed settings, would you like to deploy it them?”

Install OTRS on Ubuntu Server - Step 78

In the “Changes Overview” section, select the change you want to apply and click on the “Deploy selected changes” button.

Install OTRS on Ubuntu Server - Step 79

Click on the “Deploy now” button to confirm the application of the previously made changes.

Install OTRS on Ubuntu Server - Step 80

Now you need to change the time zone for the OTRS administrator account.

Click on the notification “Please select a time zone in your preferences and confirm it by clicking save button”.

Install OTRS on Ubuntu Server - Step 81

In the “Time Zone” field, select the appropriate time zone.

Install OTRS on Ubuntu Server - Step 82

Click on the checkmark to the right of the changed parameter to save the changes.

Then click on the “Dasboard” button in the upper left corner of the screen to return to the OTRS agent home page.

Install OTRS on Ubuntu Server - Step 83

Install OTRS on Ubuntu Server - Step 84


Social Channels#


Community of IT Experts#


Is this content AI-generated?

No. Every article on this blog is written by me personally, drawing on decades of hands-on IT experience and a genuine passion for technology.

I use AI tools exclusively to help polish grammar and ensure my technical guidance is as clear as possible. However, the core ideas, strategic insights, and step-by-step solutions are entirely my own, born from real-world work.

Because of this human-and-AI partnership, some detection tools might flag this content. You can be confident, though, that the expertise is authentic. My goal is to share road-tested knowledge you can trust.

Install OTRS on Ubuntu Server
https://www.heyvaldemar.com/install-otrs-on-ubuntu-server/
Author
Vladimir Mikhalev
Published at
2021-04-27
License
CC BY-NC-SA 4.0