How to deploy Rocket.Chat on CentOS 7

Updated on

6 min read

Deploy Rocket.Chat Nginx on CentOS 7

Rocket.Chat is a complete team communication platform, a self-hosted Slack alternative. It is built with Meteor and provides various features including helpdesk chat, video conferencing, file sharing, voice messages, API, and more.

In this tutorial, we will show you how to install and deploy Rocket.Chat on a CentOS 7 server with Nginx as an SSL reverse proxy.


Make sure that you have met the following prerequisites before continuing with this tutorial:

  • CentOS 7 server, according to the official Rocket.Chat system requirements you need at least 1G of RAM.
  • You are logged in as a user with sudo privileges .
  • You have a domain name pointing to your server IP address. In this article, we will use
  • You have Nginx installed, if not you can install it by following this tutorial.
  • An SSL certificate. You can generate a free one from Let’s Encrypt , or buy one from another provider.

Install Dependencies

Install the following packages which are necessary to build the required npm modules:

sudo yum install epel-release curl GraphicsMagick gcc-c++

Next, install Node.js and npm by typing:

sudo yum install -y nodejs npm

At the time of writing this article, the recommended Node.js version for Rocket.Chat is Node.js v8.11.3.

Issue the following commands to install the n utility and the recommended Node.js version:

sudo npm install -g inherits nsudo n 8.11.3

MongoDB is a NoSQL document-oriented database and it is used by Rocket.Chat as a data store. Rocket.Chat recommends MongoDB version 3.6.

We will install MongoDB using yum from the official MongoDB repositories.

Open your editor of choice and create the following repository file:

sudo nano /etc/yum.repos.d/mongodb-org.repo

Paste the following content into the file:

name=MongoDB Repository

Save the file and close your text editor .

To install MongoDB, run the following command:

sudo yum install mongodb-org

Once the installation is completed, enable and start the MongoDB service:

sudo systemctl start mongodsudo systemctl enable mongod

Create New System User

Create a new user and group, which will run our Rocket.Chat instance. For simplicity we will name the user rocket:

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

Add the nginx user to the new user group and change the /opt/rocket directory permissions so that the Nginx can access it:

sudo usermod -a -G rocket nginxsudo chmod 750 /opt/rocket

Installing Rocket.Chat

Switch to the user rocket by typing:

sudo su - rocket

Download the latest stable version of Rocket.Chat with curl :

curl -L -o

Once the download is completed extract the archive and rename the directory to Rocket.Chat:

tar zxf bundle Rocket.Chat

Change into the Rocket.Chat/programs/server directory and install all the required npm packages:

cd Rocket.Chat/programs/servernpm install

Before creating systemd unit and setting up a reverse proxy with Nginx it is a good idea to test if the installation was successful.

To do so, start by setting the required environment variables:

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

Next, change back into the Rocket.Chat directory and start the Rocket.Chat server by issuing the following commands:

cd ../../node main.js

If there are no errors you should see the following output:

➔ +---------------------------------------------+
➔ |                SERVER RUNNING               |
➔ +---------------------------------------------+
➔ |                                             |
➔ |  Rocket.Chat Version: 0.71.1                |
➔ |       NodeJS Version: 8.11.3 - x64          |
➔ |             Platform: linux                 |
➔ |         Process Port: 3000                  |
➔ |             Site URL:  |
➔ |     ReplicaSet OpLog: Disabled              |
➔ |          Commit Hash: e73dc78ffd            |
➔ |        Commit Branch: HEAD                  |
➔ |                                             |
➔ +---------------------------------------------+

At this point, Rocket.Chat is installed on your CentOS 7 machine. Stop the Rocket.Chat server with CTRL+C and continue with the next steps.

Create a Systemd Unit

To run Rocket.Chat as a service create a rocketchat.service unit file in the /etc/systemd/system/ directory:

sudo nano /etc/systemd/system/rocketchat.service

Paste the following content into the file:

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


Save and close the file.

Notify systemd that a new unit file was created and start the Rocket.Chat service by executing:

sudo systemctl daemon-reloadsudo systemctl start rocketchat

Check the service status with the following command:

sudo systemctl status rocketchat

The output should look something like this:

● rocketchat.service - Rocket.Chat server
   Loaded: loaded (/etc/systemd/system/rocketchat.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2018-04-10 20:30:56 UTC; 8s ago
 Main PID: 32356 (node)
   CGroup: /system.slice/rocketchat.service
           └─32356 /usr/local/bin/node /opt/rocket/Rocket.Chat/main.js

If there are no errors you can enable the Rocket.Chat service to be automatically started at boot time:

sudo systemctl enable rocketchat

Set up a reverse proxy with Nginx

If you followed our how to install Nginx on CentOS 7 and how to secure Nginx with Let’s Encrypt on CentOS 7 guides you should already have Nginx installed and configured with SSL certificate.

Now we need to create a new server block for our Rocket.Chat installation:

sudo nano /etc/nginx/conf.d/

Paste the following content into the file:

upstream rocketchat_backend {

server {
    listen 80;

    include snippets/letsencrypt.conf;
    return 301$request_uri;

server {
    listen 443 ssl http2;

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

    return 301$request_uri;

server {
    listen 443 ssl http2;

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

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

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

        proxy_redirect off;

Reload the Nginx service for changes to take effect:

sudo systemctl reload nginx

Configuring Rocket.Chat

Open your browser and type:

Assuming that installation is successful, you’ll be presented with the Rocket.Chat Setup Wizard which will guide you through setting up your first admin user, configuring your organization and registering your server to receive free push notifications and more.

The first section of the Initial Setup wizard will ask you to set up your Admin user:

Rocket.Chat Setup Wizard - Step 1

Once you are done entering the Admin info click on the Continue button and in the next step enter your organization info:

Rocket.Chat Setup Wizard - Step 2

The third section of the Initial Setup wizard will prompt you to enter the server information:

Rocket.Chat Setup Wizard - Step 3

In the next step you will be asked whether you want to use the Rocket.Chat’s preconfigured gateways and proxies. Selecting this option will give you access to the Rocket.Chat Apps marketplace and most of the other features such as push notifications will just work out of the box.

Rocket.Chat Setup Wizard - Step 4

Make your choice, click on the Continue button, and you will be redirected to the following page indicating that your workspace is ready to use:

Rocket.Chat Setup Wizard - Step 4

Click on the Go to your workspace button and you will be redirected to the Rocket.Chat dashboard logged in as the admin user.


You have successfully installed Rocket.Chat on your CentOS 7 server. You can now start using Rocket.Chat to collaborate with your team, share files and chat in real time.

If you are facing any problem with the installation, feel free to leave a comment.