How to Implement Rocket.Chat on Ubuntu 18.04 VPS

Rocket.Chat is among the most popular open source chat application that is an alternative to Slack. It comes with a couple of cool features such as file sharing, voice messages, helpdesk chat, API, video conferencing, and more. is a great option for institutions and groups that intend to host and control a chat system.

This guide will provide the key steps to deploy Rocket.Chat on an Ubuntu 18.04 VPS or dedicated server with Nginx as a reverse proxy with SSL.

Before You Start

Before you start, you’ll need the following:

  • A virtual machine running on 18.04 server. You need to have at least 1GB RAM.
  • A fully installed Nginx
  • A domain name for your server IP address
  • An SSL certificate installed

Step 1 – Installing The Dependencies

This process requires the ‘build-essential’ package to create npm packages from the source. To install this package, run the command below:

$ sudo update
$ sudo apt install build-essential curl

Next, we need Node.js for the installation process, so we will install it together with the Node.js package manager, npm. To do so, run the command below:

$ sudo apt install nodejs npm

Node.js v8.9.3 version is recommended for Rocket, and it’s the latest available version at the time of writing this article.

We will also use n, which is a Node.js Package Manager (npm) package that allows the user to manage the Node.js versions available.

To install n, and the current Node.js version, run the command below:

$ sudo npm install -g inherits n
$ sudo n 8.9.3

We will also need MongoDB which is a database used by Rocket.Chat to store data.

A recent version of MongoDB is available in the official Ubuntu repositories. To install it, type the command below:

$ sudo apt install mongodb

After the installation is done, MongoDB should start automatically.

Step 2 – Creating A System User

Now, create a user and group to run the RocketChat service. We will call the user rocket:

$ sudo useradd -m -U -r -d /opt/rocket rocket

Next, include the www-data user to the already created user group. Also, change the permissions of the /opt/rocket directory to enable Nginx to access the rocket installation file:

$ sudo usermod -a -G rocket www-data
$ sudo chmod 750 /opt/rocket

Step 3 – Installing Rocket.Chat

Start by switching to the rocker user using the command below:

$ sudo su - rocket

To download the latest version of Rocket.Chat using curl, type the following:

$ curl -L -o

After the file is downloaded, extract it then rename the directory to Rocker.Chat:

$ tar zxf
$ mv bundle Rocket.Chat

Next, change to the directory named Rocket.Chat/programs/server then install the necessary npm packages:

$cd Rocket.Chat/programs/server
$ npm install

Now, before we test whether the installation is working properly and create a systemd unit then set it up with Nginx, we need to create the necessary environment parameters then start Rocket.Chat.

$export PORT=3000
$export ROOT_URL=
$export MONGO_URL=mongodb://localhost:27017/rocketchat

Then, change it back to the Rocket.Chat directory and run the commands below to start the Rocket.Chat server:

$cd ../../
$ node main.js

If the process is successful and there are no errors, you will see the output below:

➔ +---------------------------------------------+
➔ |                SERVER RUNNING               |
➔ +---------------------------------------------+
➔ |                                             |
➔ |  Rocket.Chat Version: 0.65.1                |
➔ |       NodeJS Version: 8.9.3 - x64           |
➔ |             Platform: linux                 |
➔ |         Process Port: 3000                  |
➔ |             Site URL:  |
➔ |     ReplicaSet OpLog: Disabled              |
➔ |          Commit Hash: 8349c36de0            |
➔ |        Commit Branch: HEAD                  |
➔ |                                             |
➔ +---------------------------------------------+

Use the key combination CTRL+C to stop the Rocket.Chat server and proceed to the next step.

Step 4 – Creating a Systemd Unit

To ensure Rocket.Chat operates as a service, we need to build a rocket.service file that should be located in the /etc/systemd/system/ directory with the following details:


Description=Rocket.Chat server

Environment=MONGO_URL=mongodb://localhost:27017/rocketchat ROOT_URL= PORT=3000
ExecStart=/usr/local/bin/node /opt/rocket/Rocket.Chat/main.js


Now, inform systemd that a new file has been created then run the commands below to start Rocket.Chat:

$ sudo systemctl daemon-reload
$ sudo systemctl start rocketchat

Check the status of the services using the command below:

$ sudo systemctl status rocketchat

You should get the following output:

● rocketchat.service - Rocket.Chat server
   Loaded: loaded (/etc/systemd/system/rocketchat.service; disabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-06-1502:53:24 PDT; 5s ago
 Main PID: 12543 (node)
    Tasks: 10 (limit: 2321)
   CGroup: /system.slice/rocketchat.service
           `-12543/usr/local/bin/node /opt/rocket/Rocket.Chat/main.js

If there are no errors so far, set the Rocket.Chat to start at boot time:

$ sudo systemctl enable rocketchat

Step 5 – Configuring Nginx as a Reverse Proxy

This tutorial assumes that you have already installed Nginx and configure it with SSL certificate.

Next, create a new server block for the Rocket.Chat service.


upstream rocketchat_backend {

server {

    include snippets/letsencrypt.conf;

server {
    listen443 ssl http2;

    ssl_certificate /etc/letsencrypt/live/;
    ssl_certificate_key /etc/letsencrypt/live/;
    ssl_trusted_certificate /etc/letsencrypt/live/;
    include snippets/ssl.conf;

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

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


Now, restart Nginx to apply these changes:

$ sudo systemctl reload nginx

Step 6 – Setting Up and Testing Rocket.Chat

Go to your web browser and enter the address:

If the installation process is successful, you should see the Rocket.Chat service wizard. Now you can set up your user, configure your company and register your server to ensure it receives any notifications and other services.

The setup wizard will prompt you to set the Admin user as shown below:

How To Implement Rocket Chat on Ubuntu 18

After that, press the Continue button and you will be prompted to provide your company’s information:

How To Implement Rocket Chat on Ubuntu 18

The next section will require you to provide the server details:

How To Implement Rocket Chat on Ubuntu 18

After providing the information, press the Continue button where you will be directed to a new page showing the workspace is set and ready to use:

How To Implement Rocket Chat on Ubuntu 18

Press the Go to your workplace button and you should see the Rocket.Chat web interface.


That’s it! At the end of this guide, you should be able to install the Rocket.Chat service on Ubuntu 18.04 successfully and set up Nginx as a reverse proxy. You can also go to Rocket.Chat guide page to learn and understand the new chat system.

Check out these top 3 Best web hosting services

$2.49 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
  • Support
  • Features
  • Reliability
  • Pricing
$1.00 /mo
Starting price
Rating based on expert review
  • User Friendly
  • Support
  • Features
  • Reliability
  • Pricing
$2.90 /mo
Starting price
Visit Ultahost
Rating based on expert review
  • User Friendly
  • Support
  • Features
  • Reliability
  • Pricing

How to Install Own Cloud On an an Ubuntu 18.04 Dedicated Server or VPS

You can create your own self-hosted cloud storage services by installing the ope
3 min read
Idan Cohen
Idan Cohen
Marketing Expert

How to Enable Two-Factor Authentication on an Ubuntu 18.04 VPS or Dedicated Server

This guide will show you how you enable two-factor authentication to improve the
4 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO

How to Install a Let’s Encrypt Certificate on your Ubuntu 18.04 Dedicated Server or VPS

If you are hosting your website on a VPS server running Ubuntu 18.04, we will sh
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How to install OpenLiteSpeed on an Ubuntu 18.04 VPS or Dedicated Server

OpenLiteSpeed is an open source web server characterized by high-performance, li
3 min read
Kennedy Mbuvi
Kennedy Mbuvi
Author provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top