镜像下载、域名解析、时间同步请点击 阿里云开源镜像站
Rocket.Chat 目前最新的版本为 4.0.1,可以通过手动或者容器的方式安装。这里我推荐使用容器,部署过程会方便不少。
如果要用容器的方式部署,需要先安装 docker 和 docker-compose,再下载编排文件:
安装docker脚本
#!/bin/sh##setenforce 0sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/configsystemctl stop firewalld && systemctl disable firewalldswapoff -a && echo "swapoff -a" >> /etc/rc.local && chmod +x /etc/rc.localyum install -y wget vim lrzsz telnet net-toolsyum install -y yum-utils device-mapper-persistent-data lvm2yum install -y https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable/Packages/docker-ce-18.06.3.ce-3.el7.x86_64.rpmmkdir -p /etc/dockercat > /etc/docker/daemon.json <<EOF{"registry-mirrors": ["https://q2uvt0x7.mirror.aliyuncs.com"],"exec-opts": ["native.cgroupdriver=cgroupfs"],"data-root": "/data/docker","storage-driver": "overlay2","storage-opts":["overlay2.override_kernel_check=true"],"log-driver": "json-file","log-opts": {"max-size": "100m","max-file": "10"}}EOFsystemctl enable docker && systemctl daemon-reload && systemctl start dockerecho "* soft nofile 655360" >> /etc/security/limits.confecho "* hard nofile 655360" >> /etc/security/limits.confecho "* soft nproc 655360" >> /etc/security/limits.confecho "* hard nproc 655360" >> /etc/security/limits.confecho "* soft memlock unlimited" >> /etc/security/limits.confecho "* hard memlock unlimited" >> /etc/security/limits.confecho "DefaultLimitNOFILE=1024000" >> /etc/systemd/system.confecho "DefaultLimitNPROC=1024000" >> /etc/systemd/system.confulimit -Hnyum -y install chronysystemctl enable chronyd.service && systemctl start chronyd.service && systemctl status chronyd.servicechronyc sources
安装docker-compose
yum install epel-release -yyum install docker-compose -y
# 创建并进入工作目录mkdir /opt/rocketchatcd /opt/rocketchat# 下载编排文件curl -L https://raw.githubusercontent.com/RocketChat/Rocket.Chat/develop/docker-compose.yml -o docker-compose.yml
version: '2'services:rocketchat:image: ccr.ccs.tencentyun.com/tcb-100024104308-urur/rocket.chat:latestcommand: >bash -c"for i in `seq 1 30`; donode main.js &&s=$$? && break || s=$$?;echo \"Tried $$i times. Waiting 5 secs...\";sleep 5;done; (exit $$s)"restart: unless-stoppedvolumes:- ./uploads:/app/uploadsenvironment:- PORT=3000- ROOT_URL=http://localhost:3000- MONGO_URL=mongodb://mongo:27017/rocketchat- MONGO_OPLOG_URL=mongodb://mongo:27017/local- REG_TOKEN=${REG_TOKEN}# - MAIL_URL=smtp://smtp.email# - HTTP_PROXY=http://proxy.domain.com# - HTTPS_PROXY=http://proxy.domain.comdepends_on:- mongoports:- 3000:3000labels:- "traefik.backend=rocketchat"- "traefik.frontend.rule=Host: your.domain.tld"mongo:image: ccr.ccs.tencentyun.com/tcb-100024104308-urur/mongo:4.0restart: unless-stoppedvolumes:- ./data/db:/data/db#- ./data/dump:/dumpcommand: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1labels:- "traefik.enable=false"# this container's job is just run the command to initialize the replica set.# it will run the command and remove himself (it will not stay running)mongo-init-replica:image: ccr.ccs.tencentyun.com/tcb-100024104308-urur/mongo:4.0command: >bash -c"for i in `seq 1 30`; domongo mongo/rocketchat --eval \"rs.initiate({_id: 'rs0',members: [ { _id: 0, host: 'localhost:27017' } ]})\" &&s=$$? && break || s=$$?;echo \"Tried $$i times. Waiting 5 secs...\";sleep 5;done; (exit $$s)"depends_on:- mongo#traefik:# image: traefik:latest# restart: unless-stopped# command: ># traefik# --docker# --acme=true# --acme.domains='your.domain.tld'# --acme.email='your@email.tld'# --acme.entrypoint=https# --acme.storagefile=acme.json# --defaultentrypoints=http# --defaultentrypoints=https# --entryPoints='Name:http Address::80 Redirect.EntryPoint:https'# --entryPoints='Name:https Address::443 TLS.Certificates:'# ports:# - 80:80# - 443:443# volumes:# - /var/run/docker.sock:/var/run/docker.sock
根据自己的需求来修改编排文件,修改完成后,运行以下命令启动服务:
docker-compose up -d
服务启动后,在浏览器中输入 http://{ip}:3000进行访问。
第一次使用 Rocket.Chat 时,一些可能会不太习惯。不过不用担心,Rocket.Chat 用起来还是比较简单的。接下来,我会向大家演示 Rocket.Chat 的基本用法。
安装向导
我们第一次访问 Rocket.Chat 时,会被引导到安装向导,根据页面的提示来配置就好。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号