This article is outdated and may not work correctly for current operating systems or software.
OTRS, also known as "Open-source Ticket Request System" is a free and open source web-based ticketing system.
In this tutorial, we will install and configure OTRS on Ubuntu 16.04.
A newly deployed Vultr Ubuntu 16.04 server instance.
A non-root user with sudo privileges setup on your server.
Before starting, you will need to install some required packages to your system. You can install all of them by running the following command:
sudo apt-get install wget unzip -y
Once the installation is completed, update your system to the latest version by running the following command:
sudo apt-get update -y
sudo apt-get upgrade -y
Next, restart your system to apply all the updates:
sudo shutdown -r now
Next, you will need to install Apache web server and MariaDB to your server. You can install them by running the following command:
sudo apt-get install apache2 libapache2-mod-perl2 mariadb-server -y
Once the installation is complete, start Apache and MariaDB server and enable them to start on boot time with the following command:
sudo systemctl start apache2
sudo systemctl start mysql
sudo systemctl enable apache2
sudo systemctl enable mysql
After installing MariaDB, you will need to create a database for OTRS.
First, log in to MySQL shell with the following command:
mysql -u root -p
Next, create a database for OTRS with the following command:
MariaDB [(none)]> CREATE DATABASE otrs_db;
Next, create a user for OTRS and grant all privileges to OTRS database with the following command:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON otrs_db.* TO 'otrs'@'localhost' IDENTIFIED BY 'password';
Next, Flush the privileges with the following command:
MariaDB [(none)]> FLUSH PRIVILEGES;
Exit from the MySQL shell:
MariaDB [(none)]> \q
Once the MariaDB is configured, you will need to change the default MySQL settings in my.cnf
file. You can do this by editing my.cnf
file as follows;
sudo nano /etc/mysql/my.cnf
Add the following lines under:
[mysqld]
max_allowed_packet=30M
query_cache_size=36M
innodb_log_file_size=256M
Save the file then restart MariaDB service to apply these changes:
sudo systemctl restart mysql
OTRS is written in Perl and uses number of Perl modules. So you will need to install all the required Perl module to your system.
You can install all of them by running the following command:
sudo apt-get install libdbd-odbc-perl libauthen-ntlm-perl libxml-libxml-perl libxml-libxslt-perl libpdf-api2-simple-perl libyaml-libyaml-perl libencode-hanextra-perl libjson-xs-perl libmail-imapclient-perl libtemplate-perl libtemplate-perl libtext-csv-xs-perl libapache2-mod-perl2 libdbd-pg-perl libnet-dns-perl libnet-ldap-perl libio-socket-ssl-perl libpdf-api2-perl libsoap-lite-perl libgd-text-perl libgd-graph-perl libapache-dbi-perl libarchive-zip-perl libcrypt-eksblowfish-perl libcrypt-ssleay-perl -y
Once all the modules are installed, then activate the Perl module for apache, then restart the apache service with the following command:
sudo a2enmod perl
sudo systemctl restart apache2
Next, you will need to download the latest version of the OTRS from their website. To do so, run the following command:
wget http://ftp.otrs.org/pub/otrs/otrs-5.0.22.zip
Once the download is complete, extract the downloaded file with the following command:
unzip otrs-5.0.22.zip
Next, move the extracted directory to the /opt/:
sudo mv otrs-5.0.22- /opt/otrs
Finally, you can check the missing modules by running the following script:
sudo /opt/otrs/bin/otrs.CheckModules.pl
Next, create a OTRS user with the following command:
sudo useradd -d /opt/otrs -c 'OTRS user' otrs
sudo usermod -G www-data otrs
Next, you will need to copy OTRS default configuration file and make some changes inside it. You can do this by running the following command:
cd /opt/otrs/Kernel
sudo cp Config.pm.dist Config.pm
sudo nano Config.pm
Change the following lines:
# The database name
$Self->{Database} = 'otrs_db';
# The database user
$Self->{DatabaseUser} = 'otrs';
# The password of database user. You also can use bin/otrs.Console.pl Maint::Database::PasswordCrypt
# for crypted passwords
$Self->{DatabasePw} = 'password';
Save and close the file when you are finished.
Next, enable MySQL support by editing apache2-perl-startup.pl
file:
sudo nano /opt/otrs/scripts/apache2-perl-startup.pl
Change the file as shown below:
# enable this if you use mysql
use DBD::mysql ();
use Kernel::System::DB::mysql;
Save and close the file, when you are finished.
Next, you will need to give proper permissions to the /opt/otrs
directory. You can do this by running the following command:
sudo /opt/otrs/bin/otrs.SetPermissions.pl --web-group=www-data
Once everything is configured, you will need to create a symlink for OTRS to the Apache web configuration directory. You can do this by running the following command:
sudo ln -s /opt/otrs/scripts/apache2-httpd.include.conf /etc/apache2/sites-available/otrs.conf
Next, enable the OTRS virtual host with the following command:
sudo a2ensite otrs
Next, you will also need to enable some Apache modules required by the OTRS. You can enable all of them by running the following command:
sudo a2enmod headers
sudo a2enmod version
sudo a2enmod deflate
sudo a2enmod filter
Finally, restart the Apache web server to apply all the changes:
sudo systemctl restart apache2
Before starting, you will need to allow port 80
through firewall. You can do this by running the following command:
sudo ufw enable
sudo ufw allow 80
Once the firewall is configured, open your web browser and type the URL http://your-server-ip/otrs/installer.pl
and complete the required steps to finish the installation.
Once the installation is complete, start the OTRS daemon and activate its cronjob with the following command:
sudo su - otrs -c "/opt/otrs/bin/otrs.Daemon.pl start"
sudo su - otrs -c "/opt/otrs/bin/Cron.sh start"