How To Install Mattermost on CentOS 7

r00t March 29, 2017

Install Mattermost on CentOS 7

In this tutorial we will show you how to install and configuration of Mattermost on CentOS 7 server. 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.

As an alternative to proprietary SaaS messaging, Mattermost brings all your team communication into one place, making it searchable and accessible anywhere. Mattermost is “Slack-compatible, not Slack-limited”, supporting a superset of Slack’s incoming and outgoing webhook integrations, including compatibility with existing Slack integrations. From your existing Slack teams, you can import users, public channel history and even theme setting colors into Mattermost.

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 Mattermost on a CentOS 7 server.

Install Mattermost on CentOS 7

Step 1. First let’s start by ensuring your system is up-to-date.

Step 2. Installing MySQL database.

Install and set up the database for use by the Mattermost server. You can install  MySQL using command below:

Next, install MySQL:

Start the MySQL server:

Configuring MySQL for SugarCRM.

By default, MySQL is not hardened. You can secure MySQL using the mysql_secure_installation script. you should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MySQL:

Configure it like this:

Next we will need to log in to the MySQL console and create a database for the Mattermost. Run the following command:

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Mattermost installation:

Step 3. Installing Mattermost Server.

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 3.6.2:

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

Create the storage directory for files:

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

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:

Save, exit, and test the Mattermost Server with the following command:

When the server starts, it shows some log information and the text Server is listening on :8065. You can stop the server by pressing CTRL+C in the terminal window.

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:

Make the service executable:

And reload the services:

Enable Mattermost service:

And start it with systemd:

Step 5. Installing and configure NGINX.

In a production system, use a proxy server in front of Mattermost Server. In this case, NGINX. The main benefits of doing this are:

  • SSL termination
  • Port mapping :80 to :8065
  • HTTP to HTTPS redirect
  • Standard request logs

In order to install NGINX on CentOS 7, create a yum repository file, /etc/yum.repos.d/nginx.repo, with the following content:

Install Nginx using YUM command:

After the installation is complete, start NGINX:

Configuration Nginx.

In order to configure NGINX as proxy server, create the file /etc/nginx/sites-available/mattermost and past:

Remove the existing default sites-enabled file:

Enable the mattermost configuration:

Finally, restart Nginx service:

Step 7. Accessing Mattermost.

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

Congratulation’s! You have successfully installed Mattermost. Thanks for using this tutorial for installing Mattermost on CentOS 7 system. For additional help or useful information, we recommend you to check the official Mattermost web site.

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 a best deal!

Save

Share on Google+0Share on Facebook2Tweet about this on TwitterShare on Tumblr0Share on StumbleUpon1Share on Reddit1Pin on Pinterest2
The Tags:

Leave a Comment