Rocket.Chat is an open-source communication hub. Key features include free audio and video conferencing, guest access, screen and file sharing, LiveChat, LDAP Group Sync, two-factor authentication (2FA), E2E encryption, SSO, dozens of OAuth providers, and unlimited users, guests, channels, messages, searches, and files.

In this guide, I will show you how to install Rocket.Chat on Ubuntu 20.04 server

Getting Started

Update your system packages to the latest version.

apt update && apt upgrade -y

Install and Configure MongoDB

Add the GPG key.

apt-key adv --keyserver hkp:// --recv 9DA31620334BD75D9DCB49F368818C72E52529D4

Add the MongoDB official repository.

echo "deb [ arch=amd64 ] bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list

Update package list and install MongoDB.

apt update
apt install mongodb-org

Edit MongoDB configuration.

nano /etc/mongod.conf
replSetName: "replica01"
systemctl enable --now mongod

Login to the MongoDB shell and enable the replica.

> rs.initiate()


Install build tools, nginx, curl and graphicsmagic

apt install curl nginx graphicsmagick build-essential

Install nodejs

curl -sL | bash -
apt install nodejs

Install Rocket.Chat

Download the latest version of Rocket.Chat from the official website.

curl -L -o /tmp/

Extract the downloaded file.

tar -xzf /tmp/ -C /tmp

Install Node.js dependencies.

cd /tmp/bundle/programs/server && npm install
mv /tmp/bundle /opt/Rocket.Chat

Configure the Rocket.Chat service

Add the rocketchat user, set the right permissions on the Rocket.Chat folder.

useradd -M rocketchat && usermod -L rocketchat

chown -R rocketchat: /opt/Rocket.Chat

Create a Systemd Service File For Rocket.Chat.

nano /lib/systemd/system/rocketchat.service
Description=The Rocket.Chat server nginx.service mongod.service
ExecStart=/usr/bin/node /opt/Rocket.Chat/main.js
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat ROOT_URL= PORT=3000

Warning! Don’t forget to change ROOT_URL.

Reload the systemd daemon and start the Rocket.Chat service.

systemctl daemon-reload

systemctl enable --now rocketchat

systemctl status rocketchat

Open a web browser and access the configured Site URL as on the screen below.

Configure Nginx for Rocket.Chat

Create an Nginx virtual host configuration file.

 1. Nginx as a reverse proxy.

nano /etc/nginx/conf.d/rocketchat.conf
upstream myrocketchat {

server {
listen 80;

access_log /var/log/nginx/;
error_log /var/log/nginx/;

location / {
proxy_pass http://myrocketchat/;
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;

 2. Nginx as SSL reverse proxy.

nano /etc/nginx/conf.d/rocketchat.conf
upstream backend {

server {
listen 443 ssl;

# You can increase the limit if your need to.
client_max_body_size 200M;

access_log /var/log/nginx/;
error_log /var/log/nginx/;

ssl_certificate /etc/nginx/certificate.crt;
ssl_certificate_key /etc/nginx/certificate.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # don’t use SSLv3 ref: POODLE

location / {
proxy_pass http://backend;
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-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Nginx-Proxy true;

proxy_redirect off;

Check Nginx configuration.

nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Reload Nginx to apply changes.

systemctl reload nginx

Now you are able to access chat using your domain name URL.

Enter Admin and Organization information.

Enter server info and agree to Terms and Privacy Policy.

After that, you will be redirected to the dashboard.

You have successfully installed and configured Rocket.Chat.