Mattermost
made with
React
简介及使用教程
Mattermost是一个团队协作Slack的替代方案,开放源代码、自托管,使用Golang和React编写的,并且与MySQL或PostgreSQL一起作为单个Linux二进制文件运行。
安装
这里以CentOs 7为例(适用于CentOS、 Oracle Linux和 Scientific Linux)。
安装Mysql
下载Mysql yum软件包
wget http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
安装 Yum软件包
sudo yum localinstall mysql57-community-release-el7-9.noarch.rpm
安装Mysql
sudo yum install mysql-community-server
启动Mysql
sudo systemctl start mysqld.service
获取root密码
sudo grep 'temporary password' /var/log/mysqld.log
修改 root 密码
mysql -u root -p
设置自启动
sudo systemctl enable mysqld
创建用户mmuser
mysql> create user 'mmuser'@'%' identified by 'mmuser-password';
创建数据库
mysql> create database mattermost;
授权
mysql> grant all privileges on mattermost.* to 'mmuser'@'%';
安装PostgreSQL
略,详见下文文档
安装Mattermost服务端
下载最新的 Mattermost Server
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
:
- 设置
DriverName
为mysql
: - 设置
DataSource
:"mmuser:<mmuser-password>@tcp(<host-name-or-IP>:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s"
- 配置
SiteURL
,如https://mattermost.example.com
测试
cd /opt/mattermost
sudo -u mattermost ./bin/mattermost
如果测试成功,将会显示日志信息和Server is listening on :8065
。
手动启用进程守护
创建Mattermost配置文件:
sudo touch /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
示例
作者
Mattermost
相关项目