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.
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.
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.
Next, import the repository key.
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.
Save and exit the file. Then, update Apt.
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.
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.
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.”
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.
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.
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.
Start Mattermost and Connect
With your container built and the directories configured, you can start it up.
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.
After you fill out the info, you can access your server’s system console. This is the admin interface for everything on the server.
Click on your username to return to the team selection screen and create a new team.
First, set a name for your team. These are similar to Slack channels, in case you haven’t guessed.
Then, set your team URL.
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.