0% found this document useful (0 votes)
31 views3 pages

Cai Dat Rocket-Chat

The document provides instructions for installing Let's Encrypt, Nginx, Nodejs, Meteor, Mongodb, and Rocket.Chat on a server. It includes steps for obtaining an SSL certificate, configuring Nginx as a reverse proxy, setting up Mongodb replication, and deploying the Rocket.Chat application.

Uploaded by

viên vũ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

Cai Dat Rocket-Chat

The document provides instructions for installing Let's Encrypt, Nginx, Nodejs, Meteor, Mongodb, and Rocket.Chat on a server. It includes steps for obtaining an SSL certificate, configuring Nginx as a reverse proxy, setting up Mongodb replication, and deploying the Rocket.Chat application.

Uploaded by

viên vũ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Cài đặt Free Certificate Let's Encrypt

sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt


cd /opt/letsencrypt
./letsencrypt-auto certonly --standalone --email [email protected] -d www.livemeeting.vn

Cài đặt Nginx

sudo apt-get install nginx


cd /etc/nginx/sites-available
sudo mv default default.bak

Tạo file default mới với nội dung

sudo nano /etc/nginx/sites-available/default

server {
listen 443 ssl;
server_name www.livemeeting.vn;
ssl_certificate /etc/letsencrypt/live/www.livemeeting.vn/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.livemeeting.vn/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
proxy_pass http://www.livemeeting.vn: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;
}
}
server {
listen 80;
server_name www.livemeeting.vn;
return 301 https://$host$request_uri;
}

sudo service nginx stop


sudo service nginx start

Nâng cấp hệ thống

sudo apt-get update && sudo apt-get -y upgrade


sudo apt-get install -y software-properties-common git nano curl build-essential

Cài Nodejs

sudo apt-get install -y nodejs npm


sudo npm install nave -g
sudo nave usemain 0.10.43

sudo npm install pm2 -g


sudo pm2 startup

Cài Meteor

curl --location https://install.meteor.com | sudo bash -

Cài Mongodb

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10


echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee
/etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install --yes mongodb-org

Setup Mongodb replica

sudo nano /etc/mongod.conf


đối với Mongodb 2.4:

replSet=001-rs

Mongodb 2.6 hoặc cao hơn

replication:
replSetName: "001-rs"
sudo service mongod restart
sudo mongo
>rs.initiate()

nếu ra được kết quả như bên dưới là ok


{
"info2" : "no configuration explicitly specified -- making one",
"me" : "vps:27017",
"info" : "Config now saved locally. Should come online in about a minute.",
"ok" : 1
}

Nếu báo lỗi như bên dưới, mở /etc/mongod.conf đổi bind_ip to 0.0.0.0

"errmsg" : "couldn't initiate : can't find self in the replset config"

Cài đặt Rocket.Chat

Download bản mới nhất


curl -L https://rocket.chat/releases/latest/download -o rocket.chat.tgz
tar zxvf rocket.chat.tgz
mv bundle Rocket.Chat
cd Rocket.Chat/programs/server
npm install
cd ../..
export ROOT_URL=http://www.livemeeting.vn:3000/
export MONGO_URL=mongodb://localhost:27017/rocketchat
export PORT=3000
node main.js

Tạo script tự khởi động phần mềm

cd /home/administrator/Rocket.Chat
sudo nano rocket-chat.json

{
"apps": [{
"name": "rocket.chat",
"script": "/home/administrator/Rocket.Chat/main.js",
"out_file": "/home/administrator/Rocket.Chat/logs/app.log",
"error_file": "/home/administrator/Rocket.Chat/logs/err.log",
"port": "3000",
"env": {
"MONGO_URL": "mongodb://localhost:27017/rocketchat",
"MONGO_OPLOG_URL": "mongodb://localhost:27017/local",
"ROOT_URL": "http://www.livemeeting.vn:3000",
"PORT": "3000"
}
}]
}

sudo mkdir /home/administrator/Rocket.Chat/logs


sudo pm2 start rocket-chat.json
sudo pm2 save

Đăng ký account Administrator

Mở trình duyệt, gõ địa chỉ https://www.livemeeting.vn/


Mặc định, account đăng ký đầu tiên sẽ là account có quyền Administrator

You might also like