Introduction

Mattermost is an open-source messaging platform designed for team collaboration. It provides various features such as file sharing, integrations, and support for various communication methods. In this guide, we will walk you through the steps to install Mattermost on Rocky Linux 9.

Prerequisites

  • A server running Rocky Linux 9.
  • Root access or a user with sudo privileges.
  • Basic knowledge of the command line.

Step 1: Update the System

Before starting the installation, it’s a good idea to update your system packages:

sudo dnf update -y

Step 2: Install Dependencies

Install the necessary dependencies for running Mattermost:

sudo dnf install -y postfix wget curl

Step 3: Install PostgreSQL

Mattermost uses a database to store data. We’ll install PostgreSQL:

sudo dnf install -y postgresql postgresql-server postgresql-contrib

Initialize the PostgreSQL database:

sudo postgresql-setup --initdb

Start and enable the PostgreSQL service:

sudo systemctl start postgresql
sudo systemctl enable postgresql

Step 4: Create PostgreSQL Database and User

Log in to the PostgreSQL prompt:

sudo -u postgres psql

Inside the PostgreSQL shell, create a database and a user for Mattermost:

CREATE DATABASE mattermost;
CREATE USER mmuser WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE mattermost TO mmuser;
\q

Replace your_password with a secure password.

Step 5: Download and Install Mattermost

Download the latest release of Mattermost:

wget https://releases.mattermost.com/7.6.0/linux/mattermost-team-7.6.0-linux-amd64.tar.gz

Extract the downloaded archive:

tar -xvzf mattermost-team-7.6.0-linux-amd64.tar.gz

Move the Mattermost files to the appropriate directory:

sudo mv mattermost /opt/

Create a symbolic link for easier access:

sudo ln -s /opt/mattermost/bin/mattermost /usr/local/bin/mattermost

Step 6: Configure Mattermost

Go to the Mattermost directory:

cd /opt/mattermost/config

Copy the sample configuration file:

sudo cp config.json config.json.bak
sudo nano config.json

Locate the database section and modify it to match your PostgreSQL settings:

"DriverName": "postgres",
    "DataSource": "mmuser:your_password@localhost/mattermost?sslmode=disable"

Save and exit the editor.

Step 7: Start Mattermost

Start the Mattermost service:

sudo mattermost

To keep it running in the background, you might want to use a tool like screen or nohup.

Step 8: Configure Firewall

If you are using a firewall, allow access to the Mattermost port (default is 8065):

sudo firewall-cmd --add-port=8065/tcp --permanent
sudo firewall-cmd --reload

Step 9: Access Mattermost

Open a web browser and navigate to http://your_server_ip:8065. You should see the Mattermost setup page. Follow the on-screen instructions to complete the setup.

Conclusion

You have successfully installed Mattermost on Rocky Linux 9. You can now create an account and start using Mattermost for your team collaboration.

Resources