How to Set Up Mattermost Slack Alternative on a Ubuntu Server

mattermost-chat-featured

Mattermost is an open-source self-hosted alternative to Slack. It allows you to chat with your team in real time and share files directly. For many teams, Slack has become an indispensable tool. Still, plenty of people would rather have a solution that puts more control in their hands. In that case, Mattermost is easily the best option, and you can count on it for a greater degree of privacy and security.

Install Docker

There are a few ways to install Mattermost on a Linux server, but most of them require a sizable amount of configuration and maintenance. Unless you have a dedicate person or team to maintain your server, that’s probably not the best way to go. Docker, in contrast, is much easier to set up, and the Mattermost developers officially support Docker as a way to install and run your server.

Also read: Top 4 Slack Alternatives You Should Check Out Now to Reduce Your Cost

Add The Docker Repository

The Docker versions available in Ubuntu tend to be outdated or fall out of date. Thankfully, the Docker developers provide a repository with the latest packages ready to install. Begin by installing the requirements to set up the repository.

sudo apt install apt-transport-https ca-certificates curl software-properties-common

Next, import the repository key.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Docker Repository

Create a new file for your repository configuration at “/etc/apt/sources.list.d/docker.list,” and open it with your preferred text editor. Place the following line in the file, assuming you’re using Ubuntu Bionic.

deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable

Save and exit the file. Then, update Apt.

sudo apt update

Install Docker and Git

You’re ready to install Docker with Apt. You’re also going to need Git for the next part, so install that, too, if you don’t already have it.

sudo apt install docker-ce docker-compose git

Docker Running

Docker starts as soon as the install is done.

Download the Container

For this next part you’re going to clone the latest Docker container from Git. Pick a directory where you want to download the files, and cd into it.

cd ~/Downloads
git clone https://github.com/mattermost/mattermost-docker.git

The download will take a few seconds. You can watch the progress in your terminal window.

Edit the Configuration

You’ll find all of the configuration for your Mattermost Docker container in the mattermost-docker folder that you just downloaded. The file is called “docker-compose.yml.”

Mattermost Directory Listing

Under the “app:” heading, uncomment the “args:” and “-edition=team” lines. If you want to change the user running it, you’re free to uncomment and change those lines too.

Mattermost Container Configuration

Under the “web:” section you can change the ports that Mattermost uses to listen. By default, it uses the normal web ports. If your server is only running Mattermost, this won’t be a problem.

Build the Container

Change directories into your container folder, if you haven’t already. Then, build the container.

cd mattermost-docker
sudo docker-compose build

Build Mattermost Container

It might take some time, but when the build is finished, you’ll be a few short steps from your Mattermost server.

Set up your server data directories and change the permissions so your server can actually use them.

mkdir -pv ./volumes/app/mattermost/{data,logs,config}
sudo chown -R 2000:2000 ./volumes/app/mattermost/

Also read: How to Set Up an Email Server in Ubuntu

Start Mattermost and Connect

With your container built and the directories configured, you can start it up.

sudo docker-compose up -d

Open your browser, and navigate to your server’s address and the port number that you configured. If everything went well, you’ll be greeted with a welcome page. That page lets you create your admin account. Fill out everything to get your account.

Create Mattermost Account

After you fill out the info, you can access your server’s system console. This is the admin interface for everything on the server.

Mattermost System Console

Click on your username to return to the team selection screen and create a new team.

Mattermost Create Team

First, set a name for your team. These are similar to Slack channels, in case you haven’t guessed.

Set Mattermost Team URL

Then, set your team URL.

Mattermost Team Page

When you finalize the team setup, you’ll be taken to your team’s chat screen. The layout should immediately feel familiar.

You can now run and manage Mattermost through Docker. You can keep it updated and running as long as you need. Everything is contained and independent of your system. For production use, you may want to configure your server for additional security and possibly establish a firewall as well.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Nick Congleton

Nick is a freelance tech. journalist, Linux enthusiast, and a long time PC gamer.