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:
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:
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:
These two lines should look exactly like this (replacing PASSWORD with the password you set for the database user mmuser):
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).
Fill in the required information and click Create Account. Next, you will be prompted to name your organization (Figure B).
Click Continue and then, when prompted, confirm the server URL (Figure C) and click Continue.
Click Continue, then select how you plan to use Mattermost (Figure D).
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).
Click Continue to complete the installation.
Finally, you will be asked to create your first Mattermost channel (Figure F).
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).
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.