请根据操作系统选择官网安装文档
本文使用centos进行安装
https://docs.rocket.chat/installation/manual-installation/centos/
RocketChat为开源的聊天软件,支持Web,Windows,Android,ios,macOS
安装必要的依赖包
更新软件包列表并配置yum以使用以下yum存储库文件安装正式的MongoDB软件包:
sudo yum -y check-update
cat << EOF | sudo tee -a /etc/yum.repos.d/mongodb-org-4.0.repo [mongodb-org-4.0] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.0/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc EOF
|
配置要通过软件包管理器安装的Node.js:
sudo yum install -y curl && curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
|
安装构建工具,MongoDB,nodejs和graphicsmagick
sudo yum install -y gcc-c++ make mongodb-org nodejs sudo yum install -y epel-release && sudo yum install -y GraphicsMagick
|
使用npm 安装 inherits 和 n 以及Rocket.Chat所需的节点版本:
sudo npm install -g inherits n && sudo n 12.14.0
|
安装Rocket.Chat
下载最新的Rocket.Chat版本:
curl -L https://releases.rocket.chat/latest/download -o /tmp/rocket.chat.tgz tar -xzf /tmp/rocket.chat.tgz -C /tmp
|
安装(本指南使用/ opt,但可以选择其他目录):
cd /tmp/bundle/programs/server && npm install sudo mv /tmp/bundle /opt/Rocket.Chat
|
配置Rocket.Chat服务
添加rocketchat用户,在Rocket.Chat文件夹上设置正确的权限,并创建Rocket.Chat服务文件:
sudo useradd -M rocketchat && sudo usermod -L rocketchat sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat
|
cat << EOF |sudo tee -a /lib/systemd/system/rocketchat.service [Unit] Description=The Rocket.Chat server After=network.target remote-fs.target nss-lookup.target nginx.target mongod.target [Service] ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js StandardOutput=syslog StandardError=syslog SyslogIdentifier=rocketchat User=rocketchat Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 ROOT_URL=http://localhost:3000/ PORT=3000 [Install] WantedBy=multi-user.target EOF
|
打开刚刚创建的Rocket.Chat服务文件(/usr/lib/systemd/system/rocketchat.service)
改ROOT_URL环境变量以反映您要用于访问服务器的URL(可以选择更改MONGO_URL,MONGO_OPLOG_URL和PORT)
MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 ROOT_URL=http://your-host-name.com-as-accessed-from-internet:3000 PORT=3000
|
为MongoDB设置存储引擎和复制(对于版本> 1为必需),并启用并启动MongoDB和Rocket.Chat
sudo sed -i "s/^# engine:/ engine: mmapv1/" /etc/mongod.conf
sudo sed -i "s/^#replication:/replication:\n replSetName: rs01/" /etc/mongod.conf
sudo systemctl enable mongod && sudo systemctl start mongod
mongo --eval "printjson(rs.initiate())"
sudo systemctl enable rocketchat && sudo systemctl start rocketchat
|
http://your-host-name.com:3000 即可访问
如果mongodb启动报错可完全卸载mongodb
1、删除安装的包
yum erase $(rpm -qa | grep mongodb-org)
2、删除数据及日志
rm -r /var/log/mongodb
rm -r /var/lib/mongo 3、删除数据配置文件
rm -r /etc/mongo.conf
|