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 through the step-by-step installation of Mattermost on a Ubuntu 18.04 LTS (Bionic Beaver) server.
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:
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 file:
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 as follows:
"DriverName": "mysql" "DataSource": "mattermostuser:[email protected](localhost:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=$""
Step 4. Create a
systemd unit for Mattermost.
systemd file for Mattermost,
/etc/systemd/system/mattermost.service and, in it, paste the following configuration:
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 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://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.