LinuxTutorialsUbuntu

How To Install Mattermost on Ubuntu 18.04 LTS

Install Mattermost on Ubuntu 18.04 LTS

In this tutorial, we will show you how to install Mattermost on Ubuntu 18.04 LTS. For those of you who didn’t know, Mattermost is an open-source, private cloud Slack alternative. A workplace messaging system for web, PCs, and phones, released under the MIT license.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Mattermost on a Ubuntu 18.04 LTS (Bionic Beaver) server.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 18.04.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Mattermost on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First, make sure that all your system packages are up-to-date by running the following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Install LAMP (Linux, Apache, MariaDB, and PHP) server.

A Ubuntu 18.04 LAMP server is required. If you do not have LAMP installed, you can follow our guide here. Also, install all required PHP modules:

apt-get install php7.1-cli php7.1-gd php7.1-opcache php7.1-mysql php7.1-json php7.1-mcrypt php7.1-xml php7.1-curl

Step 3. Installing Mattermost Server on Ubuntu 18.04 LTS.

The first thing to do is to go to Mattermost’s download page and download the latest stable version of Mattermost, At the moment of writing this article it is version 5.1.0:

wget https://releases.mattermost.com/5.1.0/mattermost-5.1.0-linux-amd64.tar.gz

Unpack the Mattermost archive to the document root directory on your server:

tar -xvzf mattermost*.gz
sudo mv mattermost /opt

Next, create a storage directory for files:

sudo mkdir /opt/mattermost/data

Set up a system user and group called Mattermost that will run this service, and set the ownership and permissions:

sudo useradd --system --user-group mattermost
sudo chown -R mattermost:mattermost /opt/mattermost
sudo chmod -R g+w /opt/mattermost

Set up the database driver through the /opt/mattermost/config/config.json file. In it, search for “DriverName” and “DataSource” lines and change them as follows:

"DriverName": "mysql"
"DataSource": "mattermostuser:new_password_here@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=$""

Step 4. Create a systemd unit for Mattermost.

Create a systemd file for Mattermost, /etc/systemd/system/mattermost.service and, in it, paste the following configuration:

nano /etc/systemd/system/mattermost.service

Add the following content:

[Unit]
Description=Mattermost
After=network.target
After=mariadb.service
Requires=mariadb.service

[Service]
Type=notify
ExecStart=/opt/mattermost/bin/mattermost
TimeoutStartSec=3600
Restart=always
RestartSec=10
WorkingDirectory=/opt/mattermost
User=mattermost
Group=mattermost
LimitNOFILE=49152

[Install]
WantedBy=mariadb.service

Next, run the commands below to start the Mattermost service:

systemctl daemon-reload
systemctl start mattermost.service
systemctl enable mattermost.service

Step 7. Accessing Mattermost.

Mattermost will be available on HTTP port 8065 by default. Open your favorite browser and navigate to http://your-domain.com:8065 or http://ip-address:8065 and continue to configure Mattermost by entering an email address and creating an account. If you are using a firewall, please open port 8065 to enable access to the control panel.

Congratulations! You have successfully installed Mattermost. Thanks for using this tutorial for installing Mattermost on your Ubuntu 18.04 LTS (Bionic Beaver) system. For additional help or useful information, we recommend you to check the official Mattermost website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button