- Advertisement -


Mattermost is a workplace messaging system for web, PCs and phones. It’s an open source alternative to Slack.
A complete Mattermost installation consists of three components: the Mattermost server, a proxy server, and a database server. Each component can be installed on the same machine, or on three different machines on the local network.
This tutorial explains how to install Mattermost Team Edition on an Ubuntu 16.04 with Nginx as your proxy server and PostgreSQL as your database.

Install PostgreSQL

On the server that will host the database, execute the following command:

During the installation process a new user, “postgres”, will be created. So, at the end, log in with the command:

Start the PostgreSQL shell:

- Advertisement -

Create a new database:

Log out of this account, and allow PostgresSQL to listen on all assigned IPs, editing the file /etc/postgresql/9.3/main/postgresql.conf

There, find line #listen_addresses = 'localhost'

Uncomment it and change ‘localhost’ to ‘*’; so, after editing: listen_addresses = *

Reload the database with:

Now that the database is installed, it’s time to install the Mattermost Server.

Install Mattermost Server

Download the latest version of the Mattermost Server with wget. Right now, this is 3.6.2:

Extract the archive, and move to a different folder; for instance, in this example Mattermost will be stored on /opt:

Create a storage directory, named “data”, in this folder:

The storage directory will contain all the files and images that users post to Mattermost, so it’s necessary that the drive that contains it is large enough.

Next, create a new user and a new group both named mattermost:

Set the user and group mattermost as the owner of the Mattermost files with the command:

Give the permissions to the Mattermost group:

Next, set up the database driver:

In that file, in the “SqlSettings” section, change “DriverName” and “DataSource” lines as follows:

Save and exit. Test the configuration, using “mattermost” user:

You will see that Mattermost is running on Stop it with CTRL+C.

Next, create a new mattermost service file for systemd:

And paste into this file the following text:

Save and exit. Then:

Now, start the service:

Install Nginx

Install Nginx and configure Nginx as the reverse proxy for Mattermost. First:


Generate a new self-signed SSL certificate file:

These will create a new certificate and change its permissions.

Next, create a new configuration file for mattermost in /etc/nginx/sites-available:

and paste in it:

Make sure to customize values for the Mattermost server IP address and FQDN for server_name.

Save, exit and activate the virtual host:

Test the configuration with:

and then restart it, like this:

Testing and conclusion

Last thing to do is a “graphical” configuration. With a web browser, go to URL mattermost.example.com.

There, create a new account. A dashboard will appear in which it’s possible to create new teams and/or access the admin/system console.

That’s all that is required for installing the messaging infrastructure for Mattermost.

- Advertisement -

There are no comments yet

  • Hello, guest