Install Mattermost on Centos 7
Mattermost is an open source, self-hosted, team communication platform. There are desktop clients for Windows, MacOS, and Linux and mobile apps for iOS and Android. Mattermost is a better choice for enterprises who want a robust solution with no per-user fees like Slack. When considering the performance point of view, it is having lower CPU usage because they are written in Go and React and hence provide an added advantage based on other competitor chat environments.
Let’s see how we can install Mattermost on Centos 7.
sudo yum update
sudo yum upgrade
1) Install wget
yum install wget
2) Download the MySQL Yum repository from dev.mysql.com.
wget http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
3) Install the Yum repository from the file downloaded
sudo yum localinstall mysql57-community-release-el7-9.noarch.rpm
4) Install MySQL
sudo yum install mysql-community-server
5) Start the MySQL server.
sudo systemctl start mysqld.service
6) Obtain the root password that was generated when you started MySQL for the first time from the below step.
sudo grep 'temporary password' /var/log/mysqld.log [MySQL root password: ************]
7) Change the root password after login with the password that you obtained from the previous step.
mysql -u root -p
8) Change the password. At the mysql prompt, type the following command. Replace *********** with the password that you want to use.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '************';
9) Set MySQL to start automatically when the machine starts.
sudo systemctl enable mysqld
10) Create the Mattermost database user 'mmdbuser'.
mysql> create user 'mmdbuser'@'%' identified by 'mmdbuser-password';
11) Create the Mattermost database.
mysql> create database mattermost;
12) Grant access privileges to the user 'mmdbuser'.
mysql> grant all privileges on mattermost.* to 'mmdbuser'@'%';
Once the above steps are completed we will now install mattermost on the server.
13) Download the latest version of mattermost
wget https://releases.mattermost.com/5.10.0/mattermost-5.10.0-linux-amd64.tar.gz
14) Extract the Mattermost Server files.
tar -xvzf *.gz
15) Move the extracted file to the /opt directory.
sudo mv mattermost /opt
16) Create the storage directory for files.
sudo mkdir /opt/mattermost/data
17) Set up a system user and group called mattermost that will run this service, and set the ownership and permissions.
a)
sudo useradd --system --user-group mattermost
b)
sudo chown -R mattermost:mattermost /opt/mattermost
c)
sudo chmod -R g+w /opt/mattermost
18) Set up the database driver in the file /opt/mattermost/config/config.json. Open the file as root in a text editor and make the following changes:
a) Set "DriverName" to "mysql"
b) Set "DataSource" to the following value, replacing <mmuser-password> and <host-name-or-IP> with the appropriate values. Also make sure that the database name is mattermost instead of mattermost_test:
"mmdbuser:@tcp(:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s"
19) Test the Mattermost server to make sure everything works.
a) Change to the mattermost directory:
cd /opt/mattermost
b) Start the Mattermost server as the user mattermost:
sudo -u mattermost ./bin/mattermost
20) Set up Mattermost to use the systemd init daemon which handles supervision of the Mattermost process.
a) Create the Mattermost configuration file:
sudo touch /etc/systemd/system/mattermost.service
b) Open the configuration file in your favorite text editor, and copy the following lines into the file:
[Unit]
Description=Mattermost
After=syslog.target network.target mysqld.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
c) Make the service executable.
sudo chmod 664 /etc/systemd/system/mattermost.service
d) Reload the systemd services.
sudo systemctl daemon-reload
e) Set Mattermost to start on boot.
sudo systemctl enable mattermost
21) Start the Mattermost server.
sudo systemctl start mattermost
22) Verify that Mattermost is running.
curl http://localhost:8065
If it is running fine then an HTML is returned from the Mattermost server.
In the next article we will see how we can configure Mattermost on Centos 7
https://www.zyxware.com/articles/5943/configuring-mattermost-server-in-centos-7