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

0
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 DATABASE mattermost;

Create the new user with:

CREATE USER 'mmuser'@'localhost' IDENTIFIED BY 'PASSWORD';

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:

FLUSH PRIVILEGES;

exit

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 https://releases.mattermost.com/6.6.0/mattermost-6.6.0-linux-amd64.tar.gz

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:

"DriverName":
"DataSource":

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:

[Unit]
Description=Mattermost
After=network.target
After=postgresql.service
BindsTo=postgresql.service
[Service]
Type=notify
ExecStart=/opt/mattermost/bin/mattermost
TimeoutStartSec=3600
KillMode=mixed
Restart=always
RestartSec=10
WorkingDirectory=/opt/mattermost
User=mattermost
Group=mattermost
LimitNOFILE=49152
[Install]
WantedBy=multi-user.target

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).

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.

Share.

About Author

Comments are closed.