This article is outdated and may not work correctly for current operating systems or software.
Mattermost is an open source, self-hosted alternative to the Slack SAAS messaging service. In other words, with Mattermost, you can setup a private and dedicated messaging server on your own machine for your team.
mattermost.example.comthat has been configured to point to the
203.0.113.1server instance. You can learn more details about this in another Vultr tutorial.
Use the following commands to update your packages.
sudo apt update sudo apt upgrade
As required by Mattermost, you need to setup a database to store all the data for Mattermost. For that purpose, we will install MySQL.
Use the following command to install MySQL Server.
sudo apt install mysql-server
It will prompt you to choose a password for the root MySQL account,
Then, login to MySQL as root.
mysql -u root -p
Create the Mattermost user
mysql> create user 'mmuser'@'%' identified by 'mmuser-password';
Note: Change the password
mmuser-password to something more secure.
Create the Mattermost database.
mysql> create database mattermost;
Grant access privileges to the user
mysql> grant all privileges on mattermost.* to 'mmuser'@'%';
Finally, log out of MySQL.
Download and extract the Mattermost 5.2 archive.
cd wget https://releases.mattermost.com/5.2.0/mattermost-5.2.0-linux-amd64.tar.gz tar -zxvf mattermost-5.2.0-linux-amd64.tar.gz
Move all Mattermost files to the
/opt directory, and then create a subdirectory
/opt/mattermost/data to store program data.
sudo mv mattermost /opt sudo mkdir /opt/mattermost/data
Create a dedicated user
mattermost and a dedicated group
mattermost for running Mattermost.
sudo useradd --system --user-group mattermost
Set the user and group
mattermost as the owner of the Mattermost files.
sudo chown -R mattermost:mattermost /opt/mattermost
Give write permissions to the
sudo chmod -R g+w /opt/mattermost
Set up the database driver in the file
Open the file.
Find these lines.
"SiteURL": "", "ListenAddress": ":8065", "DataSource": "mmuser:mostest@tcp(dockerhost:3306)/mattermost_test?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s",
Replace them with the lines below.
"SiteURL": "http://mattermost.example.com", "ListenAddress": ":80", "DataSource": "mmuser:<mmuser-password>@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s",
DriverName is set to
mysql then set
DataSource to the following value, replacing
<mmuser-password> with the appropriate value. Also make sure that the database name is
mattermost instead of
Then exit by pressing CTRL+X and then Y to save.
Allow Mattermost to bind to privileged ports, for example,
cd /opt/mattermost/bin sudo setcap cap_net_bind_service=+ep ./platform sudo setcap cap_net_bind_service=+ep ./mattermost
Create the Mattermost
systemd unit file and open it using nano as root.
Populate it with the following.
[Unit] Description=Mattermost After=syslog.target network.target mysqld.service [Service] Type=simple WorkingDirectory=/opt/mattermost/bin User=mattermost ExecStart=/opt/mattermost/bin/platform PIDFile=/var/spool/mattermost/pid/master.pid LimitNOFILE=49152 [Install] WantedBy=multi-user.target
Modify permissions on this
systemd unit file.
sudo chmod 664 /etc/systemd/system/mattermost.service
Start the Mattermost service and make it automatically start on system boot.
sudo systemctl daemon-reload sudo systemctl start mattermost.service sudo systemctl enable mattermost.service
Finally, point your favorite web browser to
https://mattermost.example.com, and you will see the
Mattermost Sign Up page.
Mattermost Sign Up page, input an
email address, a
username, and a
password, and then click the
Create Account button to register the first user.
Note: Be aware that the first user you register will also be the system administrator.
Team Name page and the
Team URL page, input a
team name and a
URL for your first team.
You have now successfully setup a Mattermost messaging server which is robust enough to serve a small or mid-sized team in a production environment. Feel free to explore the interface of Mattermost and invite more team members.