location = /50x.html 8
the following guide describes how to install Mattermost on Alma Linux 8.
Made by spending a few terminal commands.
First, we install the MySQL server command:
1 | dnf install mariadb-server -y |
Run it on your system:
1 2 | systemctl start mariadb systemctl enable mariadb |
Go to the MySQL server configuration and give the root password by typing:
1 | mysql_secure_installation |
We answer the questions as follows:
1 2 3 4 5 6 7 8 | Enter current password for root (enter for none): Set root password? [Y/n] Y New password: Re-enter new password: Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y |
During this process we give the root password.
The next step is to create the database and user. Log in to the mysql command:
1 | mysql -u root -p |
We serve previously provided by us root password and create a database:
1 | CREATE DATABASE mattermostdb; |
Then we create a user and assign him permission:
1 | GRANT ALL PRIVILEGES ON mattermostdb.* TO mattermost@localhost IDENTIFIED BY 'naszehasło'; |
naszehasło any course we replace your password.
Reload powers and leave with mysql
1 2 | FLUSH PRIVILEGES; EXIT; |
Installation Mattermost
At the beginning, add a system user:
1 | useradd --system --user-group mattermost |
Mattermosta charge command:
1 | wget https://releases.mattermost.com/6.0.2/mattermost-6.0.2-linux-amd64.tar.gz |
unpack:
1 | tar -xf mattermost-6.0.2-linux-amd64.tar.gz |
Mattermosta move the files to the / opt directory
1 | mv mattermost /opt |
We give the appropriate permissions:
1 2 3 | mkdir /opt/mattermost/data chown -R mattermost:mattermost /opt/mattermost chmod -R g+w /opt/mattermost |
Configuration Mattermost
Mattermosta edit the configuration file to connect it to the previously created database
1 | nano /opt/mattermost/config/config.json |
we find section “SqlSettings”: { and configure as follows:
1 2 3 | "SqlSettings": { "DriverName": "mysql", "DataSource": "mattermost:naszehasło@tcp(localhost:3306)/mattermostdb?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s", |
The next step is to create a system service that we can manage it simply and to run in a background.
Create a file /etc/systemd/system/mattermost.service
1 | nano /etc/systemd/system/mattermost.service |
A given content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | [Unit] Description=Mattermost After=syslog.target network.target mysqld.service [Service] Type=notify WorkingDirectory=/opt/mattermost User=mattermost ExecStart=/opt/mattermost/bin/mattermost PIDFile=/var/spool/mattermost/pid/master.pid TimeoutStartSec=3600 LimitNOFILE=49152 [Install] WantedBy=multi-user.target |
reload demon:
1 | systemctl daemon-reload |
We launch:
1 2 | systemctl start mattermost systemctl enable mattermost |
Status of services we can see by typing:
1 | systemctl status mattermost |
Below is a sample log:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ? mattermost.service - Mattermost Loaded: loaded (/etc/systemd/system/mattermost.service; disabled; vendor preset: disabled) Active: active (running) since Sat 2022-01-15 14:12:29 UTC; 7s ago Main PID: 15201 (mattermost) Tasks: 32 (limit: 11411) Memory: 265.2M CGroup: /system.slice/mattermost.service ??15201 /opt/mattermost/bin/mattermost ??15298 plugins/com.mattermost.plugin-channel-export/server/dist/plugin-linux-amd64 ??15299 plugins/com.mattermost.nps/server/dist/plugin-linux-amd64 ??15308 plugins/playbooks/server/dist/plugin-linux-amd64 ??15313 plugins/focalboard/server/dist/plugin-linux-amd64 Jan 15 14:12:26 almalinux8 mattermost[15201]: {"timestamp":"2022-01-15 14:12:26.344 Z","level":"info","msg":"Sent notification of next survey> Jan 15 14:12:26 almalinux8 mattermost[15201]: {"timestamp":"2022-01-15 14:12:26.402 Z","level":"info","msg":"Post.Message has size restrictio> Jan 15 14:12:26 almalinux8 mattermost[15201]: {"timestamp":"2022-01-15 14:12:26.499 Z","level":"info","msg":"info [2022-01-15 14:12:26.497 Z]> Jan 15 14:12:26 almalinux8 mattermost[15201]: {"timestamp":"2022-01-15 14:12:26.537 Z","level":"info","msg":"\n -- collation of mattermost> Jan 15 14:12:28 almalinux8 mattermost[15201]: {"timestamp":"2022-01-15 14:12:28.297 Z","level":"info","msg":"debug [2022-01-15 14:12:28.295 Z> Jan 15 14:12:28 almalinux8 mattermost[15201]: {"timestamp":"2022-01-15 14:12:28.804 Z","level":"info","msg":"info [2022-01-15 14:12:28.803 Z]> Jan 15 14:12:29 almalinux8 systemd[1]: Started Mattermost. Jan 15 14:12:29 almalinux8 mattermost[15201]: {"timestamp":"2022-01-15 14:12:29.149 Z","level":"info","msg":"Starting Server...","caller":"ap> Jan 15 14:12:29 almalinux8 mattermost[15201]: {"timestamp":"2022-01-15 14:12:29.150 Z","level":"info","msg":"Server is listening on [::]:8065> Jan 15 14:12:29 almalinux8 mattermost[15201]: {"timestamp":"2022-01-15 14:12:29.150 Z","level":"info","msg":"Sending systemd READY notificati> |
Reverse Proxy Nginx Configuration
we install Nginx by issuing the command:
1 | dnf install nginx -y |
we create a vhost
1 | nano /etc/nginx/conf.d/mattermost.conf |
The content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | server { listen 80; server_name mattermost.domena.pl; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { proxy_pass http://localhost:8065/; index index.html index.htm; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } |
location = /50x.html:
1 | systemctl start nginx |
1 | systemctl restart nginx |
1 | systemctl enable nginx |
location = /50x.html:
1 | firewall-cmd --add-service=http --permanent |
1 | firewall-cmd --reload |
location = /50x.html
location = /50x.html.