SELINUX
vi /etc/sysconfig/selinux
→SELINUX=disabled : 关闭防火墙
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install --enablerepo=epel mongodb-server nodejs npm curl GraphicsMagick
Rocket.Chat安装
cd /usr/local/src
curl -o rocket.chat.tgz -L https://rocket.chat/releases/latest/download
tar xvzf rocket.chat.tgz
mv bundle /opt/rocket.chat
添加rochetchat用户
useradd -r rocketchat -U
chown -R rocketchat:rocketchat /opt/rocket.chat
rocketchat环境
mkdir /etc/rocket.chat
touch /etc/rocket.chat/rocketchat.env
vi /etc/rocket.chat/rocketchat.env
============================================================
MONGO_URL=mongodb://localhost:27017/rocketchat
ROOT_URL=http://<ip>:3000/
PORT=3000
============================================================
Systemd服务命令
vi /etc/systemd/system/rocketchat.service
============================================================
[Unit]
Description=Rocket.Chat Server
After=network-online.target mongod.target
Requires=network-online.target
[Service]
ExecStart=/usr/bin/node /opt/rocket.chat/main.js
EnvironmentFile=/etc/rocket.chat/rocketchat.env
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocketchat
[Install]
WantedBy=multi-user.target
============================================================
npm 安装
cd /opt/rocket.chat/programs/server/
npm install
启动服务
systemctl daemon-reload
systemctl start mongod
systemctl start rocketchat
查看rocketchat状态
systemctl status rocketchat
开机启动
systemctl enable mongod
systemctl enable rocketchat
确认启动状态
systemctl list-unit-files --type=service | grep mongo
mongod.service enabled
systemctl list-unit-files --type=service | grep rocket
rocketchat.service enabled
安装nginx(可选)
yum install nginx
SSL配置(https使用)
mkdir /etc/nginx/ssl
chmod 400 hogehoge.com.key
chmod 400 hogehoge.com.pem
nginx.conf配置
vi /etc/nginx/conf.d/rktcht.conf
==========================================================
Upstreams
upstream backend {
server 127.0.0.1:3000;
}
# HTTPS Server
server {
listen 443;
server_name hogehoge.com;
error_log /var/log/nginx/hogehoge.com.access.log;
ssl on;
ssl_certificate /etc/nginx/ssl/hogehoge.com.pem;
ssl_certificate_key /etc/nginx/ssl/hogehoge.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # don’t use SSLv3 ref: POODLE
location / {
proxy_pass http://127.0.0.1:3000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
}
==========================================================
nginx -t
systemctl restart nginx
开机启动
systemctl enable nginx
查看状态
systemctl list-unit-files -t service | grep -e nginx
网友评论