Installing Mattermost with Docker on Rocky Linux 8


In this week’s feature highlight, we look at How to Install Mattermost with Docker on Rocky Linux 8

Mattermost is an open-source, self-hostable online chat service with file sharing, search, and integrations. It is designed as an internal chat for organizations and companies and most markets itself as an open-source alternative to Slack and Microsoft Teams. In this article, we are going to learn how to install Mattermost on Rocky Linux 8. So, let’s get started.

Checkout the Mattermost Project Here.

Try this wiki on our VPS. Starting at just $5/month with 24×7 In-house customer support.


  • A system with Rocky Linux 8 installed and running.
  • root access to the system.
  • Docker installed and running, for this, you can refer to one of our guides on installing Docker on Rocky Linux 8.

Once you’re all set, we’ll proceed with Mattermost installation and configuration.

Install Nginx

Let’s begin with installing Nginx. Install using the below codes.

yum install nginx -y

Enable services

systemctl enable nginx

systemctl start nginx

systemctl status nginx

Enable Firewall

firewall-cmd --permanent --add-service=http

firewall-cmd --permanent --add-service=https

firewall-cmd --reload

Install Let’s Encrypt SSL Certificate

Let’s issue an SSL certificate for the domain. For this, we will need the EPEL repository and the mod_ssl package on Rocky Linux 8 operating system.

Update and install EPEL repository and the mod_ssl package on the system using the below command:

dnf install epel-release mod_ssl -y

Next, we will install the certbot client which is used to create Let’s Encrypt certificates:

dnf install python3-certbot-nginx -y

Install SSL Certificate

Use the certbot command to issue a Let’s Encrypt certificate. Replace and with your domain name and email :

certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email -d

SSL certificates are valid for 90 days. The renewal process is now automated, you do not have to renew this manually.

Restart Nginx

Restart apache to avoid getting error messages.

systemctl restart nginx

Configuring Nginx Server Blocks

Let’s configure nginx.conf with the following command:

nano /etc/nginx/nginx.conf

Replace the nginx.conf file with the below configuration.

# For more information on configuration, see:
#   * Official English Documentation:
#   * Official Russian Documentation:

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See
    # for more information.
    include /etc/nginx/conf.d/*.conf;

Now, type in Ctrl+O and type Ctrl+X to save and exit the file.

Create a new Nginx configuration file dev.conf for the domain with the following command:

vi /etc/nginx/conf.d/dev.conf

Add the following codes:

Replace & with Your Domain Name & IP and Change SSL Path according to your SSL Path.

upstream app {

server {
listen 80 default_server;
return 301 https://$server_name$request_uri;

server {
    listen 443 ssl; # managed by Certbot
    # The host name to respond to

    ssl_certificate /etc/letsencrypt/live/; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    location / {
    proxy_pass http://app;
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Real-Port $server_port;
    proxy_set_header X-Real-Scheme $scheme;

Now, press the Esc key, and type :wq! and press the Enter key to save and exit the file.

For SELinux enabled systems, Run the below command

setsebool -P httpd_can_network_connect 1

Now, restart & check the Nginx with the following commands:

systemctl restart nginx

systemctl status nginx

Enable port 8065

To enable connection through the firewall, follow the commands:

firewall-cmd --zone=public --permanent --add-port 8065/tcp

firewall-cmd --reload

Install Mattermost with Docker

The following instructions use Docker to install Mattermost in Preview Mode using the Mattermost Docker Preview Image for investigating product capabilities on a single local machine. Let’s install Mattermost with Docker using the below command

docker run --name mattermost-preview -d --publish 8065:8065 mattermost/mattermost-preview

The installation process will start now. It may take 5-10 mins to complete.

Updating Mattermost Preview

For updating Mattermost. Use below commands

docker pull mattermost/mattermost-preview

docker stop mattermost-preview

docker rm mattermost-preview

Accessing Your Container Shell

To access a shell inside the container, run the following command

docker exec -ti mattermost-preview /bin/bash

Configuring Mattermost

Now open the IP address or Domain name from your browser, this will redirect you to configuring the final parts of the Mattermost installation.

Replace the with the actual IP or domain configured on the server.

Configure Mattermost from Admin Dashboard. Follow the below steps:

Now you have successfully installed Mattermost with Docker on Rocky Linux 8.

(Visited 172 times, 1 visits today)