Hello, friends in this post you will learn how to install Mattermost on Ubuntu 20.04. These steps I’m going to describe are easy to follow and you should have no problems to achieve the installation.
Mattermost is a high trust, open source collaboration platform built for developers.
Therefore we are talking about an open-source alternative to Slack. It is a very useful program for work groups and is focused on developers and DevOPS. Although it is easily installable and applicable to other groups.
Mattermost is the leading open-source collaboration platform with a thriving community. It’s written in Golang and React and runs as a single Linux binary with MySQL or PostgreSQL. Use the features you like, for example, file sharing, real-time group chat, and webhooks, with full access to source code.
Installing Mattemost on Ubuntu 20.04
Open a terminal or start an SSH session and install some necessary packages:
sudo apt install wget curl nano
And then be sure to define your computer’s hostname
sudo hostnamectl set-hostname [your-hostname]
For example:
sudo hostnamectl set-hostname chat.osradar.test
With these packages already installed we can start with the configurations and installations.
1.- Install MariaDB on Ubuntu 20.04
Mattermost is an application that requires a relational database manager. The application supports two that are PostgreSQL and MySQL / MariaDB. In this post, we will choose MariaDB.
So, install MariaDB by executing the following command:
sudo apt install mariadb-server
After configuring, MariaDB using the mysql_secure_installation
script
sudo mysql_secure_installation
And define the root password and then answer the configuration questions to improve the security of MariaDB.
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]
Then, access the MariaDB shell:
sudo mysql -u root -p
It then creates the database that Mattermost will use. It is also recommended to create a new user and give them the corresponding permissions.
CREATE DATABASE matterdb;
GRANT ALL PRIVILEGES ON matterdb.* TO 'matteruser'@'localhost' IDENTIFIED BY 'matterpss';
FLUSH PRIVILEGES;
exit;
Replace the values with your own. Remember that the password must be strong and safe.
2.- Download Mattermost on Ubuntu 20.04
Now comes the installation process. To do this, first, add a user to the system that is going to use the application.
sudo useradd --system --user-group mattermost
Substitute mattermost for the name you want.
Now you can download the program with the help of the wget command.
wget https://releases.mattermost.com/5.29.1/mattermost-5.29.1-linux-amd64.tar.gz --2020-12-11 14:56:08-- https://releases.mattermost.com/5.29.1/mattermost-5.29.1-linux-amd64.tar.gz Resolving releases.mattermost.com (releases.mattermost.com)… 13.227.41.126, 13.227.41.58, 13.227.41.129, … Connecting to releases.mattermost.com (releases.mattermost.com)|13.227.41.126|:443… connected. HTTP request sent, awaiting response… 200 OK Length: 183825462 (175M) [application/x-gzip] Saving to: ‘mattermost-5.29.1-linux-amd64.tar.gz’ mattermost-5.29.1-linux-amd64.tar.gz 100%[=====================================================================================>] 175.31M 1.04MB/s in 3m 15s 2020-12-11 14:59:25 (920 KB/s) - ‘mattermost-5.29.1-linux-amd64.tar.gz’ saved [183825462/183825462]
At the time of writing this post, the latest stable version is 5.29.1 I recommend you to visit the project website to check which is the latest stable version.
Then, decompress the downloaded file.
tar xvf mattermost-5.29.1-linux-amd64.tar.gz
Move the generated folder to another location as /opt/
sudo mv mattermost /opt
It creates a folder called data within the mattermost directory.
sudo mkdir /opt/mattermost/data
And assign the corresponding permissions and also make mattermost the owner of it.
sudo chown -R mattermost:mattermost /opt/mattermost
sudo chmod -R g+w /opt/mattermost
Now it is time to configure the Mattemost instance with the parameters of the database created.
So, open the Mattermost configuration file
sudo nano /opt/mattermost/config/config.json
And in the SQLSettings section, leave the DriverName and DataSource lines as follows:
"DriverName": "mysql",
"DataSource": "matteruser:matterpss@tcp(localhost:3306)/matterdb?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s",
Remember to replace the displayed values with your parameters. Save the changes and close the editor.
Also, it is recommended to create a new service to manage Mattermost with the command systemctl
To do this, create a new service entry
sudo nano /etc/systemd/system/mattermost.service
And add the following content
[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
Remember that if you used a different location, you have to reflect it in the file. When you are done, save your changes and close the editor.
Reload the list of services
sudo systemctl daemon-reload
Initial and enable
sudo systemctl start mattermost.service
sudo systemctl enable mattermost.service
And check the status of the service
sudo systemctl status mattermost.service ● mattermost.service - Mattermost Loaded: loaded (/etc/systemd/system/mattermost.service; disabled; vendor preset: enabled) Active: active (running) since Fri 2020-12-11 15:26:28 UTC; 17s ago Main PID: 4674 (mattermost) Tasks: 9 (limit: 846) Memory: 47.9M CGroup: /system.slice/mattermost.service └─4674 /opt/mattermost/bin/mattermost Dec 11 15:26:28 chat.osradar.test mattermost[4674]: {"level":"info","ts":1607700388.38535,"caller":"app/server.go:450","msg":"Current version is 5.29.0 (5.29.1/Thu Dec > Dec 11 15:26:28 chat.osradar.test mattermost[4674]: {"level":"info","ts":1607700388.3856661,"caller":"app/server.go:459","msg":"Enterprise Build","enterprise_build":tru> Dec 11 15:26:28 chat.osradar.test mattermost[4674]: {"level":"info","ts":1607700388.38594,"caller":"app/server.go:465","msg":"Printing current working","directory":"/op> Dec 11 15:26:28 chat.osradar.test mattermost[4674]: {"level":"info","ts":1607700388.38616,"caller":"app/server.go:466","msg":"Loaded config","source":"file:///opt/matte> Dec 11 15:26:28 chat.osradar.test mattermost[4674]: {"level":"info","ts":1607700388.4489672,"caller":"sqlstore/post_store.go:1688","msg":"Post.Message has size restrict> Dec 11 15:26:28 chat.osradar.test mattermost[4674]: {"level":"info","ts":1607700388.554504,"caller":"bleveengine/bleve.go:267","msg":"UpdateConf Bleve"} Dec 11 15:26:28 chat.osradar.test mattermost[4674]: {"level":"info","ts":1607700388.7032015,"caller":"app/server.go:878","msg":"Starting Server…"} Dec 11 15:26:28 chat.osradar.test mattermost[4674]: {"level":"info","ts":1607700388.706344,"caller":"app/server.go:955","msg":"Server is listening on [::]:8065","addres> Dec 11 15:26:28 chat.osradar.test mattermost[4674]: {"level":"info","ts":1607700388.706892,"caller":"commands/server.go:112","msg":"Sending systemd READY notification."} Dec 11 15:26:28 chat.osradar.test systemd[1]: Started Mattermost.
3.- Install Mattermost on Ubuntu 20.04
Now, you can open your web browser and go to http://ip-server:8065
On this screen, create the user administrator along with their password
Then you can create a new team.
Define the name of the new team and click on Next.
After that, you will be given the URL of the team and you can finish the installation.
And you will see the dashboard.
Conclusion
Mattermost is an important technology that comes to rival Slack and becomes a serious alternative. It is opensource with all the advantages it has.