Zulip is an open-source chat server that offers a range of features similar to popular platforms like Microsoft Teams, Rocket Chat, and Slack. Built using Python, Django, PostgreSQL, and JavaScript, Zulip integrates seamlessly with over 90 third-party plugins, including tools like Github, Jira, Stripe, Zendesk, and Sentry. With its extensive range of integrations, Zulip allows businesses to streamline their communication and collaboration processes. In this tutorial, we will walk you through the step-by-step process of installing and configuring Zulip Chat on a Debian 11 based server.
Prerequisites
Before we dive into the installation process, make sure you have the following prerequisites in place:
- A server running Debian 11.
- At least 2GB RAM if you expect fewer than 100 users. For 100+ users, consider a 4GB RAM and 2 CPU server.
- A non-root user with sudo privileges.
- A domain name configured to point to the server (e.g., zulip.example.com).
- Ensure that your system is updated by running the following command:
$ sudo apt update && sudo apt upgrade
You will also need to install a few essential packages on your system by running the following command:
$ sudo apt install wget curl nano ufw software-properties-common apt-transport-https gnupg2 ca-certificates debian-archive-keyring -y
Step 1 – Configure Firewall
The first step in the installation process is to configure the firewall on your Debian 11 server. Debian comes with Uncomplicated Firewall (ufw) pre-installed. To check if the firewall is running, use the following command:
$ sudo ufw status
If the firewall is inactive, you can proceed with configuring it. Start by allowing SSH port to ensure that the firewall doesn’t break the current connection when enabled:
$ sudo ufw allow OpenSSH
Next, allow HTTP and HTTPS ports for Zulip:
$ sudo ufw allow 80/tcp $ sudo ufw allow 443/tcp
Once the rules are set, enable the firewall by running the following command:
$ sudo ufw enable
You may be prompted with a message asking if you want to proceed with the operation. Enter ‘y’ to confirm. To verify that the firewall is active and all the rules are in place, run the following command:
$ sudo ufw status
You should see a similar output:
Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere 80/tcp ALLOW Anywhere 443/tcp ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) 80/tcp (v6) ALLOW Anywhere (v6) 443/tcp (v6) ALLOW Anywhere (v6)
Step 2 – Install Zulip
Now that the firewall is configured, we can proceed with the installation of Zulip. Zulip provides an installer script that takes care of all the necessary steps. It creates a user called ‘zulip’ to run the Zulip server, sets up the required dependencies, installs PostgreSQL database, Nginx web server, RabbitMQ, Redis Cache, and Memcached, and initializes Zulip’s database.
To begin the installation process, create a temporary directory using the mktemp command and switch to it:
$ cd $(mktemp -d)
Next, download the latest version of Zulip using wget:
$ wget https://download.zulip.com/server/zulip-server-latest.tar.gz
Extract all the files from the downloaded archive using the following command:
$ tar -xf zulip-server-latest.tar.gz
Now, run the installer script to install Zulip with SSL certificate support, replacing ‘YOUREMAIL’ with your email address and ‘YOURHOSTNAME’ with the domain name for Zulip (e.g., zulip.example.com):
$ sudo ./zulip-server-*/scripts/setup/install --certbot --email=YOUR_EMAIL --hostname=YOUR_HOSTNAME
The installer script will take care of installing all the necessary dependencies and setting up the Zulip server. Once the installation is complete, you will be provided with a unique URL. Make sure to copy this URL as you will need it to access the Zulip interface in the next step.
Step 3 – Accessing Zulip Interface
After the installation is finished, you can access the Zulip interface by visiting the unique URL provided by the installer script. Open your browser and enter the URL in the address bar. You will be presented with a screen where you can enter your email address to start creating your Zulip organization.
On the next screen, set up an account by providing your organization’s name, your name, and choose a password for logging in. Click the “Sign up” button to proceed.
Once you have completed the signup process, the Zulip dashboard will open, and you can start using Zulip to communicate and collaborate with your team.
Step 4 – Configuring Outgoing Email
Zulip server requires outgoing email configuration to send emails on a regular basis. In this step, we will guide you through the process of setting up outgoing mail for your Zulip server. For our example, we will be using Amazon’s SES service.
To configure outgoing email, you need to edit the Zulip settings file. Open the file using your preferred text editor:
$ sudo nano /etc/zulip/settings.py
In the settings file, you will find several variables related to email configuration. Uncomment the following variables by removing the ‘#’ character at the beginning of each line, and enter the corresponding values:
## EMAIL_HOST and EMAIL_HOST_USER are generally required. EMAIL_HOST = 'email-smtp.us-west-2.amazonaws.com' EMAIL_HOST_USER = 'yoursmpt_username' ## Passwords and secrets are not stored in this file. The password ## for user EMAIL_HOST_USER goes in `/etc/zulip/zulip-secrets.conf`. ## In that file, set `email_password`. For example: # email_password = abcd1234 ## EMAIL_USE_TLS and EMAIL_PORT are required for most SMTP providers. EMAIL_USE_TLS = True EMAIL_PORT = 587
Fill in the following additional variables as well. The first variable removes any random token from the no-reply email address, and the second variable configures the no-reply email sender for your mails:
ADD_TOKENS_TO_NOREPLY_ADDRESS = False
# TOKENIZED_NOREPLY_EMAIL_ADDRESS = "noreply-{token}@example.com"
NOREPLY_EMAIL_ADDRESS = 'test@example.com'
Once you have made the necessary changes, save the file by pressing Ctrl + X, followed by Y to confirm.
Zulip saves the email password in a separate file called ‘zulip-secrets.conf’. Open the file for editing:
$ sudo nano /etc/zulip/zulip-secrets.conf
Paste the following line at the end of the file to set the email password:
email_password = yoursmtp_password
Save the file by pressing Ctrl + X, followed by Y to confirm.
To test your outgoing email configuration, you can send a test email using the following command:
$ sudo -u zulip /home/zulip/deployments/current/manage.py send_test_email test@example.com
If the configuration is correct, you should see a success message indicating that the test email was sent successfully.
Step 5 – Zulip Server Commands
Zulip provides a set of commands that allow you to manage and control the Zulip server. These commands can be run using the ‘manage.py’ script included with Zulip. To access the script, use the following command:
$ sudo -u zulip /home/zulip/deployments/current/manage.py
This will display a list of available subcommands that you can use to perform various operations on the Zulip server. For example, you can run the following command to check the status of the Zulip server:
$ sudo -u zulip /home/zulip/deployments/current/manage.py start-server
To stop the server, use the following command:
$ sudo -u zulip /home/zulip/deployments/current/manage.py stop-server
And to restart the server, use the following command:
$ sudo -u zulip /home/zulip/deployments/current/manage.py restart-server
These commands allow you to perform various management tasks, such as adding users, creating streams, sending test emails, and much more. Refer to Zulip’s official documentation for a detailed explanation of each subcommand.
Step 6 – Upgrading Zulip
To keep your Zulip installation up to date, you will need to perform regular upgrades. Upgrading Zulip is a simple process that involves downloading the latest release and running a script to perform the upgrade.
To begin the upgrade process, download the latest release of Zulip using the following command:
$ curl -fLO https://download.zulip.com/server/zulip-server-latest.tar.gz
Once the download is complete, run the following command to perform the upgrade:
$ sudo /home/zulip/deployments/current/scripts/upgrade-zulip ~/zulip-server-latest.tar.gz
The upgrade script will take care of upgrading the system, installing the new version of Zulip’s dependencies, shutting down the Zulip server, running necessary database migrations, and restarting the Zulip server. After the upgrade process is complete, your Zulip installation will be up to date.
Step 7 – Backup and Restore Zulip
Regularly backing up your Zulip installation is crucial to ensure data safety and disaster recovery. Zulip provides built-in scripts that make it easy to perform backups and restores.
To take a complete backup of your Zulip installation, run the following command:
$ sudo -u zulip /home/zulip/deployments/current/manage.py backup --output=~/backups/zulip-backup.tar.gz
This command will create a compressed backup file named ‘zulip-backup.tar.gz’ in the ‘~/backups’ directory. This file contains all the data and configurations necessary to restore your Zulip installation.
To restore your Zulip installation from an existing backup, first, install Zulip by following the steps outlined in Step 2. Once the installation is complete, run the following command to restore the backup:
$ sudo -u zulip /home/zulip/deployments/current/scripts/setup/restore-backup ~/backups/zulip-backup.tar.gz
This command will restore all the data and configurations from the backup file, effectively restoring your Zulip installation to the state it was in when the backup was taken.
Conclusion
In this tutorial, we have covered the step-by-step process of installing and configuring the Zulip Chat server on a Debian 11 based system. By following these instructions, you can set up a powerful chat server that offers a range of features to enhance your team’s communication and collaboration. Zulip’s seamless integration with various third-party tools makes it an excellent choice for businesses looking to streamline their workflows.
If you have any questions or need further assistance, feel free to post in the comments section below. Happy Zulip-ing!
This article is brought to you by Shape.host, a leading provider of Linux SSD VPS hosting services. Shape.host offers reliable, scalable, and secure cloud hosting solutions tailored to meet your business needs. Visit Shape.host to learn more about our services.