How to Install Zammad 2.0 on CentOS 7

Updated on January 15, 2018
How to Install Zammad 2.0 on CentOS 7 header image

Zammad is an open source helpdesk/ticketing system designed for customer support teams. With Zammad, customer service representatives can easily deal with customer queries and complaints from various channels, including web, form, email, chat, Twitter, Facebook, and so on.

Prerequisites

  • A fresh Vultr CentOS 7 x64 server instance with at least 4GB of memory. Say its IP address is 203.0.113.1, and its hostname is helpdesk.
  • A domain helpdesk.example.com configured to point to the server instance mentioned above. You can learn more details about this in another Vultr tutorial.
  • A sudo user.
  • The server instance has been updated to the latest stable status.
  • In a production environment, it is recommended to setup a swap file in order to optimize performance.

Step 1: Setup the FQDN (fully qualified domain name)

As required by Zammad, you need to properly setup the FQDN on your server instance before you can remotely access the Zammad site.

Use the vi text editor to open the /etc/hosts file.

sudo vi /etc/hosts

Insert the following line before any existing lines.

203.0.113.1 helpdesk.example.com helpdesk

Save and quit.

:wq!

Use the hostname -f command to confirm the result, which will look like this.

helpdesk.example.com

Step 2: Install OpenJDK 1.8 packages

As required by Zammad, you need to install Java on your server instance before you can install and run Zammad.

Install the latest stable release of OpenJDK 1.8.

sudo yum install -y java-1.8.0-openjdk-devel

Having OpenJDK 1.8 installed, you can verify the result.

java -version

The output will look like this.

openjdk version "1.8.0_144"
OpenJDK Runtime Environment (build 1.8.0_144-b01)
OpenJDK 64-Bit Server VM (build 25.144-b01, mixed mode)

Finally, setup the JAVA_HOME environment variable.

echo "JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" | sudo tee -a /etc/profile
source /etc/profile

Step 3: Install Elasticsearch 5 and the mapper-attachments plugin

Zammad uses Elasticsearch to provide its search function. On CentOS 7, you can install the latest stable release of Elasticsearch 5 using the official Elasticsearch YUM repo as below.

First, install the Elasticsearch 5 public signing key.

sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

Then, setup the Elasticsearch YUM repo.

cat <<EOF | sudo tee -a /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-5.x]
name=Elasticsearch repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF

Next, install Elasticsearch using YUM.

sudo yum install -y elasticsearch

Finally, start the Elasticsearch service and make it automatically start on boot time.

sudo systemctl start elasticsearch.service
sudo systemctl enable elasticsearch.service

In addition, in order to allow Elasticsearch to index file attachments, you need to install the Elasticsearch mapper-attachments plugin.

sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install mapper-attachments

When asked to approve additional permissions, type "Y" and then press "Enter" to finish the installation.

Restart the Elasticsearch service to load the new plugin.

sudo systemctl restart elasticsearch

Step 4: Install Zammad 2.0

In order to facilitate the installation process, you can use the official Zammad YUM repo to install Zammad along with various dependencies, including Nginx, PostgreSQL and more, at the same time.

Download the official Zammad YUM repo.

sudo wget -O /etc/yum.repos.d/zammad.repo https://dl.packager.io/srv/zammad/zammad/stable/installer/el/7.repo

Install Zammad and all of the required dependencies.

sudo yum install -y zammad

Having Zammad successfully installed, the Zammad service will automatically get started. You can use the following command to confirm the Zammad service's status.

sudo systemctl status zammad.service

Zammad's status will be active (running).

Next, use the following commands to make Zammad work with Elasticsearch and rebuild the index.

sudo zammad run rails r "Setting.set('es_url', 'http://localhost:9200')"
sudo zammad run rake searchindex:rebuild

Add extra Elasticsearch index name space (optional).

sudo zammad run rails r "Setting.set('es_index', Socket.gethostname + '_zammad')"

Ignore common binary file types (optional).

sudo zammad run rails r "Setting.set('es_attachment_ignore', [ '.png', '.jpg', '.jpeg', '.mpeg', '.mpg', '.mov', '.bin', '.exe', '.box', '.mbox' ] )"

Set the max attachment size (optional).

sudo zammad run rails r "Setting.set('es_attachment_max_size_in_mb', 50)"

In order to allow users to remotely access Zammad, you need to modify the Zammad Nginx configuration file.

sudo vi /etc/nginx/conf.d/zammad.conf

Find this line.

 server_name localhost;

Replace localhost with the FQDN of your server instance.

server_name helpdesk.example.com;

Save and quit.

:wq!

Finally, restart the Nginx service to apply your modifications.

sudo systemctl restart nginx.service

Step 5: Setup SELinux and firewall rules

Use the following commands to determine the status of SELinux on your server instance.

sudo yum install -y policycoreutils
sestatus

If SELinux is enabled in the enforcing mode on your machine, you need to modify an SELinux rule as follows.

sudo yum install -y policycoreutils policycoreutils-python selinux-policy-devel
sudo setsebool httpd_can_network_connect on -P

If SELinux is disabled or enabled in the permissive mode, ignore above modifications and move on.

You need to also modify the firewall rules as follows.

sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --zone=public --permanent --add-service=https
sudo firewall-cmd --reload

Step 6: Setup the new Zammad system from the Web interface

Point your favorite web browser to http://helpdesk.example.com, and you will be brought into the Zammad getting started page.

Click the Setup new system button to move on.

In the Administrator Account window, input the administrator's first name, last name, email, and password (twice), and then click the Create button.

In the Organization window, input the organization name and the system URL http://helpdesk.example.com , upload your logo (if any), and then click the Next button.

In the Email Notification window, choose a proper email sending method, and then click the Continue button.

In the Connect Channels window, click the Skip button to finish the initial setup. All channels can be customized later.

That's all for setting up an operational Zammad ticketing system. Feel free to explore the Zammad interface and invite customer service representatives. Thanks for reading.