قالب وردپرس درنا توس
Home / How To / How to install Mattermost Team Messaging System on Debian 10

How to install Mattermost Team Messaging System on Debian 10



Mattermost is an open source messaging system written in the programming languages ​​Golang and React. It's a slack option, we can use it to build our own messaging service like slack or hipchat with it.

Mattermost takes your team communication with you to a single place and makes it available anywhere. You can access it from your desktop, Android device and iPhone.

In this tutorial we will show you how to install Mattermost on Debian Buster 10. We will install Mattermost with the MySQL database server, Nginx web server and run Mattermost as a Systemd service on the latest Debian version Buster 10.

Prerequisite

For this tutorial, we test the Mattermost installation on Debian 10 with 2 GB Frame, 25 free disk space and 2 CPU. [19659004] What to do?

  • Install MySQL Server
  • Create MySQL database for Mattermost
  • Add system users and download Mattermost
  • Configure Mattermost
  • Setup Mattermost as a Systemd service
  • Generate SSL Letsencrypt [19659008] and configure Nginx as a reverse proxy
  • Testing

Step 1 – Install MySQL Database

First, we will install MySQL Server 8.0 from the official archive to our Debian server. Q, we will add the official MySQL layer and install the MySQL packages.

Install the & # 39; gnupg2 & # 39; to the Debian server using the apt command below.

  sudo apt install curl wget gnupg2 

Download and add MySQL repository for the Debian system with the following command.

  wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.debebrit19459025.d.dpkg -i mysql-apt-config_0. 8.13-1_all.deb 

Now update all Debian archives and install MySQL Server packages.

  sudo apt update 
sudo apt install mysql-server-y [19659019] During the MySQL Server installation, you are prompted to configure the root password for your MySQL server .

Write your root password for MySQL and repeat it.

 Set MySQL password

When the installation is complete, launch MySQL service and add it to

  systemctl start mysql 
systemctl enable mysql [19659019] As a result, MySQL Server now installed on Debian Buster 10. And MySQL Server root password is configured.

 Start MySQL

Step 2 - Create MySQL database for Mattermost

By default, Mattermost supports two database drivers, PostgreSQL and MySQL databases. And for this tutorial, we will use MySQL as the default database for Mattermost.

In this step we create a new database and users for the Mattermost installation.

Log on to the MySQL shell with your root user and password as below.

  mysql -u root -p 

Now create a new database and user for Mattermost. We will create a new database & # 39; most important & # 39; with the user & # 39; mmuser & # 39; and the password & # 39; mmuser password & # 39 ;.

  create database most important; 
create user [email protected] identified with "mmuser password";
grant all privileges most importantly. * Till [email protected];
flush privileges;

Now type "exit" to log out of the MySQL shell.

 Creating Database for Mattermost [19659017] And as a result, the MySQL database and the user for the Mattermost installation have been created.

Step 3 - Add users and download Mattermost

In this step we create a new system user and download the Mattermost source code. The Mattermost software will run under the user named & # 39; mattermost & # 39; it will be installed in & # 39; / opt / mattermost & # 39; directory.

Create a new system user named "mattermost" with the command below. Advertising

  useradd - system - user-group mattermost 

Now go to directory & # 39; / opt & # 39; and download the Mattermost source code using the lid command below.

  cd / opt / 
curl -o mattermost.tar.gz https://releases.mattermost.com/5.21.0/mattermost-5.21.0-linux-amd64.tar.gzebrit19659019] Extract the Mattermost source code and create a new "data directory".

  tar -xf mattermost.tar.gz 
mkdir -p / opt / mattermost / data

Then change ownership of "/ opt / mattermost & # 39; directory to & # 39; mattermost & # 39;

  chown -R mattermost: mattermost / opt / mattermost 
chmod -R g + w / opt / mattermost

As a result, the "most important" user has been created and the Mattermost source code has been downloaded to directory & # 39; / opt / mattermost & # 39;.

 Add a Linux system user for Mattermost

Step 4 - Configure Mattermost

In this step, set Mattermost to listen address and database The Mattermost service runs on the local IP address of standard port 8065 and uses MySQL as the database system.

Go to the & # 39; / opt / mattermost & # 39; directory and edit the configuration file & # 39; config. json & # 39; i & # 39; config "directory.

  cd / opt / mattermost / 
vim config / config.json

In the "ListAddress" option, change the IP address to & # 39; 127.0.0.1 & # 39;

  "ListenAddress": "127.0.0.1:8065 ",ebrit19659019 ?? A "SqlSettings", change the driver name to "mysql" and change "DataSource" with the MySQL database and the user we created. 

  "SqlSettings": {
"DriverName": "mysql",
"DataSource": "dbuser: [email protected] (localhost: 3306) / dbname? Charset = utf8mb4, utf8 u0026readTimeout = 30s u0026writeTimeout = 30s ",

Save and close. Ads

Then initiate the Mattermost installation with the following command.

  sudo - u mattermost ./bin/mattermostebrit19659019??When below is the result you will get. 

 Configuring Mattermost

As a result, Mattermost is running on the local IP address & # 39; 127.0. 0.1 & # 39; with the port & # 39; 8065 & # 39 ;, now press & # 39; Ctrl + c & # 39; to exit.

Step 5 - Setting Mattermost as a service

In this step, we will set Mattermost as a system d service, and it runs automatically at system startup after MySQL database service is run.

Now go to directory & # 39; / lib / systemd / system & # 39; and create a new service file & # 39; mattermost.serv is & # 39 ;.

  cd / lib / systemd / system / 
vim mattermost.service

Paste the following configuration into it.

  [Unit] 
Description = Mattermost
After = network .target
After = mysql.service
Requires = mysql.service [Service]
Type = message
ExecStart = / opt / mattermost / bin / mattermost
TimeoutStartSec = 3600
Restart = always
RestartSec = 10
WorkingDirectory = / opt / mattermost
User = mattermost
Group = mattermost
LimitNOFILE = 49152

[Install]
WantedBy = multi-user.target

Save and close.

Then reload the systemd manager on the Debian system.

  systemctl daemon-reload 

Then start the Mattermost service and add it to the system startup.

  systemctl start mattermost 
systemctl enable mattermost

 Creating Systemd unit file

The Mattermost service is up, check it with the following command.

  systemctl status mattermost 

Below is the result you will get.

 Checking Service Status

As a result, the Mattermost service is up and running on the Debian system, and it will run automatically at system startup.

Step 6 - Install Certbot Letsencrypt

In this step we install the certbot tool and generate SSL Letsencrypt. We will secure the Mattermost installation with SSL from Letsencrypt.

Install the certbot utility with the apt command below.

  sudo apt install certbot 

When the installation is complete, generate the SSL song crypt using the certbot command below.

  certbot certonly - standalone --agree-tos -m [email protected] -d mattermost.hakase-labs.io 

As a result, your SSL certificates will be generated on & # 39; / etc / letsencrypt / live /mattermost-hakase-labs.io & # 39;.

Step 7 - Install and configure Nginx as a reverse proxy

In this step we will install the Nginx web server and set it as a reverse proxy for Mattermost service.

Install Nginx with the apt command below.

  sudo apt install nginx-y 

When the installation is complete, start the Nginx service and add it to the system boot. Ads

  systemctl start nginx 
s ystemctl enable nginx

Nginx web server is running.

Then go to & # 39; / etc / nginx & # 39; configuration directory and create a new virtual host configuration for the most important.

  cd / etc / nginx / 
vim sites-available / mattermost

Change the domain name and path for SSL certificates with your own and then paste the configuration into it.

  upstream backend {
server 127.0.0.1:8065;
keepalive 32;
}

proxy_cache_path / var / cache / nginx levels = 1: 2 keys_zone = mattermost_cache: 10m max_size = 3g inactive = 120m use_temp_path = off;

server {
listen 80;
servername edu.initrc.fun;
return 301 https: // $ server name $ request_uri;
}

server {
listen 443 ssl http2;
server name edu. initrc.fun

ssl on;
ssl_certificate / etc / letsencrypt / live / edu .initrc.fun / fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/edu.initrc.fun/privkey.pem; 3.819459025] ssl_session_timeout 1d;
ssl_protocols TLSv1.2;
s -ECDSA-AES256-GCM-SHA384: ECDHE-RSA-AES256-GCM-SHA384: ECDHE-ECDSA-CHACHA20-POLY1305: ECDHE-RSA-CHACHA20-POLY1305: ECDHE-ECDSA-AES128-GCM-SHM -RSA-AES128 -GCM-SHA256: ECDHE-ECDSA-AES256-SHA384: ECDHE-RSA-AES256-SHA384: ECDHE-ECDSA-AES128-SHA256: ECDHE-RSA-AES128-SHA256 & # 39 ;;
ssl_prefer_sher_c_sver90 SSL: 50m;
# HSTS (ngx_http_headers_module required) (15768000 seconds = 6 months)
add_header Strict-Transport-Security max-age = 15768000;
# OCSP Stacking ---
# get OCSP records from URL in ssl_certificate and cache them
ssl_stapling on;
ssl_stapling_verify on;

location ~ / api / v [0-9] + / (user /)? also $ {
proxy_set_header Upgrade $ http_upgrade;
proxy_set_header Connection "upgrade";
client_max_body_size 50M;
proxy_set_header Host $ http_host;
proxy_set_header_adea_header_header_90 X-Forwarded-For $ proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $ scheme;
proxy_set_header X-Frame Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy25kuffer_90
send_timeout 300;
lingering_timeout 5;
proxy_connect_timeout 90;
proxy_send_timeout 300;
proxy_read_timeout 90s;
proxy_pass http: // backend;
}


client_max_b ody_size 50M;
proxy_set_header connection "";
proxy_set_header Host $ http_host;
proxy_set_header X-Real-IP $ remote_addr;
proxy_set_header X-Forwarded-For $ proxy_add_x -Proto $ scheme;
proxy_set_header X-Frame Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
proxy_cache mattermost90_cache_25_cache_45_cache; proxy_cache_min_uses 2;
proxy_cache_use_stale timeout;
proxy_cache_lock on;
proxy_http_version 1.1;
proxy_pass http: // backend;
}
}

Save 19659017] Then create the Nginx cache directory and change the owner of that directory to the default & # 39; www-data & # 39; user.

  mkdir -p / var / cache / nginx 
chown -R www-data: www-data / var / cache / nginx

After enabling Mattermost virtualhost, then test the nginx configuration and make sure it there is nothing wrong.

  ln-s / etc / nginx / sites-available / mattermost / etc / nginx / sites-enabled / 
nginx - t

Restart the Nginx service using the systemctl command below.

  systemctl restart nginx 

As a result, the Nginx installation and configuration as a reverse proxy for Mattermost has been completed. And we are ready to test the Mattermost installation.

 Configure Nginx

Step 8 - Test

Open your browser and type the domain name at your Mattermost installation URL in the address bar. The mine is:

https://mattermost.hakase-labs.io/ [194559015] Now you have to create a new first account for Mattermost, this will be the Mattermost administrator.

 Mattermost Web Installer

Enter your username, email address and password and click on the "Create Account" button.

Create a new first team at Mattermost.

 Create a team

Enter the name of your first team and click "Next". [19659017]   Set team name

And the team's URL will be the team's name, click "Finish" to continue.

 Team URL

And you will automatically join the standard channel "Off-Topic" and "Town Square".

 Mattermost Dashboard

As a result, the Mattermost installation on Debian Buster 10 with MySQL database and Nginx's web server has been successfully completed.


Source link