By clicking or navigating this website site, you agree to allow our collection of information on Scaleway to offer you an optimal user experience and to keep track of statistics through cookies. Learn more about our Cookie Policy.

Installing Mattermost Messaging on Ubuntu 18.04

Mattermost Overview

Mattermost is an open-source messaging tool for inter-team communication, released under the MIT license and available both in a free team and paid enterprise edition. This tutorial will show you how to install a Mattermost instance with a NGINX frontend proxy and a MariaDB database.

Important: This directory will contain all data sent to your Mattermost instance (Messages, Images, Files etc.). Make sure that it has enough space available for the anticipated number of contents sent to your instance.

14 . Set up a system user and group to be in charge of running the service and set the ownership and permissions as following:

Create a system user and group called mattermost:

useradd --system --user-group mattermost

Set the ownership of the Mattermost files to the previously created user and group:

chown -R mattermost:mattermost /opt/mattermost

Give write permissions to the mattermost group:

chmod -R g+w /opt/mattermost

15 . Open the file /opt/mattermost/config/config.json with your favourite text editor and edit the database settings as following:

Set the "DriverName" to mysql

Configure "DataSource" as following, replacingwith the password you have set for your database:

During startup the database structure of Mattermost will be configured and you will see some log messages as well as a notice: Server is listening on :8065. This means your Mattermost server is now ready to be used. Stop the process by pushing Control+C on your keyboard.

17 . Open your favourite text editor and create the file /lib/systemd/system/mattermost.service with the following content to create a systemd script to run the application as a service on your instance:

20 . Enable the service to start Mattermost during the startup of the instance:

systemctl enable mattermost.service

You can now connect to your Mattermost server at http://your_servers_ip:8065 and create your first user and do some initial configuration and setup.

Installing a Nginx Proxy with Let's Encrypt

For security reasons it is recommended to put the application behind a proxy. Nginx is being used as frontend for the application. To provide an encrypted connection, certbot is used to generate a free Let’s Encrypt SSL certificate to encrypt the connection to the instance.

1 . Install Nginx and Certbot:

apt install nginx python-certbot-nginx -y

2 . Create a new server block for Mattermost (replace mattermost.example.com with the FQDN of your instance):