In this tutorial, we will show you how to install Mattermost on AlmaLinux 8. For those of you who didn’t know, Mattermost is a secure, open-source platform for communication, collaboration, and workflow orchestration across tools and teams. Mattermost is a free Slack alternative. Mattermost is available in open source and enterprise editions. Open Source edition is free, whereas Enterprise editions require a per-user license. You can find Mattermost Pricing plans on their official website.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Mattermost on AlmaLinux 8. You can follow the same instructions for CentOS and Rocky Linux.
Prerequisites
- A server running one of the following operating systems: AlmaLinux 8, CentOS, and Rocky Linux 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Mattermost on AlmaLinux 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf update sudo dnf install epel-release
Step 2. Installing MySQL on AlmaLinux 8.
Now we run the following command to install MySQL on your AlmaLinux system:
sudo dnf install mysql-server mysql
Once successfully installed, start to enable it to start on system start-up using:
sudo systemctl restart mysqld sudo systemctl status mysqld sudo systemctl enable mysqld
By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation
script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
mysql_secure_installation
Next, let’s log in to our MySQL server and create a Database to use later with Mattermost installation:
mysql -u root -p
Create Mattermost database and user with all privileges on the database:
CREATE DATABASE mattermost_db; CREATE USER 'mattermost_user'@'localhost' IDENTIFIED BY 'your-strong-password'; GRANT ALL ON mattermost_db. * TO mattermost_user@localhost; FLUSH PRIVILEGES; Exit;
Step 3. Installing Mattermost on AlmaLinux 8.
Now we download and install the latest version of Mattermost from its official page:
wget https://releases.mattermost.com/5.39.0/mattermost-5.39.0-linux-amd64.tar.gz
Next, extract and move the downloaded file to /opt
directory:
sudo tar -xf mattermost-*-linux-amd64.tar.gz sudo mv mattermost /opt
Step 4. Configuring Config.json File.
Run the following command to create a config.json
file using the nano text editor:
sudo nano /opt/mattermost/config/config.json
Find and set the following directives related to the Mattermost backend database. You may find them under “SqlSettings
“ configuration block:
"DriverName": "mysql",
"DataSource": "mmuser:mmpwd@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s",
Step 5. Creating Systemd Service Mattermost.
Let’s create a configuration file systemd
service to allow us to start, stop and restart the Mattermost service:
cd /etc/systemd/system sudo nano mattermost.service
Add the following line:
[Unit] Description=Mattermost After=syslog.target network.target mysqld.service [Service] Type=notify WorkingDirectory=/opt/mattermost User=mattermost ExecStart=/opt/mattermost/bin/mattermost PIDFile=/var/spool/mattermost/pid/master.pid TimeoutStartSec=3600 LimitNOFILE=49152 [Install] WantedBy=multi-user.target
Save and close then, make the file executable:
sudo chmod 664 /etc/systemd/system/mattermost.service sudo systemctl daemon-reload
Now, enable the above-created service file to run with the system boot and also start the same:
sudo systemctl enable mattermost.service sudo systemctl start mattermost.service sudo systemctl status mattermost.service
Step 6. Configure Firewall.
Now open port number 8065 on your AlmaLinux:
sudo firewall-cmd --zone=public --add-port=8065/tcp sudo firewall-cmd --reload
Step 7. Accessing Mattermost Web Interface.
Once successfully installed, open your favorite browser and navigate to http://your-ip-address:8065
and continue to configure Mattermost by entering an email address and creating an account.
Congratulations! You have successfully installed Mattermost. Thanks for using this tutorial for installing Mattermost on your AlmaLinux 8 system. For additional help or useful information, we recommend you check the official Mattermost website.