This article is for those looking for a detailed and clear guide on how to install 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.

Please note that OTRS AG, the company behind OTRS, no longer supports the OTRS Community Edition. The initiative for the further development of OTRS Community Edition was intercepted by Znuny.

You can install an older version of OTRS on Ubuntu Server by following this guide, or you can install a newer version of OTRS from Znuny by reading my Installing OTRS guide “Install OTRS with Docker Compose”.

In this guide, we will consider the case when you already have a server with the Ubuntu Server 20.04 LTS operating system installed on it.

You can read more about how to install Ubuntu Server 20.04 LTS in my guide “Install Ubuntu Server 20.04 LTS”.

In addition, 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:

sudo apt install openssh-server

If you plan to connect to the server using the Windows operating system, you can use PuTTY, a free client for various remote access protocols, including SSH, Telnet, rlogin.

This guide describes how to connect to a server using the iTerm2 terminal emulator installed on the macOS operating system.

Please note that you will need to open the following TCP ports to access your server:

  • 80 - To receive a free cryptographic certificate through the Let’s Encrypt CA.
  • 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:

sudo apt update

Install OTRS on Ubuntu Server

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:

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

Please note that 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

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:

sudo su - postgres

Install OTRS on Ubuntu Server

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

psql

Install OTRS on Ubuntu Server

We create a new user using the command:

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

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

CREATE DATABASE "otrsdb" WITH OWNER "otrsdbuser" ENCODING 'UTF8';

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

Install OTRS on Ubuntu Server

Exit the “PostgreSQL” command line using the command:

\q

Install OTRS on Ubuntu Server

Log out as user “postgres” using the command:

exit

Install OTRS on Ubuntu Server

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

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

Install OTRS on Ubuntu Server

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

unzip rel-6_0.zip

Install OTRS on Ubuntu Server

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

sudo rm -f rel-6_0.zip

Install OTRS on Ubuntu Server

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

sudo mv otrs-* /opt/otrs

Install OTRS on Ubuntu Server

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

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

Install OTRS on Ubuntu Server

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

sudo usermod -G www-data otrs

Install OTRS on Ubuntu Server

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

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

Install OTRS on Ubuntu Server

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

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

Install OTRS on Ubuntu Server

Press the “i” button to enter the edit mode, find the parameter $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->{Database};”; and uncomment it by removing the “#” symbol in front of the parameter.

Install OTRS on Ubuntu Server

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

Install OTRS on Ubuntu Server

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

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

Install OTRS on Ubuntu Server

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

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

Install OTRS on Ubuntu Server

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

sudo chown -R otrs:otrs /opt/otrs

Install OTRS on Ubuntu Server

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:

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

Install OTRS on Ubuntu Server

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:

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

Install OTRS on Ubuntu Server

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:

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

Install OTRS on Ubuntu Server

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:

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

Install OTRS on Ubuntu Server

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:

sudo a2enmod headers

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

Install OTRS on Ubuntu Server

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

sudo a2enmod rewrite

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

Install OTRS on Ubuntu Server

Note that 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:

sudo a2enmod perl
sudo a2enmod deflate
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.

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:

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

Install OTRS on Ubuntu Server

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

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

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

Install OTRS on Ubuntu Server

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

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

Install OTRS on Ubuntu Server

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

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

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

Install OTRS on Ubuntu Server

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

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

Install OTRS on Ubuntu Server

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

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

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

Install OTRS on Ubuntu Server

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

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

Install OTRS on Ubuntu Server

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

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

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

Install OTRS on Ubuntu Server

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:

cd /opt/otrs

Install OTRS on Ubuntu Server

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

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

Install OTRS on Ubuntu Server

We activate the first virtual host using the command:

sudo a2ensite otrs.heyvaldemar.net.conf

Install OTRS on Ubuntu Server

We activate the second virtual host using the command:

sudo a2ensite otrs.heyvaldemar.net-ssl.conf

Install OTRS on Ubuntu Server

We activate the third virtual host using the command:

sudo a2ensite support.heyvaldemar.net.conf

Install OTRS on Ubuntu Server

We activate the fourth virtual host using the command:

sudo a2ensite support.heyvaldemar.net-ssl.conf

Install OTRS on Ubuntu Server

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:

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

Install OTRS on Ubuntu Server

Deactivate the default virtual host using the command:

sudo a2dissite 000-default.conf

Install OTRS on Ubuntu Server

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

sudo apache2ctl configtest

Install OTRS on Ubuntu Server

Restart Apache to apply the changes made using the command:

sudo systemctl restart apache2

Install OTRS on Ubuntu Server

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

sudo systemctl status apache2

Install OTRS on Ubuntu Server

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.

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.

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:

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

Install OTRS on Ubuntu Server

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

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

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

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

Please note that 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:

sudo certbot renew --dry-run

Install OTRS on Ubuntu Server

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

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

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

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

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

The connection to the database has been successfully established.

Click on the “Next” button.

Install OTRS on Ubuntu Server

The database has been successfully prepared to work with OTRS.

Click on the “Next” button.

Install OTRS on Ubuntu Server

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.

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

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.

You can read more about how to set up OTRS in my guide “Configure OTRS”.

Click on the “Skip this step” button.

Install OTRS on Ubuntu Server

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

Now you need to start the OTRS daemon.

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

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

Please note that the daemon will run under the “otrs” user.

Install OTRS on Ubuntu Server

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:

cd /opt/otrs/var/cron

Install OTRS on Ubuntu Server

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

sudo cp aaa_base.dist aaa_base

Install OTRS on Ubuntu Server

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

sudo cp otrs_daemon.dist otrs_daemon

Install OTRS on Ubuntu Server

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

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

Please note that the scheduled tasks will run under the “otrs” user.

Install OTRS on Ubuntu Server

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 or IP address 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

Welcome to the OTRS agent web interface.

Click on the “Admin” button.

Install OTRS on Ubuntu Server

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

Install OTRS on Ubuntu Server

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

Install OTRS on Ubuntu Server

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

Install OTRS on Ubuntu Server

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

Install OTRS on Ubuntu Server

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

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

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

Install OTRS on Ubuntu Server

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

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

Install OTRS on Ubuntu Server

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

Then click on the house image in the upper left corner of the screen to return to the OTRS agent home page.

Install OTRS on Ubuntu Server

For details on how to configure OTRS, you can read in my guide “Configure OTRS”.

Install OTRS on Ubuntu Server

Vladimir Mikhalev
hey, I’m Vladimir Mikhalev, but my friends call me Valdemar. I have a lot of experience in the design and maintenance of various information systems.

Recent Posts