How To Do A Full Install Of Mattermost On Ubuntu Server 22.04

Image: Getty Images/iStockphoto

Recently, I covered two different paths for deploying Mattermost on your network. The first method was through a TurnKey Linux virtual appliance and the second was installing a newer version of the platform (which included kanban boards and playlists) using Docker.

TO SEE: 40+ open source and Linux terms you need to know (TechRepublic Premium)

This time, however, we are going to do a full install of Mattermost on Ubuntu Server 22.04. For anyone who wants a production-ready instance of Mattermost, this is the way to go. Let’s dive in and set up this amazing open source collaboration tool.

What you will need

The only two things you’ll need to install Mattermost this way are a running instance of Ubuntu Server 22.04 (although it will also work on Ubuntu 20.04) and a user with sudo privileges. That’s all, let’s put this tool to work.

How to Install MySQL Database Server

The first thing to do is to install the necessary database server (Mattermost can be run with MySQL or PostgreSQL). Connect to Ubuntu Server and install MySQL database server with:

sudo apt-get install mysql-server -y

Once the installation is complete, secure the database server with:

sudo mysql_secure_installation

Be sure to set a strong password for the admin user and answer the remaining questions there.

Start and activate the database server with the following commands:

sudo systemctl start mysqld

sudo systemctl enable mysql

How to create database and user

Connect to the MySQL console with the command:

sudo mysql -u root -p

Create the required database with:


Create the new user with:


Where PASSWORD is a strong/unique password.

Grant the necessary permissions to the new database with:

GRANT ALL PRIVILEGES ON mattermost.* TO 'mmuser'@'localhost';

Dump privileges and exit the console with:



How to download and extract Mattermost

Download the latest version of Mattermost (be sure to check that you have downloaded the latest version) with the command:

wget wget

Unzip the file with:

tar -xvzf mattermost*.gz

Move the newly created directory with the command:

sudo mv mattermost /opt

Create a storage directory with:

sudo mkdir /opt/mattermost/data

How to create a new user and set appropriate permissions

Create a new Mattermost user and group with the command:

sudo useradd --system --user-group mattermost

Now we need to set the Mattermost directory to be owned by the most important user and group with:

sudo chown -R mattermost:mattermost /opt/mattermost

Finally, set the appropriate permissions with:

sudo chmod -R g+w /opt/mattermost

How to configure Mattermost server for database

Open the Mattermost configuration file with:

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

In this file, look for two lines starting with:


These two lines should look exactly like this (replacing PASSWORD with the password you set for the database user mmuser):

"DriverName": "mysql",
"DataSource": "mmuser:PASSWORD@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8u0026readTimeout=30su0026writeTimeout=30s",

Save and close the file.

How to create a systemd boot file

It’s time to create a systemd boot file for Mattermost. Create the file with the command:

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

Paste the following content into this file:


Reload the systemd daemon with:
sudo systemctl daemon-reload
Start and activate the service with:
sudo systemctl enable --now mattermost

How to complete the installation

We can now complete the installation by logging into the web interface at http://SERVER:8065 (where SERVER is the IP address or domain of the hosting server). You should be greeted with the initial account creation window (Figure A).

Figure A

Your Mattermost instance is almost complete.
Your Mattermost instance is almost complete.

Fill in the required information and click Create Account. Next, you will be prompted to name your organization (Figure B).

Figure B

Name your organization with the Mattermost configuration tool.
Name your organization with the Mattermost configuration tool.

Click Continue and then, when prompted, confirm the server URL (Figure C) and click Continue.

Figure C

You must confirm the server URL before continuing.
You must confirm the server URL before continuing.

Click Continue, then select how you plan to use Mattermost (Figure D).

Figure D

How will you use Mattermost?
How will you use Mattermost?

Make your selection and click Continue. You will then be asked if you want to connect any third-party tools available to your Mattermost instance (Figure E).

Figure E

You can skip this step for now and come back to it later.
You can skip this step for now and come back to it later.

Click Continue to complete the installation.

Finally, you will be asked to create your first Mattermost channel (Figure F).

Figure F

Add a channel to your Mattermost instance.
Add a channel to your Mattermost instance.

Type a name for the channel and click Continue. You can then invite members to the instance by copying the invite link and clicking Finish Setup, which will launch your workspace where you’ll be ready to get started in the business (G-figure).


Our Mattermost deployment is complete.
Our Mattermost deployment is complete.

Congratulations, you’ve just deployed Mattermost on Ubuntu Server for a complete collaboration platform that will empower your teams to do great things.

Subscribe to TechRepublic How to make technology work on YouTube for all the latest tech tips for professionals from Jack Wallen.


About Author

Comments are closed.