Wondering how to deploy Mattermost on Ubuntu 20.04 LTS?
Mattermost provides its users a safe messaging environment by relying on a free-to-use, community-powered system, which allows for secure collaboration.
It lets you utilize all the advantages of the workplace environment on an external web-based information sharing platform. Moreover, the software integrates webhooks and bots, which provides additional customization. It is compatible with all major PC operating systems, including Linux, and even iOS and Android.
These features make Mattermost a good alternative to SaaS messaging for teams.
If you’re someone who wishes to learn how to deploy Mattermost in Ubuntu 20.04 LTS, then this guide is meant for you. Just follow the steps in this guide to ensure a seamless installation.
So without further ado, let’s begin!
Step 1: Updating your System.
The first step is to make sure that your system is updated. This will ensure that there are no problems caused by outdated repositories.
Although this guide uses Ubuntu 20.04 LTS, the process isn’t any different from its previous versions.
To update your system packages and repositories, follow these steps:
- First, open the Command Terminal by pressing Ctrl + Alt + T on your keyboard.
- Next, execute the following:
$ sudo apt update && sudo apt upgrade
This will update all packages to the latest available versions. With this, you can proceed to the next step.
Step 2: Setting up the Hostname.
The next step is to set an appropriate hostname for your server, along with installing a reliable database.
Enter the following in the Command Terminal to set up the hostname:
$ sudo hostnamectl set-hostname <Hostname> --static
$ sudo hostnamectl set-hostname test.ubuntu --static
Step 3: Setting up the Database.
Once that’s done, proceed to set up the database.
It is recommended that you make use of PostgreSQL. However, MySQL is also a reliable alternative.
Follow these steps to set up the database:
- First, open the Command Terminal.
- Next, type the following:
$ sudo apt install postgresql postgresql-contrib
- After that, type the following to log in to your database account:
$ sudo --login --user postgres
- Now, start PostgreSQL and create a user/database for Mattermost. For this purpose, use this command:
$ CREATE DATABASE mattermost;
Once that’s done, type the following commands:
$ CREATE USER <username> WITH PASSWORD ‘<password>’;
$ CREATE USER ubuntu20 WITH PASSWORD ‘ubuntu2021’;
$ GRANT ALL PRIVILEGES ON DATABASE mattermost TO ubuntu20;
These commands will create a user profile that has full access to the Mattermost database.
Step 4: Creating a Mattermost group and user.
After setting up the PostgreSQL database, you’re halfway there in learning how to deploy Mattermost on Ubuntu 20.04 LTS.
The next step is to create a new user and group titled “mattermost”. For this purpose, you’ll use the
$ useradd command.
Follow these steps to add a new user and group:
- To start, open the Command Terminal by pressing Ctrl + Alt + T on your keyboard.
- Next, type the following:
$ sudo useradd --system --user-group mattermost
This will create a new user and group titled “mattermost” that has system privileges.
- Lastly, confirm the creation by typing the following:
$ id mattermost
You should get an output similar to the image below.
With the steps followed correctly, you should now have created a user and group titled “mattermost” on your system.
Step 5: Installing and Configuring Mattermost.
Now that the prerequisites are finally completed, you can proceed to install Mattermost on your system.
This involves a simple process that makes use of the Command Terminal.
Follow these steps to install Mattermost on your system:
- Start by creating a directory for Mattermost by typing the following in the Command Terminal:
$ mkdir mattermost
- Next, change the directory to “mattermost” by typing the following command:
$ cd mattermost
- Afterward, execute the following in the Command Terminal to get the latest version of the software:
$ wget https://releases.mattermost.com/<X.X.X>/mattermost-<X.X.X>-linux-amd64.tar.gz
At the time of writing this guide, the latest available version is 4.7.2, so the command would be:
$ wget https://releases.mattermost.com/4.7.2/mattermost-4.7.2-linux-amd64.tar.gz
- Once the download is finished, extract the package by typing the following:
$ tar -xvzf mattermost*.gz
- Next, make a copy of the file and place it in the /otp directory. You can do so by using this command:
$ sudo cp -r mattermost /opt
- Make a new folder that will store data related to Mattermost by typing the following command:
$ sudo mkdir/opt/mattermost/data
- Lastly, give appropriate permissions by typing the following in the Terminal:
$ sudo chown -R mattermost:mattermost /opt/mattermost
$ sudo chmod -R g+w /opt/mattermost
With the steps followed correctly, you should now have installed and configured Mattermost on your system.
Step 6: Configuring the Mattermost Server.
With Mattermost set up and ready for use, all that’s left is to configure the server. An in-depth explanation of deploying the Mattermost server is available in their official user manual.
Mattermost can also be configured to have backups, ensuring that there’s no data loss in case of a server crash. These backups can be configured to either save minimal data necessary for the server to function correctly or do a complete, automated failsafe.
When you’re working with Mattermost, having applications that can function as an appropriate load-balancer can turn out to be a game-changer. Plus, having dedicated software responsible for managing data traffic and user interaction with the website can provide your server the edge it needs for efficient web hosting.
For this purpose, we recommend that you install and configure Nginx on your system.
We hope this guide helped you learn how to deploy Mattermost on Ubuntu 20.04 LTS. If you have any questions or suggestions to make this guide better, let us know in the comment section down below.
If this guide helped you, please share it. 🙂