说明:Rocket.Chat
一年前就介绍过→传送门,一款多功能团队聊天室,支持群组聊天,直接通信,私聊群,桌面通知,媒体嵌入,链接预览,文件上传,语音/视频,聊天,截图,实时翻译等等,安装方法比较简单的有Snap
、Docker
,此前也只说过Snap
安装方法,由于一直有小伙伴需要宝塔面板安装教程,所以这里就水一篇宝塔教程。
安装
官方文档:https://rocket.chat/docs/
环境要求:NodeJS 8.11.4
、Mongodb 4.0.9
、Nginx
(非必需)。
提示:由于官方建议的最低内存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管理器
、MongoDB
、Nginx
(使用域名访问才需要安装,反之不用)。
注意: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,可以在文章下面评论留言。
/etc/init.d/mongodb start
about to fork child process, waiting until server is ready for connections.
forked process: 148427
ERROR: child process failed, exited with error number 14
To see additional information in this output, start without the "--fork" option.
这个该怎么处理啊求
Unrecognized option: directoryPerDB
现在只有这个问题了
Failed to start rocketchat.service: Unit rocketchat.service failed to loaded properly: Invalid argument.
See system logs and 'systemctl status rocketchat.service' for details.
每当我有空的时候,我都会访问博客获取一些有用的信息。今天,我在Google的帮助下找到了您的博客。相信我, 我发现它是最有用的博客之一。
作为新手看这个文章非常的有用啊。。。
journalctl -u rocketchat
-- Logs begin at Mon 2020-12-28 11:50:15 CST, end at Thu 2021-10-14 15:20:29 CST. --
Oct 14 14:58:34 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: Started Rocket.Chat.
Oct 14 14:58:42 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25096]: /opt/Rocket.Chat/programs/server/node_modules/fibers/future.js:280
Oct 14 14:58:42 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: rocketchat.service: main process exited, code=exited, status=1/FAILURE
Oct 14 14:58:42 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: Unit rocketchat.service entered failed state.
Oct 14 14:58:42 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: rocketchat.service failed.
Oct 14 14:59:24 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: rocketchat.service holdoff time over, scheduling restart.
Oct 14 14:59:24 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: Stopped Rocket.Chat.
Oct 14 14:59:24 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: Started Rocket.Chat.
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: /opt/Rocket.Chat/programs/server/node_modules/fibers/future.js:280
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: throw(ex);
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: ^
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: TypeError: AsyncLocalStorage is not a constructor
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at module (server/sdk/index.ts:39:34)
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at fileEvaluate (packages/modules-runtime.js:336:7)
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at Module.require (packages/modules-runtime.js:238:14)
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at Module.moduleLink [as link] (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runt
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at ee/server/broker.ts:1:80
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at module (ee/server/broker.ts:359:2)
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at fileEvaluate (packages/modules-runtime.js:336:7)
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at Module.require (packages/modules-runtime.js:238:14)
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at Module.moduleLink [as link] (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runt
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at module (server/main.js:1:8)
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at fileEvaluate (packages/modules-runtime.js:336:7)
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at Module.require (packages/modules-runtime.js:238:14)
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at require (packages/modules-runtime.js:258:21)
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at /opt/Rocket.Chat/programs/server/app/app.js:199626:15
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at /opt/Rocket.Chat/programs/server/boot.js:401:38
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25166]: at Array.forEach (<anonymous>)
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: rocketchat.service: main process exited, code=exited, status=1/FAILURE
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: Unit rocketchat.service entered failed state.
Oct 14 14:59:31 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: rocketchat.service failed.
Oct 14 14:59:35 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: Stopped Rocket.Chat.
Oct 14 14:59:35 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: Started Rocket.Chat.
Oct 14 14:59:42 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25205]: /opt/Rocket.Chat/programs/server/node_modules/fibers/future.js:280
Oct 14 14:59:42 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: rocketchat.service: main process exited, code=exited, status=1/FAILURE
Oct 14 14:59:42 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: Unit rocketchat.service entered failed state.
Oct 14 14:59:42 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: rocketchat.service failed.
Oct 14 15:00:25 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: rocketchat.service holdoff time over, scheduling restart.
Oct 14 15:00:25 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: Stopped Rocket.Chat.
Oct 14 15:00:25 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: Started Rocket.Chat.
Oct 14 15:00:30 iZwz9bw42a2uzqsh9w8tzeZ rocketchat[25373]: /opt/Rocket.Chat/programs/server/node_modules/fibers/future.js:280
Oct 14 15:00:31 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: rocketchat.service: main process exited, code=exited, status=1/FAILURE
Oct 14 15:00:31 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: Unit rocketchat.service entered failed state.
你好,请问这个是什么问题呀,因为宝塔mongodb是4.4版本,不支持mmavp引擎了,我换成了wiredTiger
enabled: truesystemctl status rocketchatstorage:
dbPath: /www/server/mongodb/Rocket.Chat
directoryPerDB: true
engine: wiredTiger
journal:
rocketchat.service - Rocket.Chat
Loaded: loaded (/etc/systemd/system/rocketchat.service; disabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2021-10-14 15:18:14 CST; 1s ago
Process: 1934 ExecStart=/www/server/nvm/versions/node/v12.14.0/bin/node main.js (code=exited, status=1/FAILURE)
Main PID: 1934 (code=exited, status=1/FAILURE)
Oct 14 15:18:14 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: rocketchat.service: main process exited, code=exited, status=1/FAILURE
Oct 14 15:18:14 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: Unit rocketchat.service entered failed state.
Oct 14 15:18:14 iZwz9bw42a2uzqsh9w8tzeZ systemd[1]: rocketchat.service failed.
[root@iZwz9bw42a2uzqsh9w8tzeZ server]# systemctl restart rocketchat
请问大佬:聊天时图片无法加载,前缀都是htt://localhost:3000开头的,加载不出来,然后点下载浏览器提示拒绝
就这种“http://localhost:3000/file-upload/QJZGNKFRWsK8QCbBL/b83bfde09e56b8a9d015267e5f18ec6a74a8b89e37b845da854bc3a2b9d72e3b.jpeg?download”
邀请链接页是这种:“https://go.rocket.chat/invite?host=localhost%3A3000&path=invite%xxxxx&secure=no”
求告知在哪儿修改localhost:3000这个为正确的,不胜感激!
不行,没配置websocket
请问大神,装好后,后台管理,用户列表、聊天室列表均不显示,为空白,添加用户后依旧没显示,怎么解决呢?谢谢!
按教程配置后无法启动,能帮我看下嘛
rocketchat.service - Rocket.Chat
Loaded: loaded (/etc/systemd/system/rocketchat.service; disabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2021-01-06 19:54:24 CST; 9s ago
Process: 26573 ExecStart=/www/server/nvm/versions/node/v8.11.4/bin/node main.js (code=exited, status=1/FAILURE)
Main PID: 26573 (code=exited, status=1/FAILURE)
Jan 06 19:54:24 bogon systemd[1]: rocketchat.service: main process exited, code=exited, status=1/FAILURE
Jan 06 19:54:24 bogon systemd[1]: Unit rocketchat.service entered failed state.
Jan 06 19:54:24 bogon systemd[1]: rocketchat.service failed.
ln -sf $(command -v node) /usr/bin/node
systemctl restart rocketchat
systemctl status rocketchat
试试这几个命令,可以不
感谢,已经装好啦,但是我现在遇到个问题,您能帮忙看下吗?
怎么打开桌面通知:Chrome 浏览器我已经允许通知了,但是还是收不到提醒,必须打开浏览器才能看到有消息来..
这个不太清楚
好奇怪啊,用了几个月今天访问不了查看运行状态发现他自己就报这行错:
Loaded: loaded (/etc/systemd/system/rocketchat.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Fri 2020-10-09 08:30:48 CST; 8s ago
Process: 22127 ExecStart=/www/server/nvm/versions/node/v12.14.0/bin/node main.js (code=exited, status=1/FAILURE)
Main PID: 22127 (code=exited, status=1/FAILURE)
这个需要看日志,journalctl -u rocketchat