How to install OTRS 4 on CentOS 7

Centos_full.svgIn this post I’m going to walk you through installing OTRS 4 on CentOS 7. The procedure will be very similar for Red Hat Enterprise Linux (RHEL) version 7 as this is binary compatible.

Please note that there are some differences between CentOS 6 and CentOS 7: it now ships with systemd and with firewalld so the instructions to install OTRS are pretty different.

Setting up your production server or migrating from one is something you don’t want to do every day. This means you better take a distribution that will receive security upgrades for a long time. This is why I would recommend CentOS version 7 over version 6 at this point in time.

Preparation: deactivation of SELinux

OTRS does not ship with a profile for SELinux. This means that you’ll have problems if you don’t turn it off. If you’re an advanced system administrator, you’d be able to create a profile for OTRS. This is beyond the scope of this post.

You can check the status of SELinux with the sestatus command:

[root@localhost ~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          permissive
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

Edit the file /etc/selinux/config and set SELINUX=permissive.  This will make sure after a reboot selinux will not be enabled.

Type setenforce Permissive to set the current SELinux status to ‘permissive’. I chose Permissive here, rather than disabled, because otherwise you might loose the security context on files and would you want to enable SELinux on some later point you’d need to re-label files which is difficult.

[root@localhost ~]# setenforce Permissive
[root@localhost ~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          permissive
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

Preparation: installation of a database

Of course you can use OTRS with a database that is on some central location in your setup. You can use OTRS with PostgreSQL or MySQL, or even with Oracle if you need to. In this example, I’m going to assume that you’ll use a database installed on the OTRS machine itself, which is the most common setup and recommended for all except very big installations.

The most widely used database for OTRS is MySQL. In CentOS 7, MySQL Server is no longer available; the fork MariaDB is available and you can use that as a drop-in replacement.

If you want to install MySQL instead of MariaDB, this is no problem; the MySQL project has provided a yum repository that you can use.

Otherwise, if you’d want to install MariaDB, just use these commands:

yum install -y mariadb-server
echo -e "[server]\nmax_allowed_packet=20M\nquery_cache_size=32M" > /etc/my.cnf.d/otrs.cnf
systemctl enable mariadb.service
systemctl start mariadb.service

The echo command is used to create a small configuration file called /etc/my.cnf.d/otrs.cnf which contains specific settings in order to make OTRS happy. The contents of this file is:

[server]
max_allowed_packet=20M
query_cache_size=32M

Get and install OTRS

Now you can get and install the OTRS software itself. You can find RPM installation files on the web server of OTRS. For the current version the install command is:

yum -y install http://ftp.otrs.org/pub/otrs/RPMS/rhel/7/otrs-4.0.2-01.noarch.rpm

Please note this will install loads of dependencies so it might take a brief while.

Install additional dependencies

Now you can install additional dependencies from EPEL, the enterprise quality package repository maintained by the Fedora project. Note that this step is kind of important as it also will bring you mod_perl which is really needed to have proper performance of the web server!

yum -y install epel-release
yum install -y mod_perl "perl(Crypt::Eksblowfish::Bcrypt)" "perl(JSON::XS)" "perl(GD::Text)" "perl(Encode::HanExtra)" "perl(GD::Graph)" "perl(Mail::IMAPClient)" "perl(PDF::API2)" "perl(Text::CSV_XS)" "perl(YAML::XS)"

Configure firewall and start Apache

Now you can start the Apache web server.  You should also add a rule to the firewall to allow access to the web server. CentOS 7 ships with firewalld, a new generation firewall that allows you to make these changes pretty easily.

You might want to remove the ‘welcome page’ of CentOS as it is kind of annoying.

rm /etc/httpd/conf.d/welcome.conf
systemctl enable httpd.service
systemctl start httpd.service
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload

At this point you can continue using the Web Installer as explained in the OTRS documentation. As database you should choose ‘MySQL’ , also if you’re using MariaDB, because they really are forks and in this regard compatible. The database administrative password is empty. Note that this is not a security risk per se as the database only listens on localhost, so you can only access it from the local machine.

Of course there are many more tasks you should perform before considering your OTRS installation ready, but this is a nice quick start into setting up OTRS on a very popular, long-supported server OS.

OTRS Survey Export

A while ago I noticed someone in the OTRS community wrote a very simple but nice and useful plugin that allows you to export survey results to CSV files. I fixed some small issues with it with a pull request, about nine months ago.

SurveyExportLast week someone contacted me because he upgraded his OTRS system to version 3.3 and the package would no longer work. I ported the module to the 3.3 framework now, and it’s available for download from here: https://download.huntingbears.nl/SurveyExport-0.1.1.opm

Of course I also contributed my changed back to the original author.

Making it work on OTRS 3.3 was relatively easy. The original version had a rather nasty hack to display the extra link in the Survey Zoom screen, where basically the whole template file and frontend module were duplicated in order to add the extra option. In the last version of the Survey module, the screen now has a regular MenuModule registration, as in other parts of OTRS, so now the menu option could be added by simply adding some XML to the configuration file. I love it when porting a feature to a new framework version exists mostly of deleting stuff!

Update: Upon request I now have a version for the OTRS 5 framework available here: https://download.huntingbears.nl/SurveyExport-0.3.1.opm

What Operating System should I choose for deploying OTRS?

Many times I heard the question what OS would be best to install or setup OTRS on. In this post I’ll give an answer.

Choose what fits you best

Typically, the answer is simple: it should be the operating system you (or your organization) is most comfortable with. If your organization is full of debian-lovers, please do install OTRS on Debian. If your organization is all about Microsoft Windows, by all means, go and use Windows.  Short historical note: the Windows Installer for OTRS used to be kind of cumbersome and it was really not easy to upgrade OTRS on Windows, but this is no longer the case since the 3.0 installer was introduced in summer 2013. Continue reading What Operating System should I choose for deploying OTRS?

No mod_perl in RHEL 7 and CentOS 7

I was reading up on the documentation for the newly released RHEL 7 beta the other night. The section Removed Packages showed that RHEL 7 no longer includes mod_perl as it is ‘Incompatible with HTTP 2.4‘ and mod_fcgid is recommended as its replacement.

200px-RedHat.svgWith ‘HTTP 2.4‘ the Red Hat folks actually mean the Apache Webserver 2.4, which package is called ‘httpd’ in the RHEL repositories.

While it is true that there still is no ‘official’ mod_perl release that has support for Apache httpd 2.4, there is a mod_perl branch with support for 2.4 and this has been used by the Fedora project in Fedora 19 and later. Since RHEL 7 would be based on Fedora 19 I find it kind if weird to read there will be no mod_perl in RHEL 7: there has not been a single release of Fedora without mod_perl!

Furthermore, mod_fcgid is by no means a drop-in replacement for mod_perl; mod_perl allows very deep integration with the Apache web server. If you’d just use mod_perl as a way to make your CGI scripts run faster, then you can use it as an alternative though.

Most ‘modern’  perl applications have moved off from mod_perl to plack, which is a more standardized way to integrate your application with your web server, which has lots of deployment options. So if you have moved your application to plack in the last years, you’d be good.

OTRS is typically deployed on mod_perl; and last summer (when I still worked at OTRS Group) we created a wrapper around our frontends which allows you to deploy on Plack. This is still marked as ‘experimental’, and it’s not documented, but it does work. I’ve been running in Plack mode on my ‘personal’ OTRS system since August last year. I’ll want to post a how-to on deployment soon.

I find it a bit disheartening to see that there has been no real activity on mod_perl and there is still no ‘official’  support for mod_perl on Apache 2.4; but also I can’t really understand why there is no mod_perl in RHEL7 as it is readily available in Fedora. Of course, I do consider mod_perl as ‘old’ technology, Plack is really the more modern choice. That said, it’s not always trivial to port your application to Plack. But if you haven’t done so already, you really should start now!

UPDATE: luckily, you can now install mod_perl on CentOS or RHEL 7 via EPEL.

EPEL is the high-quality RPM collection for RHEL and CentOS linux, maintened by the Fedora project. You can install mod_perl like this:

yum install -y epel-release
yum install -y mod_perl

Vagrant base image for CentOS 6.5

Vagrant is a very nice system for automating and standardizing your development environments. The standard documentation is geared towards Ubuntu but at $work we standardize on CentOS and RHEL 6.

I created a base image for Vagrant based on CentOS 6.5 Minimal Install.Vagrant

Features:

  • Default vagrant ‘insecure’ key
  • root password is ‘vagrant
  • Added EPEL repository
  • Installed Virtualbox Guest Additions and dkms
  • Disabled iptables
  • Set selinux to ‘permissive’

How to start this image locally using Vagrant:

 $ vagrant box add centos6 http://vagrant.huntingbears.nl/vagrant-centos-6.5-x86_64.box
 $ vagrant init centos6
 $ vagrant up

Enjoy!