Skip to content

Instantly share code, notes, and snippets.

@jotapepinheiro
Last active December 7, 2017 04:41
Show Gist options
  • Save jotapepinheiro/070d655cd6c553bca07c55cfb2fc1946 to your computer and use it in GitHub Desktop.
Save jotapepinheiro/070d655cd6c553bca07c55cfb2fc1946 to your computer and use it in GitHub Desktop.
Install Rocket.Chat Ubuntu 16.04
## command 1- Instalar pacotes essenciais
apt-get install curl graphicsmagick build-essential
## command 2- Adicionar packages mongodb
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
## command 3- Adicionar repository mongodb
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
## command 4- Atualizar ubuntu e instalar mongodb
apt-get update
apt-get install mongodb-org
## command 5- Iniciar mongodb
systemctl enable mongod
systemctl start mongod
netstat -plntu
(ver se MongoDB iniciou na porta 27017)
## command 6- Editar arquivo de configuração mongodb
vim /etc/mongod.conf
(Editar conforme abaixo)
net:
port: 27017
#bindIp: 127.0.0.1
...
#replication:
replication:
oplogSizeMB: 1
replSetName: rs0
## command 7- Reiniciar mongodb
systemctl restart mongod
## command 8- Iniciar shell e ReplicaSet
export LC_ALL=C
mongo
rs.initiate()
(Ver resultado)
{
"info2" : "no configuration specified. Using a default configuration for the set",
"me" : "seu_email:27017",
"ok" : 1
}
## command 9- Instalar NodeJs
apt-get install nodejs npm
## command 10- Instalar pacotes globais
npm install -g n
## command 11- Seta e baixar a versão 4.5
sudo n 4.5
## command 12- Verificar Versões(Node: v4.5.0) (NPM 3.5.2)
node --version
npm -v
## command 13- Baixar a versão atual do Rocket.Chat
cd /home/admin/conf/web/meu.site.com.br/public_html/
curl -L https://rocket.chat/releases/latest/download -o rocket.chat.tgz
tar -xzvf rocket.chat.tgz
(Mova os arquivos da pasta bundle para a raiz ../public_html)
cd /home/admin/conf/web/meu.site.com.br/public_html/programs/server/
npm install
### Edite FILE nginx.conf
server {
listen ip_do_servidor:80;
server_name meu.site.com.br www.meu.site.com.br;
error_log /var/log/apache2/domains/meu.site.com.br.error.log error;
return 301 https://$server_name$request_uri;
}
### FILE snginx.conf
# Upstreams
upstream meu_site_com_br {
server ip_do_servidor:3000;
}
server {
listen ip_do_servidor:443;
server_name meu.site.com.br www.meu.site.com.br;
ssl on;
ssl_certificate /home/admin/conf/web/ssl.meu.site.com.br.pem;
ssl_certificate_key /home/admin/conf/web/ssl.meu.site.com.br.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # dont use SSLv3 ref: POODLE
error_log /var/log/apache2/domains/meu.site.com.br.error.log error;
location / {
proxy_pass http://ip_do_servidor: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;
location ~* ^.+\.(jpg|jpeg|gif|png|ico|svg|css|zip|tgz|gz|rar|bz2|exe|pdf|doc|xls|ppt|txt|odt|ods|odp|odf|tar|bmp|rtf|js|mp3|avi|mpeg|flv|html|htm)$ {
root /home/admin/web/meu.site.com.br/public_html;
access_log /var/log/apache2/domains/meu.site.com.br.log combined;
access_log /var/log/apache2/domains/meu.site.com.br.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/meu.site.com.br/document_errors/;
}
location @fallback {
proxy_pass http://ip_do_servidor:3000;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/snginx.meu.site.com.br.conf*;
}
## command 14- Iniciar Servidor
cd /home/admin/conf/web/meu.site.com.br/public_html/
export ROOT_URL=https://meu.site.com.br
export MONGO_URL=mongodb://meu.site.com.br:27017/rocketchat?replicaSet=rs0
export PORT=3000
node main.js
# Por fim
systemctl restart nginx
#FONTE
https://www.howtoforge.com/tutorial/how-to-install-rocket-chat-with-nginx-on-ubuntu-16-04/
https://rocket.chat/docs/installation/manual-installation/ubuntu/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment