How to Install and Configure OTRS on Ubuntu 16.04
By Hitesh Jethva, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.
OTRS is a free and open source Ticket Request System software that can be used for Customer Service, Help Desk, and IT Service Management. It is simple, easy to use, flexible and web-based ticketing system. OTRS is a cross-platform application and supports all the popular operating systems like, Windows, Linux etc. OTRS is written in Perl, supports MySQL, MariaDB, PostgreSQL and can be integrated with LDAP.
In this tutorial, we will install OTRS on Ubuntu 16.04 with an Alibaba Cloud Elastic Compute Service (ECS) instance.
Requirements
- A fresh Alibaba cloud instance with Ubuntu 16.04 server installed.
- A static IP address 192.168.0.103 is configured on the instance.
- A Root password is setup on the server.
Launch Alibaba Cloud ECS Instance
First, log in to your https://ecs.console.aliyun.com">Alibaba Cloud ECS Console. Create a new ECS instance, choosing Ubuntu 16.04 as the operating system with at least 2GB RAM. Connect to your ECS instance and log in as the root user.
Once you are logged into your Ubuntu 16.04 instance, run the following command to update your base system with the latest available packages.
apt-get update -y
Install LAMP Server
Before starting, you will need to install Apache and MariaDB to your system. You can install them with the following command:
apt-get install apache2 libapache2-mod-perl2 mariadb-server -y
Once all the packages are installed, start Apache and MariaDB service and enable them to start on boot time using the following command:
systemctl start apache2
systemctl start mysql
systemctl enable apache2
systemctl enable mysql
Configure MariaDB
By default, MariaDB is not secured. You can secure it by running the following command:
mysql_secure_installation
Answer all the questions as shown below:
Change the password for root ? N
Remove anonymous users? Y
Disallow root login remotely? Y
Remove test database and access to it? Y
Reload privilege tables now? Y
Once the MariaDB is secured, login to MariaDB shell using the following command:
mysql -u root -p
Enter your root password when prompt, then create a database and user for OTRS:
MariaDB [(none)]> CREATE DATABASE otrs_db;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON otrs_db.* TO 'otrs'@'localhost' IDENTIFIED BY 'password';
Next, flush the privileges and exit from the MariaDB shell using the following command:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;
Next, you need to modify default MySQL settings in my.cnf file:
nano /etc/mysql/my.cnf
Add the following lines:
[mysqld]
max_allowed_packet=30M
query_cache_size=36M
innodb_log_file_size=256M
Save and close the file, then restart MariaDB service to apply changes:
systemctl restart mysql
Install OTRS
OTRS is written in Perl, so you will need to install all the required Perl modules to your system. You can install all of them by running the following command:
apt-get install libdbd-odbc-perl libauthen-ntlm-perl libxml-libxml-perl libarchive-zip-perl libcrypt-eksblowfish-perl libcrypt-ssleay-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 -y
Once all the required packages are installed, enable Perl module for Apache with the following command:
a2enmod perl
Next, reload apache service to make the changes:
systemctl restart apache2
Next, download the OTRS from their website using the following command:
wget http://ftp.otrs.org/pub/otrs/otrs-5.0.22.zip
After downloading, extract the downloaded file and with the following command:
unzip otrs-5.0.22.zip
Next, move the extracted directory to /opt using the following command:
mv otrs-5.0.22 /opt/otrs
Next, check any missing modules by running the following command:
/opt/otrs/bin/otrs.CheckModules.pl
You should see the following output:
o Apache::DBI......................ok (v1.12)
o Apache2::Reload..................ok (v0.13)
o Archive::Tar.....................ok (v2.04)
o Archive::Zip.....................ok (v1.56)
o Crypt::Eksblowfish::Bcrypt.......ok (v0.009)
o Crypt::SSLeay....................ok (v0.73_04)
o Date::Format.....................ok (v2.24)
o DBI..............................ok (v1.634)
o DBD::mysql.......................ok (v4.033)
o DBD::ODBC........................ok (v1.52)
o DBD::Pg..........................ok (v3.5.3)
o Digest::SHA......................ok (v5.95)
o Encode::HanExtra.................ok (v0.23)
o IO::Socket::SSL..................ok (v2.024)
o JSON::XS.........................ok (v3.01)
o List::Util::XS...................ok (v1.41)
o Mail::IMAPClient.................ok (v3.38)
o IO::Socket::SSL................ok (v2.024)
o Authen::SASL...................ok (v2.16)
o Authen::NTLM...................ok (v1.09)
o ModPerl::Util....................ok (v2.000009)
o Net::DNS.........................ok (v0.81)
o Net::LDAP........................ok (v0.65)
o Template.........................ok (v2.24)
o Template::Stash::XS..............ok (undef)
o Text::CSV_XS.....................ok (v1.21)
o Time::HiRes......................ok (v1.9726)
o XML::LibXML......................ok (v2.0123)
o XML::LibXSLT.....................ok (v1.94)
o XML::Parser......................ok (v2.44)
o YAML::XS.........................ok (v0.41)
Next, create a user for OTRS and make a member of the www-data group using the following command:
useradd -d /opt/otrs -c 'OTRS user' otrs
usermod -G www-data otrs
Next, copy the sample configuratino file and add database details:
cd /opt/otrs/Kernel
cp Config.pm.dist Config.pm
nano Config.pm
Make the following changes:
# 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 the file, when your are finished.
Next, you will need to enable MySQL support for OTRS. You can do this by editing apache2-perl-startup.pl file:
nano /opt/otrs/scripts/apache2-perl-startup.pl
Make the following changes:
use DBD::mysql ();
use Kernel::System::DB::mysql;
Save and close the file, then set permission to the /opt/otrs directory using the following command:
/opt/otrs/bin/otrs.SetPermissions.pl --web-group=www-data
Configure Apache for OTRS
Next, you will need to create an Apache virtual host file for OTRS. You can do this by running the following command:
ln -s /opt/otrs/scripts/apache2-httpd.include.conf /etc/apache2/sites-available/otrs.conf
Next, enable the virtual host and some apache modules with the following command:
a2ensite otrs
a2enmod headers
a2enmod filter
a2enmod version
a2enmod deflate
Finally, restart Apache service to apply all the changes:
systemctl restart apache2
Access OTRS Web Installation Wizard
OTRS is now installed, it’s time to install OTRS through a Web browser.
Open your web browser and type the URL http://192.168.0.103/otrs/installer.pl
. You will be redirected to the following page:
Click on the Next button, you should see the License agreement page:
Accept the License agreement, you should see the following page:
Here, choose MySQL database and click on the Next button, you should see the following page:
Here, provide your database details, then click on the Next button, you should see the following page:
Now, click on the Next button, you should see the following page:
Provide all the required details, then click on the Next button, you should see the following page:
Click on the Skip this step button. Once the installation is finished, you should see your login credential in the following page:
You can now access the OTRS web interface using the URL http://192.168.0.103/otrs/index.pl.
Reference: