Install Zammad with Elasticsearch on Ubuntu 24.04

Zammad is an open-source help desk platform that makes managing customer support easy. It brings together emails, chats, and social media in one place, helping teams respond quickly and stay organized. You can customize it, track tickets, and automate tasks to improve your support workflow. In this article, I will show you how to install Zammad with Elasticsearch on Ubuntu 24.04 LTS.

The hardware requirements will depend on your needs and the number of agent users. To start, create a server with at least 12GB of RAM, 6 CPU cores, and 100GB of disk space.

Install Elasticsearch

Before we begin exploring and installing Zammad, it is recommended to install Elasticsearch first.

SSH into your server and run the following commands.

apt update && apt install apt-transport-https

echo "deb [signed-by=/etc/apt/trusted.gpg.d/elasticsearch.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main"| \
  tee -a /etc/apt/sources.list.d/elastic-7.x.list > /dev/null

curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | \
  gpg --dearmor | tee /etc/apt/trusted.gpg.d/elasticsearch.gpg> /dev/null

apt update
apt install elasticsearch

/usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment

Start the Elasticsearch instance and enable it to start at boot time.

systemctl start elasticsearch
systemctl enable elasticsearch

Zammad requires a few additional options to be added to the Elasticsearch configuration.

vim /etc/elasticsearch/elasticsearch.yml

Add the following into it:

http.max_content_length: 400mb
indices.query.bool.max_clause_count: 2000

Restart it with systemctl restart elasticsearch.

We have completed the Elasticsearch setup. After installing Zammad, we will integrate it with Elasticsearch later.

Install Zammad

There are different ways to install Zammad. We will focus on installing it from the Zammad repository using the package method.

Check if your server has the correct locale set by running locale | grep "LANG=". It should return something like en_US.UTF-8 or similar. If the output is empty, set it using the following commands.

apt install locales
locale-gen en_US.UTF-8
echo "LANG=en_US.UTF-8" > /etc/default/locale

We will now add the Zammad repository.

curl -fsSL https://dl.packager.io/srv/zammad/zammad/key | \
   gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/pkgr-zammad.gpg> /dev/null

echo "deb [signed-by=/etc/apt/trusted.gpg.d/pkgr-zammad.gpg] https://dl.packager.io/srv/deb/zammad/zammad/stable/ubuntu 24.04 main"| \
   sudo tee /etc/apt/sources.list.d/zammad.list > /dev/null

Once done, it’s time to update the packages and install Zammad.

apt update
apt install zammad

Set up the firewall and allow the necessary ports. Port 22 is for SSH.

ufw allow 80
ufw allow 443
ufw allow 22
ufw enable

Start and enable the following services:

systemctl start zammad
systemctl enable zammad

systemctl start zammad-web
systemctl enable zammad-web

systemctl start zammad-worker
systemctl enable zammad-worker

systemctl start zammad-websocket
systemctl enable zammad-websocket

Connect Elasticsearch

At this point, Zammad is installed and running. We can now connect Elasticsearch to it and perform the initial indexing.

Remember, this is for Elasticsearch 7, not 8.

Run the following commands:

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

zammad run rake zammad:searchindex:rebuild

Web server setup

Zammad, by default, installs and configures Nginx for us. What we need to do is configure it with our domain name and install the necessary packages to obtain an SSL certificate.

Go to /etc/nginx/sites-available/ and edit the zammad.conf file. Look for the line that says server_name localhost; and change localhost to your actual domain name.

To obtain a certificate and automate the entire process, we need to install the python3-certbot-nginx package.

apt install python3-certbot-nginx

Once completed, run the following command to obtain an SSL certificate. Be sure to replace your domain name in the command. This will also update the zammad.conf file and automatically redirect to HTTPS.

certbot --nginx -d DOMAIN.COM

With that, your Zammad instance is now ready to use. Browse to the domain name in your browser and go through the initial setup screens, which will prompt you to set up a username, password, SMTP settings, and more.

You can always refer to the Zammad documentation for further reading.

Leave a Reply

Your email address will not be published. Required fields are marked *