How to Install and Configure OTRS on CentOS 7

Published on: Fri, Sep 29, 2017 at 4:47 pm EST
CentOS Server Apps System Admin Web Servers

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 CentOS 7.

Prerequisites

  • A newly deployed Vultr CentOS 7 server instance.
  • A non-root user with sudo privileges setup on your server.

Getting Started

Before starting, you will need to install EPEL repo and other required packages to your system. You can install all of them by running the following command:

sudo yum install epel-release wget unzip -y

Once the installation is completed, update your system to the latest version by running the following command:

sudo yum update -y

Next, restart your system to apply all the updates:

sudo shutdown -r now

Install Apache and MariaDB

Next, you will need to install Apache web server and MariaDB to your server. You can install them by running the following command:

sudo yum install httpd 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 httpd
sudo systemctl start mariadb
sudo systemctl enable httpd
sudo systemctl enable mariadb

Configure MariaDB

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/my.cnf

Add the following lines under [mysqld] section:

max_allowed_packet=30M
query_cache_size=36M
innodb_log_file_size=256M

Save the file then restart MariaDB service to apply these changes:

rm -f /var/lib/mysql/ib_logfile*
sudo systemctl restart mariadb

Install and Configure OTRS

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 yum install bash-completion "perl(Archive::Zip)" "perl(Crypt::SSLeay)" "perl(IO::Socket::SSL)" "perl(LWP::UserAgent)" "perl(Net::DNS)" "perl(Net::LDAP)" "perl(Template)" "perl(XML::LibXML)" "perl(XML::LibXSLT)" "perl(XML::Parser)" "perl(YAML::XS)" "perl(YAML::XS)" "perl(Authen::NTLM)" "perl(Mail::IMAPClient)" "perl(JSON::XS)" "perl(Encode::HanExtra)"  "perl(DBD::Pg)" "perl(Crypt::Eksblowfish::Bcrypt)" perl-core procmail -y    

Once all the modules are installed, you will need to download the latest version of the OTRS RPM package for CentOS from their website. To do so, run the following command:

wget http://ftp.otrs.org/pub/otrs/RPMS/rhel/7/otrs-5.0.22-01.noarch.rpm

Next, install the OTRS with the following command:

sudo rpm -ivh otrs-5.0.22-01.noarch.rpm

Once OTRS is installed, you can check the missing modules by running the following script:

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

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, then restart Apache service to apply all the changes:

sudo systemctl restart httpd

Access OTRS Web Interface

Before starting, you will need to allow port 80 through firewall. You can do this by running the following command:

sudo firewall-cmd --permanent --zone=public --add-port=80/tcp
sudo firewall-cmd --reload

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"

Want to contribute ?

You could earn up to $300 by adding new articles