Install Mattermost Server Version on Ubuntu 16.04 | 17.10 | 18.04

We previously showed yoiu how to install Mattermost desktop app on Ubuntu. This post shows you how to install the Mattermost server. You’ll learn how to install MariaDB, download and configure Mattermost server.

Mattermost is an open source alternative to Slack messaging platform. It allows teams to communication and collaboration securely from behind the company’s firewall.

This brief tutorial shows students and new users how to install Mattermost server version on Ubuntu 16.04 | 17.10 | 18.04 LTS server.

Mattermost brings teams together to colloborate on projects so work can get done as quickly and efficiently as possible. Whether you’re a small or large enterprise, Mattermost can help your team communicate and colloborate. and these conversations will be available on the desktop, mobile devices and everywhere you have Mattermost installed.

Mattermost helps you:

  • Discuss topics in private groups, one-to-one or team-wide
  • Easily share and view image files
  • Connect in-house systems with webhooks and Slack-compatible integrations

For more about Mattermost, vist its homepage.

Caution: Mattermost for Linux is in beta. New features are still being added and potention issues still being ironed out.When you’re ready to install Mattermost for Linux follow the steps below:

Step 1: Install MariaDB Database Server

MariaDB database server is a great place to start when looking at open source database servers to use with Mattermost. To install MariaDB run the commands below.

sudo apt update
sudo apt-get install mariadb-server mariadb-client

After installing MariaDB, the commands below can be used to stop, start and enable MariaDB service to always start up when the server boots.

Run these on Ubuntu 16.04 LTS

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service

Run these on Ubuntu 17.10 and 18.04 LTS

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

After that, run the commands below to secure MariaDB server by creating a root password and disallowing remote root access.

sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.

  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat password
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]:  Y
  • Reload privilege tables now? [Y/n]:  Y

Restart MariaDB server

sudo systemctl restart mariadb.service

After installing MariaDB server, continue below to create Mattermost database and datbase user account.

Now that you’ve install all the packages that are required, continue below to start configuring the servers. First run the commands below to create a blank Mattermost database.

Run the commands below to logon to the database server. When prompted for a password, type the root password you created above.

sudo mysql -u root -p

Then create a database called mattermost


Create a database user called mattermostuser with new password

CREATE USER 'mattermostuser'@'localhost' IDENTIFIED BY 'new_password_here';

Then grant the user full access to the database.

GRANT ALL ON mattermost.* TO 'mattermostuser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;

Finally, save your changes and exit.


Step 2: Download and Configure Mattermost Server

After setting up Mattermost, run the commands below to download Mattermost server archive.

cd /tmp && wget

After downloading the archive, run the commands below to extract it. and move it to the /opt directory.

tar -xvzf mattermost*.gz
sudo mv mattermost /opt

Next, create a storage directory for files.

sudo mkdir /opt/mattermost/data

The storage directory will contain all the files and images that your users post to Mattermost, so you need to make sure that the drive is large enough to hold the anticipated number of uploaded files and images.

Next, set up a system user and group called mattermost that will run this service, and set the ownership and permissions. Create the Mattermost user and group by running the commands below:

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 mattermost group:

sudo chmod -R g+w /opt/mattermost

After that, run the commands below to edit Mattermost database connection info.

sudo nano /opt/mattermost/config/config.json

Then make the highlighted changes below and save the file.

"SqlSettings": {
        "DriverName": "mysql",
        "DataSource": "mattermostuser:new_password_here@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=$
        "DataSourceReplicas": [],
        "DataSourceSearchReplicas": [],
        "MaxIdleConns": 20,
        "MaxOpenConns": 300,
        "Trace": false,
        "AtRestEncryptKey": "",
        "QueryTimeout": 30

Save the file.

After that, run the commands below to create a systemd service unit file.

sudo nano /etc/systemd/system/mattermost.service

Then copy and paste the content below into the file and save.




For Ubuntu 16.04, replease mariadb.service with mysql.service.

Next, run the commands below to start Mattermost service.

sudo systemctl daemon-reload
sudo systemctl start mattermost.service
sudo systemctl enable mattermost.service

Now open your browser and browse to the server hostname or IP address followed by port # 8065

You should see Mattermost signup page.

Create an admin account and sign on.

Matter most server

You may also like the post below: