Site icon CentLinux

How to install Mattermost Server on CentOS 8

Share on Social Media

Learn how to install Mattermost Server on CentOS 8 with our comprehensive step-by-step guide. Set up your Mattermost instance efficiently and ensure a smooth installation process. #centlinux #linux #mattermost

What is Mattermost?

Mattermost is an open-source collaboration and messaging platform designed for team communication and project management. Mattermost is a free Slack alternative. It offers a secure, self-hosted solution for organizations needing control over their data and integration capabilities. Key features include:

  1. Team Messaging: Real-time chat for individuals and groups with threaded conversations.
  2. File Sharing: Easy sharing of documents and files within the platform.
  3. Integrations: Supports integration with various tools and services like GitHub, Jira, and Jenkins.
  4. Customizable: Highly configurable to meet specific business needs.
  5. Secure and Private: Self-hosting ensures complete control over data privacy and security.
  6. Cross-Platform: Available on web, desktop, and mobile devices, ensuring seamless communication across different platforms.
  7. Collaboration: Features like task management, video conferencing, and bots enhance team collaboration.

Mattermost is ideal for businesses seeking a flexible and secure alternative to cloud-based collaboration tools, particularly those in regulated industries needing stringent data control.

Mattermost vs Slack

Comparing Mattermost and Slack involves looking at several aspects including features, deployment options, customization, security, and pricing. Here’s a detailed comparison to help you understand the key differences and similarities:

Features

Slack

  1. User Interface: Slack has a polished, user-friendly interface with a focus on ease of use.
  2. Integrations: Supports over 2,000 apps and integrations including Google Drive, Trello, GitHub, and many more.
  3. Search: Robust search capabilities with support for filtering by file type, user, channel, and date.
  4. Channels and Threads: Channels for group discussions and threads for keeping conversations organized.
  5. Video and Voice Calls: Supports one-on-one and group video/voice calls.
  6. File Sharing: Easy sharing of files and documents within channels and direct messages.
  7. Bots and Automation: Supports custom bots and workflows to automate tasks.

Mattermost

  1. User Interface: Clean and customizable interface that can be adapted to meet specific needs.
  2. Integrations: Supports numerous integrations, though fewer than Slack, but includes key ones like GitHub, Jenkins, and Jira.
  3. Search: Powerful search functionality similar to Slack, but may require more configuration for advanced use.
  4. Channels and Threads: Offers channels and threaded discussions, similar to Slack.
  5. Video and Voice Calls: Integrates with Jitsi for video and voice calls, allowing for self-hosted solutions.
  6. File Sharing: Robust file sharing capabilities with integrations into storage solutions.
  7. Bots and Automation: Offers extensive support for bots and custom commands, especially beneficial for development teams.

Deployment Options

Slack

Mattermost

Customization

Slack

Mattermost

Security

Slack

Mattermost

Pricing

Slack

Mattermost

Summary

The choice between Slack and Mattermost ultimately depends on your specific needs, budget, and technical capabilities.

Recommended Online Training: ChatOps com ChatBot: Mattermost, Netdata, Jenkins e Gitlab

Environment Specification

We are using a minimal CentOS 8 virtual machine with following specifications.

Read Also: How to install Mattermost on CentOS 7

Update your Linux Server

By using a SSH client, connect with mattermost-02.centlinux.com as root user.

By following the best practice, update software packages in your Linux operating system.

# dnf update -y

Install MySQL on CentOS 8

Mattermost requires a backend database server to store its data. It supports MySQL and PostgreSQL databases.

You may install PostgreSQL database server to use with your XMPP server. But, we are installing MariaDB database server, a famous fork of MySQL.

If you already have a working database server, then you can skip this step and create the Mattermost database on that server.

MariaDB server is available in standard yum repositories, therefore you can install it with the help of dnf command.

# dnf install -y mariadb-server

Enable and start MariaDB database service.

# systemctl enable --now mariadb.service
Created symlink /etc/systemd/system/mysql.service â /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service â /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service â /usr/lib/systemd/system/mariadb.service.

Since, you have installed a fresh MariaDB server, therefore, you are required to perform initial configuration of the MySQL instance.

Use the following Linux command to configure your MySQL instance.

# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Connect with MySQL server as root database user.

# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 16
Server version: 10.3.17-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]>

Create a new database user, that will own the Mattermost software database.

MariaDB [(none)]> create user 'mmuser'@'localhost' identified by 'mmpwd';
Query OK, 0 rows affected (0.001 sec)

Now create the mattermost database.

MariaDB [(none)]> create database mattermost;
Query OK, 1 row affected (0.001 sec)

Grant full rights on mattermost database to mmuser.

MariaDB [(none)]> grant all privileges on mattermost.* to 'mmuser'@'localhost';
Query OK, 0 rows affected (0.001 sec)

Exit from mysql shell.

MariaDB [(none)]> exit
Bye

Install Mattermost Server on CentOS 8

To download Mattermost, go to their official website and obtain the URL of the latest version.

Mattermost Downloads

By using wget command, download the latest version of Mattermost software straight at the Linux CLI.

# cd /tmp
# wget https://releases.mattermost.com/5.28.1/mattermost-5.28.1-linux-amd64.tar.gz
--2020-10-25 10:14:42--  https://releases.mattermost.com/5.28.1/mattermost-5.28.1-linux-amd64.tar.gz
Resolving releases.mattermost.com (releases.mattermost.com)... 13.35.183.125, 13.35.183.10, 13.35.183.108, ...
Connecting to releases.mattermost.com (releases.mattermost.com)|13.35.183.125|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 183523028 (175M) [application/x-gzip]
Saving to: âmattermost-5.28.1-linux-amd64.tar.gzâ

mattermost-5.28.1-l 100%[===================>] 175.02M   515KB/s    in 5m 27s

2020-10-25 10:20:11 (549 KB/s) - âmattermost-5.28.1-linux-amd64.tar.gzâ saved [183523028/183523028]

Extract the downloaded tarball to install Mattermost Server.

# tar xvf mattermost-5.28.1-linux-amd64.tar.gz

After extraction, move the mattermost directory (that was extracted from tarball) to /opt directory.

# mv mattermost /opt/

Create a data directory for Mattermost application.

# mkdir /opt/mattermost/data

Create a Linux user to own Mattermost software and in-memory processes.

# cd
# useradd -r -U mattermost

Adjust the file permissions and SELinux file contexts of the /opt/mattermost directory.

# chown -R mattermost:mattermost /opt/mattermost
# chmod -R g+w /opt/mattermost
# restorecon -R /opt/mattermost/

Mattermost Configurations are located in /opt/mattermost/config/config.json.

You need to edit this configuration file to update settings according to your environment.

# vi /opt/mattermost/config/config.json

Find and set following directives related to Mattermost backend database. You may find them under “SqlSettings” configuration block.

"DriverName": "mysql",
"DataSource": "mmuser:mmpwd@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8u0026readTimeout=30su0026writeTimeout=30s",

Find and set following directive. You may find it under “ServiceSettings” configuration block.

"SiteURL": "http://mattermost-02.centlinux.com",

Please ensure that the hostname of your Linux server is resolvable. You can either configure an Authoritative DNS Server or simply use the local DNS resolver.

Here, we are using the Local DNS resolver.

# vi /etc/hosts

Add following entry therein.

192.168.116.232  mattermost-02 mattermost-02.centlinux.com

You haved installed Mattermost server successfully. You can now test it by using following command.

# cd /opt/mattermost/
# sudo -u mattermost ./bin/mattermost

The Mattermost service has been started and listening on default port i.e. 8065.

Create Systemd Service for Mattermost Server

To enable Mattermost service to autostart at the time of Linux startup. You need to create a Systemd service unit.

Use the vim editor and create a Systemd service unit for Mattermost.

# vi /etc/systemd/system/mattermost.service

Add following directives in this file.

[Unit]
Description=Mattermost
After=syslog.target network.target postgresql.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

Enable and start Mattermost service.

# systemctl enable --now mattermost.service
Created symlink /etc/systemd/system/multi-user.target.wants/mattermost.service â /etc/systemd/system/mattermost.service.

Configure Linux Firewall

Although, Mattermost service is started, but it is still not accessible from the network clients. You have to allow the default service port in Linux firewall, so it can accept incoming traffic from the network clients.

You can use firewall-cmd command for this purpose.

# firewall-cmd --permanent --add-port=8065/tcp
success
# firewall-cmd --reload
success

Accessing Mattermost Web UI

Open URL http://mattermost-02.centlinux.com:8065/ in a web browser.

Mattermost Server – Create Cloud User

Because you are accessing Mattermost web UI for the first time, therefore, it is asking to register your email address and create a user account on the cloud.

Mattermost Team

We need to create a team for collaboration and chatting.

Mattermost Server – Create New Team

Provide a team name and click on “Next>”.

Mattermost Server – Create New Team URL

You team has been created. Note down the team URL and communicate it to your Team members.

Matternost Dashboard

Now, you reach at the Mattermost dashboard. The control is in your hand now, customize the Mattermost chat server according to your requirements.

If you found this guide too advanced then you should buy and read How Linux Works, 2nd Edition: What Every Superuser Should Know Second Edition (PAID LINK) written by Brian Ward.

Final Thoughts

Thank you for considering my service on Fiverr! If you need a reliable and efficient solution for installing Mattermost Server on CentOS 8, look no further. I provide step-by-step guidance to ensure your Mattermost instance is up and running smoothly. Whether you’re setting up for the first time or need expert troubleshooting, I’m here to help.

Ready to get started? Check out my Fiverr gig here and let’s make your Mattermost installation seamless and stress-free!

Exit mobile version