How to Install OTRS Ticketing Systems on Ubuntu Linux

text editor 1794110 640
text editor 1794110 640

This brief tutorial shows students and new users how to install and configure OTRS Ticketing Systems on Ubuntu 18.04 | 16.04.

For the uninitiated, OTRS is modern, flexible ticket and support software that can serve as a strong alternative to the popular support platforms in use today.

If you are currently running a ticketing platform and feel lackiit’sn some areas, you might want to try OTRS. It comes with intuitive mechanisms that allow one to easily migrate from popular solutions to OTRS.

OTRS organizes internal and external communication through clear structures and optimized processes allowing IT teams to avoid errors and complete tasks quickly and efficiently.

For more about OTRS, please check its homepage.

To get started with installing OTRS systems on Ubuntu, follow the steps below:

Install Apache2

Apache2 HTTP Server is the most popular web server in use today. Since OTRS works with a web server, go and install Apache2.

To install the Apache2 HTTP server, run the commands below.

sudo apt update
sudo apt install apache2

After installing Apache2, the commands below can be used to stop, start and enable the Apache2 service to always start up with the server boots.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

To find out if the Apache2 HTTP server is installed, simply open your web browser and type in the server’s Iserver’stname.

http://localhost

Apache2 Test Page

When you see a page similar to the one above, Apache2 is installed and working.

Install Perl and Related Modules

OTRS uses Perl as one of its main components. To get Perl and related modules installed, run the commands below:

sudo apt install libapache2-mod-perl2 libdatetime-perl libcrypt-eksblowfish-perl libcrypt-ssleay-perl libgd-graph-perl libapache-dbi-perl libsoap-lite-perl libarchive-zip-perl libgd-text-perl libnet-dns-perl libpdf-api2-perl libauthen-ntlm-perl libdbd-odbc-perl libjson-xs-perl libyaml-libyaml-perl libxml-libxml-perl libencode-hanextra-perl libxml-libxslt-perl libpdf-api2-simple-perl libmail-imapclient-perl libtemplate-perl libtext-csv-xs-perl libdbd-pg-perl libapache2-mod-perl2 libtemplate-perl libnet-dns-perl libnet-ldap-perl libio-socket-ssl-perl

That should get Perl installed and ready to use.

Install MariaDB Database Server

OTRS also needs a database server to store its content. and MariaDB database server is a great place to start when looking at open-source database servers to use with OTRS.

To install MariaDB run the commands below:

sudo apt update
sudo apt install mariadb-server mariadb-client

After installing MariaDB, the commands below can stop, start and enable the MariaDB service to start up when the server boots.

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

When you’re donyou’re the commands below to secure the MariaDB server by creating a root password and disallowing remote root access.

sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.

  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat 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

Restart MariaDB server

To test if MariaDB is installed and working, run the commands below:

sudo systemctl status mariadb

That should display MariaDB’s MariaDB’status.

● mariadb.service - MariaDB 10.1.44 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-04-08 17:08:17 CDT; 1min 54s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 22363 (mysqld)
Status: "Taking your SQL requests now…"
Tasks: 27 (limit: 4666)
CGroup: /system.slice/mariadb.service
└─22363 /usr/sbin/mysqld
Apr 08 17:08:17 ubuntu1804 /etc/mysql/debian-start[22396]: mysql

After installing the server, run the commands below to open its configuration file.

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

Then add the highlighted lines to the file and save.

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

max_allowed_packet=64M
query_cache_size=36M
innodb_log_file_size=256M
character_set_server=utf8
.

Save the file and exit, then restart MariaDB:

sudo systemctl restart mariadb.service

Create OTRS Database

Now that you’ve insyou’ve all required packages, continue below to start configuring the servers. First, create a blank database for OTRS to use.

To do that, run the commands below to log on to MariaDB. When prompted for a password, type the root password you created above.

sudo mysql -u root -p

Then create a database called otrs

CREATE DATABASE otrs CHARACTER SET utf8 COLLATE utf8_general_ci;

Create a database user called otrsuser with a new password

CREATE USER 'otrsuser'@'localhost' IDENTIFIED BY 'new_password_here';

Next, grant the user full access to the otrsuser database.

GRANT ALL ON otrs.* TO 'otrsuser'@'localhost' WITH GRANT OPTION;

Finally, save your changes and exit.

FLUSH PRIVILEGES;
EXIT;

Now that the MariaDB server is installed and a database created, now go and install OTRS.

Create OTRS User

It is recommended to run OTRS services, not as root. So run the commands below to create a user called others and add the account to the Apache2 group.

sudo useradd -d /opt/otrs -c 'OTRS user' otrs
sudo usermod -aG www-data otrs

When you’re donyou’retinue below to download OTRS

Download and Configure OTRS

Now that your system is prepared and the user for OTRS is created, run the commands below to download the latest OTRS package.

Then move the download files to the OTRS home directory.

cd /tmp
wget http://ftp.otrs.org/pub/otrs/otrs-latest.tar.gz
tar xvf otrs-latest.tar.gz
mv otrs-6.0.27/ otrs
sudo mv otrs /opt
sudo /opt/otrs/bin/otrs.CheckModules.pl

When you’re donyou, the commands below create an OTRS configuration file.

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

The second command should open the configuration file where you’ll addyou’llatabase name, username, and password created above.

sub Load {
    my $Self = shift;

    # ---------------------------------------------------- #
    # database settings                                    #
    # ---------------------------------------------------- #

    # The database host
    $Self->{DatabaseHost} = '127.0.0.1';

    # The database name
    $Self->{Database} = 'otrs';

    # The database user
    $Self->{DatabaseUser} = 'otrsuser';

    # The password of database user. You also can use bin/otrs.Console.pl Maint::Database::PasswordCrypt
    # for crypted passwords
    $Self->{DatabasePw} = 'type_database_user_password';

    # The database DSN for MySQL ==> more: "perldoc DBD::mysql"
    $Self->{DatabaseDSN} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost};";

    # The database DSN for PostgreSQL ==> more: "perldoc DBD::Pg"
    # if you want to use a local socket connection
#    $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};";
    # if you want to use a TCP/IP connection

Next, run the commands below to open the Apache Perl configuration and enable it.

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

Edit the file and update the highlighted line, then save.

# Preload frequently used modules to speed up client spawning.
use CGI ();
CGI->compile(':cgi');
use CGI::Carp ();

use Apache::DBI ();

# enable this if you use mysql
use DBD::mysql ();
use Kernel::System::DB::mysql;

# enable this if you use postgresql
#use DBD::Pg ();
#use Kernel::System::DB::postgresql;

When you’re donyou’re the commands below to configure Apache2 permissions for the directory and create a VirtualHost file.

sudo /opt/otrs/bin/otrs.SetPermissions.pl --web-group=www-data
sudo ln -s /opt/otrs/scripts/apache2-httpd.include.conf /etc/apache2/sites-enabled/otrs.conf

When you’re donyou’re the above, run the commands below to install other Perl packages, and validate that all packages are installed.

perl -MCPAN -e shell

install Crypt::Random::Source::Weak::devurandom
install Exporter::Tiny
install Math::Random::ISAAC
install Math::Random::Secure
install Module::Find
install Moo
install Type::Tiny
install namespace::clean

Then exit from the terminal and validate that all packages are installed.

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

After that, restart Apache2 and Perl by running the commands below:

sudo systemctl restart apache2
sudo a2enmod perl

Finally, open your web browser and browse to the server’s hserver’sor IP address.

http://localhost/otrs/installer.pl 

That should open the installation wizard. Follow the setup wizard until you’re done.

OTRS Ubuntu install

On the screen below, choose MySQL and select the option to use an existing database for OTRS.

OTRS Ubuntu install

Then type in the database information you created above and continue.

OTRS Ubuntu install

After that, enter information for your environment and continue

OTRS setup on Ubuntu

When you’re donyou’replete the setup and log in with the credential provided.

OTRS setup on Ubuntu

Enjoy!

OTRS setup on Ubuntu

OTRS daemon can be started and activated using the commands below:

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

That’s it! That’san begins configuring your environment.

Conclusion:

This post showed you how to install and configure OTRS ticket systems on Ubuntu 18.04 | 16.04. If you find any error above, please use the comment form below to report.

Thanks,

You may also like the post below:

Posted by
Richard W

I love computers; maybe way too much. What I learned I try to share at geekrewind.com.

8 Comments

  1. Thank you very much for these posts. Will you write as you usually do about how to config nginx to work with OTRS?
    It would be very helpful also if you write how to update software once it has been installed. I followed your instructions to install snipe-it but I had to find my way to keep it updated by trial and error.

  2. Thanks for this wonderful guide. I have followed till the end but on configuring MySQL when i enter the password i get an error that access denied

  3. thanks,

    just to help some new users,

    in mariadb config you have to comment the max_allowed_packet size if you have one, or add all the lines ad the bottom.

    second,
    before going in “perl -MCPAN -e shell”
    you have to check if make is installed on the system, otherwise you’ll get a lot of errors 😉

  4. Host ‘10.0.0.108’ is not allowed to connect to this MariaDB server

  5. Hi,
    Thanks for your documentation, I have followed your tutorial.
    But now i want to enable https but i cannot. Would you please help me & share the details procedure.

  6. When inputting – wget http://ftp.otrs.org/pub/otrs/otrs-latest.tar.gz – the following error is being displayed.
    Resolving http://ftp.otrs.org (ftp.otrs.org)… failed: Name or service not known.
    wget: unable to resolve host address ‘ftp.otrs.org’
    Can you please help?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: