Dec 26, 2023 5 min read

How to Install RocketChat on Ubuntu 20.04

Install rocketchat on ubuntu 20.04 with our step-by-step tutorial. It is a powerful and versatile open-source communication platform.

Install RocketChat on Ubuntu 20.04
Install RocketChat on Ubuntu 20.04
Table of Contents

Choose a different version or distribution


Before we begin talking about how to install RocketChat on Ubuntu 20.04 OS, let’s briefly understand – What is RocketChat?

RocketChat is a powerful and versatile open-source communication platform that enables teams to collaborate effectively. It offers features like real-time messaging, video conferencing, file sharing, and integrations with popular tools.

With its user-friendly interface and extensive customization options, RocketChat enhances productivity and facilitates seamless communication across organizations. Whether for remote teams, businesses, or communities, RocketChat serves as a secure and scalable solution for efficient collaboration.

In this tutorial, you will install the latest version of RocketChat. Also, we will address a few FAQs on how to install RocketChat on Ubuntu 20.04.

Advantages of RocketChat

  1. Real-time communication: RocketChat enables instant messaging and live chat, ensuring quick and efficient collaboration.
  2. Versatile features: With video conferencing, file sharing, and integrations, RocketChat offers a comprehensive suite of tools for productive teamwork.
  3. Open-source flexibility: Being open-source, RocketChat allows customization and integration with existing systems, adapting to unique organizational needs.
  4. Secure and private: RocketChat prioritizes data privacy and provides end-to-end encryption, ensuring confidential communication within teams.
  5. Scalable solution: From small teams to large organizations, RocketChat accommodates growth and delivers a scalable platform for seamless collaboration.

Prerequisites to Install RocketChat on Ubuntu 20.04

  • Ubuntu 20.04 (or) 22.04 64-bit operating system
  • A user account with sudo privileges
  • Command-line/terminal

Step 1 – Install Required Dependency Packages

1) First, install the official MongoDB packages with the following repository file by updating and configuring the package list and apt.

sudo apt-get -y update

Install essential packages:

sudo apt install gnupg2 gnupg git unzip build-essential curl software-properties-common graphicsmagick gcc g++ make net-tools -y
wget -qO - | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list

2) After that, use the package manager to install Node.js.

sudo apt update && sudo apt install -y curl && curl -fsSL | sudo -E bash -

3) Now, it's time to install build tools, MongoDB, and Nodejs:

sudo apt-get install -y mongodb-org nodejs

*In case you got the following error while installing the MongoDB-org package:

The following packages have unmet dependencies:
 mongodb-org-mongos : Depends: libssl1.1 (>= 1.1.1) but it is not installable
 mongodb-org-server : Depends: libssl1.1 (>= 1.1.1) but it is not installable
 mongodb-org-shell : Depends: libssl1.1 (>= 1.1.1) but it is not installable
E: Unable to correct problems, you have held broken packages.

Fix that using the following commands.

echo "deb focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list

sudo apt-get update
sudo apt-get install libssl1.1

After this, again run the MongoDB installation command.

sudo apt install mongodb-org -y
echo "mongodb-org-tools hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-database hold" | sudo dpkg --set-selections
echo "mongodb-org hold" | sudo dpkg --set-selections

Start the MongoDB service

sudo systemctl enable --now mongod
sudo systemctl status mongod

4) Meanwhile, this step is only for Ubuntu 19.04 users.

sudo apt-get install -y npm

5) Finally, it's time to install inherits and n, and the node version required by RocketChat using npm.

sudo npm install -g inherits n && sudo n 14.18.3 && hash -r

Step 2 – Install Rocket Chat

1) Firstly, download the latest RocketChat version.

curl -L -o /tmp/
tar -xzf /tmp/ -C /tmp

2) Now, it's time to install.

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

Step 3 – Configure RocketChat Service

1) Create the RocketChat service file after adding the RocketChat user and then give the correct permissions to the Rocket Chat folder.

1) Create a new RocketChat user and then give the necessary permissions to the RocketChat folder. Now, you need to create a service file for RocketChat.

sudo useradd -M rocketchat && sudo usermod -L rocketchat
sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat
cat << EOF |sudo tee -a /lib/systemd/system/rocketchat.service
Description=The Rocket.Chat server nginx.service mongod.service
ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js

Change IP_SERVER-or_FQDN with your server IP or domain name.

2) Finally, activate and start RocketChat by setting up the storage engine and replication for MongoDB (mandatory for versions > 1).

sudo sed -i "s/^#  engine:/  engine: wiredTiger/"  /etc/mongod.conf
sudo sed -i "s/^#replication:/replication:\n  replSetName: rs01/" /etc/mongod.conf
sudo systemctl daemon-reload && sudo systemctl restart mongod
mongo --eval "printjson(rs.initiate())"
sudo systemctl enable rocketchat && sudo systemctl start rocketchat

Step 4 – Optional configurations

Step 5 – Configure your RocketChat server

After that, visit the configured URL Then you need to create an admin account, and organization, and add the necessary server information.

FAQs to Install RocketChat on Ubuntu 20.04

What are the system requirements for installing RocketChat on Ubuntu 20.04?

You'll need a server with Ubuntu 20.04 LTS, a minimum of 1 GB RAM, and 4 GB of free disk space.

What are the dependencies required for RocketChat on Ubuntu 20.04?

RocketChat requires MongoDB, Node.js, and npm to be installed on your Ubuntu 20.04 system.

How do I install and configure MongoDB for RocketChat on Ubuntu 20.04?

You can install MongoDB by following the official MongoDB installation guide. After installation, configure it to meet RocketChat's requirements.

Can I use a different database instead of MongoDB with RocketChat on Ubuntu 20.04?

No, RocketChat relies on MongoDB as its primary database, and it's recommended to use MongoDB for optimal performance.

Can I set up SSL/TLS encryption for RocketChat on Ubuntu 20.04?

Yes, RocketChat supports SSL/TLS encryption. You can configure a reverse proxy server like Nginx to handle the SSL/TLS termination for RocketChat.

Are there any additional steps required for RocketChat to function properly on Ubuntu 20.04?

After installation and configuration, you may need to open the necessary ports in your firewall, set up DNS records, and configure email settings to ensure RocketChat works smoothly on Ubuntu 20.04.

Can I install RocketChat on other Linux distributions or operating systems?

Yes, RocketChat supports various Linux distributions and operating systems. Refer to the Rocket.Chat documentation for installation instructions specific to your preferred platform.


We hope this detailed tutorial helped you understand how to install RocketChat on your Ubuntu machine. Click here to read more about RocketChat and its functionalities.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.