Guide to install Mattermost server on Almalinux 8. This time using a self-hosted server. Mattermost is an opensource tool for an alternative to Slack.
Before starting the installation, make sure your Almalinux 8 has been upgraded to the latest version.
Using a self-hosted Mattermost server has a choice of 2 database options. That is either MySQL or PostgreSQL. However, this tutorial will use MySQL MariaDB.
Install MariaDB 10.5
First install MariaDB 10.5. Install from the MariaDB repository.
# vi /etc/yum.repos.d/mariadb.repo
Then copy and paste the following
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.5/rhel8-amd64 module_hotfixes=1 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
If so, update.
# dnf update
Then continue to install MariaDB for version 10.5
Then make sure that it auto starts up and runs when the server is restarted. Then start MariaDB.r
# dnf install mariadb-server # systemctl enable --now mariadb
Then it's time to configure mysql for the first time.
# mysql_secure_installation # Switch to unix_socket authentication [Y/n] # Change the root password? [Y/n] # Remove anonymous users? [Y/n] # Disallow root login remotely? [Y/n] # Remove test database and access to it? [Y/n] # Reload privilege tables now? [Y/n]
Because we will use a MySQL type database, we must first create a database so that it will be used by Mattermost.
#mysql -u root -p CREATE DATABASE matterdb; GRANT ALL PRIVILEGES ON matterdb.* TO 'matteruser'@'localhost' IDENTIFIED BY 'passwordmatters'; FLUSH PRIVILEGES; exit;
Thus the database that will be used is matterdb with the password passwordmatters. In this case it is very important that you use a password that is at least 12 characters long plus a combination of letters, numbers, and symbols.
Install Mattermost
Make sure wget is installed on your server.
# yum install wget -y
Download the latest version of Mattermost.
# wget https://releases.mattermost.com/7.2.0/mattermost-7.2.0-linux-amd64.tar.gz # tar -xvzf mattermost*.gz # mv mattermost /opt # mkdir /opt/mattermost/data
Then create a system group that will run this service. Make sure the user group is the same, namely mattermost, and finally, give the folder write permission.
# useradd --system --user-group mattermost # chown -R mattermost:mattermost /opt/mattermost # chmod -R g+w /opt/mattermost
Modify the database setup in /opt/mattermost/config/config.json
Change the following lines accordingly
"DriverName": "mysql", "DataSource": "matteruser:passwordmatters@tcp(localhost:3306)/matterdb?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s",
Then create a new service entry.
vi /etc/systemd/system/mattermost.service
Fill in the config contents as below:
[Unit] Description=Mattermost After=network.target After=mariadb.service Requires=mariadb.service [Service] Type=notify ExecStart=/opt/mattermost/bin/mattermost TimeoutStartSec=3600 Restart=always RestartSec=10 WorkingDirectory=/opt/mattermost User=mattermost Group=mattermost LimitNOFILE=49152 [Install] WantedBy=multi-user.target
Then we reload everything.
# systemctl daemon-reload # systemctl enable mattermost # systemctl start mattermost
Make sure the MySQL service is started and you can now access Mattermost on port 8065. For example:
When accessed, you will need to setup the first time. Make sure to use a strong password, which is a combination of letters, numbers, and symbols with at least 8 characters.
Then you can refer to the Mattermost basic setup for more detailed guidance.