Mattermost is an open-source, self-hostable online chat service designed for organizations and companies. It offers features such as file sharing, search, and integrations, making it an ideal internal chat solution. If you’re looking for an open-source alternative to Slack and Microsoft Teams, Mattermost is a great option. In this article, we will guide you through the process of installing Mattermost on Rocky Linux 8, ensuring efficient and reliable communication within your organization.
Before we begin, make sure you have the following prerequisites in place:
- A system with Rocky Linux 8 installed and running.
- Root access to the system.
- Docker installed and running on your Rocky Linux 8 system.
If you haven’t installed Docker on Rocky Linux 8 yet, you can refer to our guide on How to Install Docker on Rocky Linux 8. Once you have all the prerequisites ready, we can proceed with the installation and configuration of Mattermost.
Step 1: Install Nginx
To start the installation process, we first need to install Nginx. Open the terminal on your Rocky Linux 8 system and execute the following commands:
sudo dnf install nginx -y
sudo systemctl enable nginx
sudo systemctl start nginx
sudo systemctl status nginx
This will install Nginx and start the Nginx service. You can verify the status of Nginx to ensure that it is running correctly.
Step 2: Enable Firewall
Next, we need to enable the firewall to allow HTTP and HTTPS traffic. Run the following commands to enable the necessary services:
sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo firewall-cmd --reload
This will enable HTTP and HTTPS services in the firewall configuration.
Step 3: Install Let’s Encrypt SSL Certificate
To secure our Mattermost installation with an SSL certificate, we will use Let’s Encrypt. Before we can issue the certificate, we need to install the EPEL repository and the mod_ssl package. Execute the following command to install them:
sudo dnf install epel-release mod_ssl -y
Next, install the certbot client, which is used to create Let’s Encrypt certificates:
sudo dnf install python3-certbot-nginx -y
Once the installation is complete, we can issue the SSL certificate by running the following command:
sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email dev@dev.domainhere.info -d dev.domainhere.info
Replace “dev.domainhere.info” and “dev@dev.domainhere.info” with your actual domain name and email address. This command will automatically generate and configure the SSL certificate for your Mattermost installation.
Step 4: Restart Nginx
After installing the SSL certificate, it’s essential to restart Nginx to apply the changes:
sudo systemctl restart nginx
This will ensure that Nginx is using the newly installed SSL certificate.
Step 5: Configuring Nginx Server Blocks
To configure Nginx server blocks for our Mattermost installation, we need to modify the Nginx configuration file. Open the file using a text editor:
sudo nano /etc/nginx/nginx.conf
Replace the contents of the file with the following configuration:
# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; # 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 http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; }
Save and exit the file by pressing Ctrl+O
, then Ctrl+X
. This configuration optimizes Nginx for performance and includes the necessary files for the server blocks.
Next, create a new Nginx configuration file for your Mattermost installation:
sudo vi /etc/nginx/conf.d/dev.conf
Replace “dev.domainhere.info” and “192.169.7.180” with your actual domain name and IP address. Adjust the SSL path according to your SSL configuration. Paste the following codes into the file:
upstream app { server 192.169.7.180:8065; } server { listen 80 default_server; server_name dev.domainhere.info; return 301 https://$server_name$request_uri; } server { listen 443 ssl; # managed by Certbot server_name dev.domainhere.info; ssl_certificate /etc/letsencrypt/live/dev.domainhere.info/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/dev.domainhere.info/privkey.pem; # 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; } }
For SELinux-enabled systems, run the following command to allow Nginx to connect:
sudo setsebool -P httpd_can_network_connect 1
Finally, restart Nginx to apply the new configurations:
sudo systemctl restart nginx sudo systemctl status nginx
Step 6: Enable Port 8065
To allow connections to the Mattermost container through the firewall, run the following commands:
sudo firewall-cmd --zone=public --permanent --add-port8065/tcp sudo firewall-cmd --reload
This will open port 8065 for incoming connections to Mattermost.
Step 7: Install Mattermost with Docker
Now that we have configured Nginx and the necessary firewall rules, we can proceed with the installation of Mattermost using Docker. Execute the following command to install Mattermost in Preview Mode:
sudo docker run --name mattermost-preview -d --publish 8065:8065 mattermost/mattermost-preview
This command will download and run the Mattermost Docker image, mapping port 8065 from the container to the host. The installation process may take a few minutes to complete.
Step 8: Updating Mattermost Preview
To update Mattermost to the latest version, use the following command:
sudo docker pull mattermost/mattermost-preview
This will download the latest version of the Mattermost Docker image.
Step 9: Accessing Your Container Shell
If you need to access the shell inside the Mattermost container, use the following command:
sudo docker exec-ti mattermost-preview/bin/bash
This will open a shell session inside the container, allowing you to perform various administrative tasks.
Step 10: Configuring Mattermost
Once the installation is complete, you can access your Mattermost instance by opening your browser and navigating to https://dev.domainhere.info
. Replace “dev.domainhere.info” with your actual domain or IP address.
This will redirect you to the Mattermost configuration page, where you can set up your Mattermost server and create your admin account. Follow the on-screen instructions to configure Mattermost according to your organization’s requirements.
Congratulations! You have successfully installed Mattermost with Docker on Rocky Linux 8. You can now enjoy secure and efficient communication within your organization using this powerful open-source chat service.
For reliable and scalable hosting solutions, consider Shape.host’s Linux SSD VPS services. With 24/7 in-house customer support, Shape.host provides efficient cloud hosting solutions tailored to your business needs. Visit Shape.host to explore their services and take your organization’s communication to the next level.