Mattermost手动搭建记录

环境介绍

服务器:腾讯云

系统版本:CentOS Linux release 7.8.2003 (Core)

方式:服务器本机手动搭建

首先搭建mysql

安装mysql

rpm -ivh https://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm

yum install -y mysql-server

设置开机启动和启动服务

systemctl enable mysqld
systemctl start mysqld

设置mysql的root密码

sudo grep 'temporary password' /var/log/mysqld.log
//查看root初始密码
mysql -uroot -p
//登陆mysql
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourmysqlpassword';
//修改root密码

注意:密码必须设置地复杂,否则会提示 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

创建Mattermost数据库

mysql -u root -p
//登陆
create user 'mmuser'@'%' identified by '你的密码';
//创建用户
create database mattermost_test;
//创建数据库
grant all privileges on mattermost_test.* to 'mmuser'@'%';
//授权
flush privileges;
//保存设置

安装Mattermost服务端

wget https://releases.mattermost.com/5.25.0/mattermost-5.25.0-linux-amd64.tar.gz
//建议本地下载,再传输到服务器上

解压

tar -xvzf *.gz

移动目录mattermost/opt目录

sudo mv mattermost /opt

创建存储目录

sudo mkdir /opt/mattermost/data

设置权限

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

配置/opt/mattermost/config/config.json

    "SqlSettings": {
        "DriverName": "mysql",
        "DataSource": "mmuser:数据库密码@tcp(127.0.0.1:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s",

注意:主要是修改以上两个地方

启动测试

cd /opt/mattermost
sudo -u mattermost ./bin/mattermost

等待一会儿出现 Server is listening on :8065 字样后就可以按 Ctrl+C 停止运行,继续后面的操作。 这步最主要的作用是确定前面的配置是否正确,如果有异常,可以根据实际提示去修改配置。

手动启用进程守护

创建Mattermost配置文件:

sudo touch /etc/systemd/system/mattermost.service
vi /etc/systemd/system/mattermost.service

写入内容:

[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

设置权限

sudo chmod 664 /etc/systemd/system/mattermost.service

重载systemd服务

sudo systemctl daemon-reload

设置开机启动Mattermost

sudo systemctl enable mattermost

启动Mattermost服务:

sudo systemctl start mattermost

访问 http://localhost:8065

curl http://localhost:8065
posted @ 2021-01-07 13:29  殺生丸SESSYOUMARU  阅读(316)  评论(0编辑  收藏  举报