说明:mattermost、一款多功能团队聊天室,支持群组聊天,私聊群,通知,媒体嵌入,链接预览,文件上传,聊天,截图,实时翻译等等,安装方法比较简单,由于想在服务器上即能放网站也能装mattermost,所以想着可以使用宝塔面板安装,亲测后,这里就水一篇宝塔教程。
安装
- 官方下载地址:https://mattermost.com/download/
- 官方文档:https://docs.mattermost.com/install/install-rhel-7.html
- 我的环境:CentOS7、PHP7.4、Mysql 5.7、Nginx 1.18.0(反代绑域名用)。
1. 调整系统,卸载Apache
由于使用的国外的服务器,安装了apache,首先卸载掉,如何测试是否安装apache自行百度,可以用top命令,也可以直接ip访问看是否有相关显示
#运行后会显示出跟httpd相关的软件包: 查看apache相关的软件包 pm -qa|grep httpd #接着开始使用centos下的卸载命令, “rpm -e 软件或服务名”,我们运行: rpm -e httpd #更新系统,保证环境ok yum update yum upgrade
2. 安装宝塔
#CentOS系统 wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh #Ubuntu系统 wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh #Debian系统 wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh
zk排坑:宝塔面板本身是基于centos开发,对其他系统的不同版本可能兼容性没那么好
系统兼容性顺序: Centos8.x > Centos7.x > Ubuntu18.04 > Debian10 > Ubuntu 20.04 > 其它系统
3. 环境配置
安装完成后,进入面板,根据宝塔面板提示设置和安装,运行环境nginx+php+mysql,正常配置就行,mysql官方推荐用5.7版本,我就用的是5.7
安装完成后,先创建数据库,访问权限设置为所有人
数据库名称:mattermost 用户名:mmuser 用户密码:password
3. 安装Mattermost Server
#在官方下载地址:https://mattermost.com/download/找到最新的下载链接, wget https://releases.mattermost.com/5.30.1/mattermost-5.30.1-linux-amd64.tar.gz #下载完成后,解压 tar -xvzf *.gz #把解压的移动到根目录下opt文件夹 mv mattermost /opt #创建数据存储文件夹 mkdir /opt/mattermost/data #设置一个名为“ mestmost”的系统用户和组,该用户和组将运行此服务,并设置所有权和权限。 useradd --system --user-group mattermost chown -R mattermost:mattermost /opt/mattermost chmod -R g+w /opt/mattermost #在文件/opt/mattermost/config/config.json中设置数据库驱动程序。直接进入宝塔文件修改三个地方 "SiteURL": "https://mattermost.example.com", "DriverName": "mysql", "DataSource": "mmuser:password@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s",
测试下工作是否正常
#进入mattermost文件夹 cd /opt/mattermost #以mattermost的用户启动Mattermost服务器 sudo -u mattermost ./bin/mattermost #当出现Server is listening on :8065,即说明成功
#设置Mattermost以使用systemd init守护程序来处理对Mattermost进程的监督 #创建Mattermost配置文件 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 #使服务可执行 chmod 664 /etc/systemd/system/mattermost.service #重新加载系统服务 systemctl daemon-reload #将Mattermost设置为在启动时启动 sudo systemctl enable mattermost #启动Mattermost服务器 systemctl start mattermost #验证Mattermost是否正在运行,直接打开http://ip:8065
4. 反向代理,绑定域名
创建网站,绑定域名,当然域名先得解析并生效,不赘述了,这里不用创建数据库
然后申请SSL证书
创建反代
提交后修改配置文件
#直接替换配置文件,修改ip #PROXY-START/ location / { client_max_body_size 50M; proxy_set_header Connection ""; proxy_pass http://ip:8065; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Frame-Options SAMEORIGIN; proxy_buffers 256 16k; proxy_buffer_size 16k; proxy_read_timeout 600s; proxy_http_version 1.1; add_header X-Cache $upstream_cache_status; #Set Nginx Cache add_header Cache-Control no-cache; expires 12h; } location ~ /api/v[0-9]+/(users/)?websocket$ { proxy_pass http://ip:8065; 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 X-Real-IP $remote_addr; proxy_set_header 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; proxy_buffer_size 16k; client_body_timeout 60; send_timeout 300; lingering_timeout 5; proxy_connect_timeout 90; proxy_send_timeout 300; proxy_read_timeout 90s; } #PROXY-END/
保存后大功告成,想要ssl,不要忘了强制开启HTTPS哟!另外后台设置中文后需要重启才会生效!
这里要注意的是,后台smtp发送邮件设置,发送邮箱需要与注册时管理员的邮箱一样,否则会报错!
本文作者:𝙕𝙆𝘾𝙊𝙄
文章名称:宝塔面板安装MatterMost多功能团队聊天室并开启SSL
文章链接:https://www.zkcoi.com/365up/program/509.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。