惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
N
Netflix TechBlog - Medium
腾讯CDC
C
Check Point Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
S
SegmentFault 最新的问题
F
Fortinet All Blogs
美团技术团队
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
F
Full Disclosure
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
J
Java Code Geeks
I
InfoQ
Y
Y Combinator Blog
A
About on SuperTechFans
AI
AI
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Forbes - Security
Forbes - Security
W
WeLiveSecurity
M
MIT News - Artificial intelligence
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
V2EX - 技术
V2EX - 技术
Project Zero
Project Zero

Rat's Blog - 建站知识

189List:一个全新的天翼云网盘的目录列表程序,CTList升级版 - Rat's Blog TopDocs:一款美观实用的在线文档编辑系统,支持Markdown语法 - Rat's Blog 一个可以绑定多个OneDrive网盘的极简目录列表:OneList - Rat's Blog Navi:一个开源、美观且可以部署在GitHub Pages的网站导航程序 - Rat's Blog Shiori:一个简单、美观且带Web界面的书签管理器 - Rat's Blog 一个简单的PHP Web代理:miniProxy - Rat's Blog 一款开源,美观,带后台管理的网址导航工具:WebStack-Laravel - Rat's Blog 一款基于Web的免费在线矢量图(SVG)编辑工具:Method-Draw - Rat's Blog Lstu:一款简单、美观的轻量级网址缩短程序 - Rat's Blog
使用宝塔面板安装Rocket.Chat多功能团队聊天室 - Rat's Blog
博主: Rat's · 2019-06-27 · via Rat's Blog - 建站知识

说明:Rocket.Chat一年前就介绍过→传送门,一款多功能团队聊天室,支持群组聊天,直接通信,私聊群,桌面通知,媒体嵌入,链接预览,文件上传,语音/视频,聊天,截图,实时翻译等等,安装方法比较简单的有SnapDocker,此前也只说过Snap安装方法,由于一直有小伙伴需要宝塔面板安装教程,所以这里就水一篇宝塔教程。

安装

官方文档:https://rocket.chat/docs/

环境要求:NodeJS 8.11.4Mongodb 4.0.9Nginx(非必需)。

提示:由于官方建议的最低内存1G,所以512M或更小的建议加点虚拟内存,可以使用Swap一键脚本→传送门

1、安装宝塔

#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

安装完成后,进入面板,点击左侧软件商店,然后安装PM2管理器MongoDBNginx(使用域名访问才需要安装,反之不用)。

注意:Debian安装MongoDb之前还需要使用命令apt install sudo,不然可能存在MongoDb启动不了的情况;如果你已经安装了MongoDb,那就先使用apt install sudo,再使用/etc/init.d/mongodb start启动即可。

2、环境配置
先点击左侧软件商店,找到PM2管理器设置选项,选择Node版本,切换到12.14.0版本。

然后再找到MongoDb设置选项,点击配置文件,新增/修改以下代码:

#设置storage引擎,新增engine参数,并修改下dbPath路径,不然会启动不了
storage:
  dbPath: /www/server/mongodb/Rocket.Chat
  directoryPerDB: true
  engine: mmapv1
  journal:
    enabled: true
#配置replica set,新增以下参数
replication:
  replSetName: rs01 

保存后,MongoDb会自动关闭,这时候使用命令:

#新建数据存储路径,即上面配置文件修改的dbPath参数
mkdir /www/server/mongodb/Rocket.Chat
#授权
chown mongo:mongo /www/server/mongodb/Rocket.Chat
#重新启动数据库
/etc/init.d/mongodb start
#启动replica set
mongo --eval "printjson(rs.initiate())"

3、安装依赖

#Debian/Ubuntu系统
apt install -y graphicsmagick
#CentOS系统
yum install -y GraphicsMagick

4、安装Rocket.Chat

#下载rocket.chat
wget -O rocket.chat.tgz https://releases.rocket.chat/latest/download 
#解压并删除
tar -xzf rocket.chat.tgz && rm -rf rocket.chat.tgz
#移动到/opt并重命名
mv bundle /opt/Rocket.Chat
#安装依赖
cd /opt/Rocket.Chat
npm install -g inherits
cd programs/server
npm install

5、启动Rocket.Chat

ln -sf $(command -v node) /usr/bin/node
#新建rocketchat用户并授权
useradd -M rocketchat && usermod -L rocketchat
chown -R rocketchat:rocketchat /opt/Rocket.Chat
#新建systemd配置文件,将以下代码一起复制到SSH运行
cat > /etc/systemd/system/rocketchat.service <<EOF
[Unit]
Description=Rocket.Chat
After=network.target
Wants=network.target

[Service]
ExecStart=$(command -v node) main.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocketchat
WorkingDirectory=/opt/Rocket.Chat
Environment=MONGO_URL=mongodb://127.0.0.1:27017/rocketchat?replicaSet=rs01 MONGO_OPLOG_URL=mongodb://127.0.0.1:27017/local?replicaSet=rs01 ROOT_URL=http://127.0.0.1:3000/ PORT=3000
Type=simple
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target
EOF

开始启动:

#启动的时候,可能需要点时间加载,等待即可
systemctl start rocketchat

查看状态:

systemctl status rocketchat

开机自启:

systemctl enable rocketchat

此时访问地址为ip:3000,如果你想用ip访问,点击左侧安全,开放3000端口即可,如果想用域名访问,不需要开启,继续往下面看。

6、域名访问
要使用域名的话就需要进行反代了,这里就不用宝塔自带的反向代理配置了,默认配置不适合Rocket.Chat

先点击左侧网站,添加站点,然后再点击添加好了的域名名称,这时候就进入了站点配置,点击配置文件,在中间添加以下代码:

location ~ ^/.* {
    proxy_pass http://127.0.0.1:3000;
    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 Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header X-Forward-Proto http;
    proxy_set_header X-Nginx-Proxy true;
    proxy_http_version 1.1;

    proxy_redirect off;
}

点击保存后,再点击SSL,申请免费的Let's Encrypt证书,并强制HTTPS

配置好了后就可以使用域名访问了,然后根据要求安装好,最后就可以进入你的Rocket.Chat聊天室了,还有更多使用方法可以直接查看→传送门


版权声明:本文为原创文章,版权归 Rat's Blog 所有,转载请注明出处!

本文链接:https://www.moerats.com/archives/960/

如教程需要更新,或者相关链接出现404,可以在文章下面评论留言。