Install Mattermost on Rocky Linux 8 and RHEL 8 | Best Guide Steps
In this guide, we want to show you how to Install Mattermost on Rocky Linux 8 and RHEL 8 and Access its dashboard through the web interface. Mattermost is a free, open-source, secure, and popular communication tool that is an alternative to Slack. It brings many amazing features that you can use to communicate with your team.
Now proceed to the following guide steps provided by the Orcacore team to Install Mattermost on Rocky Linux 8 and RHEL 8.
To Install Mattermost on Rocky Linux 8 and RHEL 8, you must have access to your server as a non-root user with sudo privileges and set up a basic firewall. For this purpose, you can visit this guide on Initial Server Setup with Rocky Linux 8.
Also, you need a domain name that is pointed to your server’s IP address.
Now follow the steps below to Install Mattermost on Rocky Linux 8 and RHEL 8.
Step 1 – Install and Configure MariaDB for Mattermost
In this guide, we will use MariaDB as our database management system. So you need to run the system update and install the MariaDB server with the following commands:
# sudo dnf update -y
# sudo dnf install mariadb-server -y
Start and enable your MariaDB service with the following command:
sudo systemctl enable --now mariadb
Then, secure your MariaDB installation and set a root password for your MariaDB by using the following script:
sudo mysql_secure_installation
Now proceed to the following step to configure MariaDB for Mattermost.
At this point, you need to log in to your MariaDB shell with the following command:
sudo mysql -u root -p
Then, you must create a Mattermost database and database user with a password on Rocky Linux 8. To do this, run the following commands:
**MariaDB [(none)]>** CREATE DATABASE mattermostdb;
**MariaDB [(none)]>** CREATE USER 'orca'@'%';
**MariaDB [(none)]>** SET PASSWORD FOR 'orca'@'%' = PASSWORD('strongpassword');
Next, you need to give all the privileges to the Mattermost database and database user with the command below:
**MariaDB [(none)]>** GRANT ALL ON mattermostdb.* TO 'orca'@'%' IDENTIFIED BY 'strongpassword' WITH GRANT OPTION;
Next, flush the privileges and exit from the MariaDB console:
**MariaDB [(none)]>** FLUSH PRIVILEGES;
**MariaDB [(none)]>** EXIT;
Step 2 – Download Mattermost on Rocky Linux 8 / RHEL8
To Install Mattermost on Rocky Linux 8 and RHEL 8, you need to create a dedicated user and group for Mattermost. To do this, you can use the following command:
sudo useradd --system --user-group mattermost
Then, you need to visit the Mattermost release page and get the latest version by using the following wget command on your Rocky Linux 8:
sudo wget https://releases.mattermost.com/8.0.1/mattermost-8.0.1-linux-amd64.tar.gz
When your download is completed, extract your file in the /opt directory:
sudo tar xvzf mattermost-8.0.1-linux-amd64.tar.gz -C /opt/
Next, use the following command to install a data directory to store your Mattermost files:
sudo mkdir /opt/mattermost/data
Now set the correct permission and ownership by using the following commands:
# sudo chown -R mattermost:mattermost /opt/mattermost
# sudo chmod -R g+w /opt/mattermost
Step 3 – Configure Mattermost on Rocky Linux 8 / RHEL8
To Install Mattermost on Rocky Linux 8 and RHEL 8, you need to edit the Mattermost configuration file and define your site URL and database settings to the file. To do this, open the Mattermost config file with your desired text editor, here we use the vi editor:
sudo vi /opt/mattermost/config/config.json
At the file, define your site URL and database settings as shown below:
"SiteURL": "http://mattermost.example.com",
"DriverName": "mysql",
"DataSource": "orca:strongpassword@tcp(localhost:3306)/mattermostdb?charset=utf8mb4,utf8&writeTimeout=30s",
When you are done, save and close the file.
Step 4 – How To Start Mattermost Server?
Then, change to the Mattermost directory and Start the Mattermost server as the user Mattermost with the following command:
# cd /opt/mattermost
# sudo -u mattermost ./bin/mattermost
When the server starts, you will see some log information and the text Server is listening on :8065. Then, you can stop the server by pressing Ctrl C.
Step 5 – Manage Mattermost Service on Rocky Linux 8 / RHEL8
At this point, you need to create a systemd unit file to manage your Mattermost service. To do this, run the command below:
sudo vi /etc/systemd/system/mattermost.service
Add the following content to the file:
[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
KillMode=mixed
LimitNOFILE=49152
[Install]
WantedBy=multi-user.target
When you are done, save and close the file.
Now reload the systemd service to apply the changes:
sudo systemctl daemon-reload
Next, use the following commands to start and enable your service to start at boot:
# sudo systemctl start mattermost
# sudo systemctl enable mattermost
Verify that your Mattermost service is active and running on Rocky Linux 8:
sudo systemctl status mattermost
In your output you will see:
**Output**
● mattermost.service - Mattermost
Loaded: loaded (/etc/systemd/system/mattermost.service; enabled; vendor pres>
Active: **active** (**running**) since Mon 2023-08-07 09:52:32 EDT; 2min 51s ago
Main PID: 93450 (mattermost)
Tasks: 30 (limit: 23699)
Memory: 282.6M
CGroup: /system.slice/mattermost.service
└─93450 /opt/mattermost/bin/mattermost
└─93458 plugins/com.mattermost.nps/server/dist/plugin-linux-amd64
└─93465 plugins/playbooks/server/dist/plugin-linux-amd64
└─93471 plugins/com.mattermost.calls/server/dist/plugin-linux-amd64
...
Step 6 – Configure Nginx as Reverse Proxy for Mattermost
At this point, that you have installed Mattermost on Rocky Linux 8, you need to configure Nginx as a reverse proxy for Mattermost.
First, install Nginx on Rocky Linux 8 with the following command:
sudo dnf install nginx -y
Next, you need to create a Nginx virtual host configuration file. Create and open the file with your favorite text editor, here we use vi:
sudo vi /etc/nginx/conf.d/mattermost.conf
Add the following contents to the file:
server {
listen 80;
server_name mattermost.example.com;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://localhost:8065/;
index index.html index.htm;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
Remember to replace the domain names with your own in the file.
When you are done, save and close the file.
Verify the Nginx for any configuration error by using the following command:
nginx -t
**Output**
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Then, start and enable your Nginx service with the following commands:
# sudo systemctl start nginx
# sudo systemctl enable nginx
Step 7 – Configure Firewall Rules for Matetrmost
If you have a running firewall, you must allow port HTTP, HTTPS, and port Mattermost which is 8065. To do this, you can run the commands below:
# sudo firewall-cmd --add-service=http --permanent
# sudo firewall-cmd --add-service=https --permanent
# sudo firewall-cmd --permanent --add-port=8065/tcp
To apply the new rules, reload the firewall:
sudo firewall-cmd --reload
Step 8 – How To Access Mattermost Dashboard on RHEL 8?
At this point, you can access the Mattermost web interface by typing your server’s IP address or your domain name in your web browser followed by 8065:
http://your-domain-name-or-IP:8065
You will see the Mattermost create account screen, set your account, and click Create Account as shown below:

In the next window, enter your organization name and click continue.

Then, you can choose the tools that you use or skip them.

Next, your invitation link is provided for you. You can use this to invite your team members. Click Finish Setup.

Finally, you can see your Mattermost dashboard.

That’s it, you’ve just configured Mattermost to Rocky Linux 8 Server. From there you can collaborate with your teams.
Conclusion
At this point, you have learned to configure MariaDB as a database engine for Mattermost, download the latest release from the source, and configure Mattermost to access it from the web browser.
Hope you enjoy this guide on Install Mattermost on Rocky Linux 8 and RHEL 8. Also, you may like to read the following articles:
Discover StartOS Linux Download and Reviews
Install KDE Plasma on AlmaLinux 9 / RHEL 9
Check Open Ports on AlmaLinux 8 / 9
Alternative Solutions for Installing Mattermost
While the above guide provides a solid method for installing Mattermost, there are alternative approaches that can streamline the process or offer different advantages. Here are two alternative solutions for installing Mattermost on Rocky Linux 8 or RHEL 8:
1. Using Docker Compose
Docker provides a containerization solution that simplifies the deployment and management of applications. Using Docker Compose, we can define the Mattermost application stack, including the database and Mattermost server, in a single docker-compose.yml
file.
Explanation:
Docker Compose allows you to define and manage multi-container Docker applications. By defining the Mattermost installation in a docker-compose.yml
file, you can quickly deploy and manage the entire application stack with a single command. This approach simplifies the installation process, manages dependencies effectively, and ensures consistency across different environments.
Steps:
-
Install Docker and Docker Compose:
sudo dnf install docker -y sudo systemctl start docker sudo systemctl enable docker sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
-
Create a
docker-compose.yml
file:version: "3.8" services: db: image: mariadb:10.6 restart: always environment: MYSQL_ROOT_PASSWORD: your_root_password MYSQL_DATABASE: mattermostdb MYSQL_USER: mattermost MYSQL_PASSWORD: your_mattermost_password volumes: - db_data:/var/lib/mysql mattermost: image: mattermost/mattermost-team-edition:latest depends_on: - db restart: always ports: - "8065:8065" environment: MM_SQLSETTINGS_DRIVERNAME: mysql MM_SQLSETTINGS_DATASOURCE: mattermost:your_mattermost_password@tcp(db:3306)/mattermostdb?charset=utf8mb4,utf8 MM_SERVICESETTINGS_SITEURL: "http://mattermost.example.com" MM_SERVICESETTINGS_LISTENADDRESS: ":8065" volumes: - mattermost_data:/mattermost_data networks: - mattermost_network volumes: db_data: mattermost_data: networks: mattermost_network: driver: bridge
Replace
your_root_password
andyour_mattermost_password
with secure passwords. Also, update theMM_SERVICESETTINGS_SITEURL
with your desired Mattermost URL. -
Start the Mattermost stack:
Navigate to the directory containing the
docker-compose.yml
file and run:docker-compose up -d
This command will download the necessary images, create the containers, and start Mattermost in detached mode.
-
Access Mattermost:
Open your web browser and navigate to the URL you specified in the
MM_SERVICESETTINGS_SITEURL
environment variable.
2. Using the Mattermost Operator for Kubernetes
For organizations already using Kubernetes, the Mattermost Operator offers a robust and scalable deployment option.
Explanation:
The Mattermost Operator automates the deployment, scaling, and management of Mattermost instances within a Kubernetes cluster. It handles tasks such as database provisioning, certificate management, and upgrades, allowing you to focus on using Mattermost rather than managing its infrastructure.
Steps:
-
Install Kubernetes and
kubectl
: Ensure you have a working Kubernetes cluster and thekubectl
command-line tool installed and configured. -
Install the Mattermost Operator:
kubectl create namespace mattermost kubectl apply -f https://github.com/mattermost/mattermost-operator/releases/latest/download/mattermost-operator.yaml -n mattermost
-
Create a Mattermost resource definition:
Create a YAML file (e.g.,
mattermost.yaml
) to define your Mattermost instance. Here’s a basic example:apiVersion: mattermost.com/v1alpha1 kind: Mattermost metadata: name: mattermost-team namespace: mattermost spec: size: 1 image: mattermost/mattermost-team-edition:latest ingressName: mattermost.example.com database: type: mysql secret: mysql-credentials
Replace
mattermost.example.com
with your desired domain name. You’ll also need to create a Kubernetes Secret namedmysql-credentials
containing the database credentials. -
Apply the Mattermost resource definition:
kubectl apply -f mattermost.yaml -n mattermost
The Mattermost Operator will now provision the necessary resources, including the database, Mattermost pods, and ingress controller.
-
Access Mattermost:
Configure your DNS to point your domain name (
mattermost.example.com
in the example) to the Kubernetes ingress controller. Then, open your web browser and navigate to your domain name.
These alternative solutions offer different benefits depending on your infrastructure and technical expertise. Docker Compose provides a simpler deployment option for single-server environments, while the Mattermost Operator is ideal for organizations leveraging Kubernetes for scalable and automated deployments.