Install Rocket Chat Server on CentOS / RHEL 8 - CentLinux


Wednesday, 26 August 2020

Install Rocket Chat Server on CentOS / RHEL 8

Install Rocket Chat Server on CentOS / RHEL 8

Rocket Chat is a free and open source web chat server. In this article, you will learn how to install Rocket Chat server on CentOS / RHEL 8.


Table of Contents:


What is Rocket Chat? :

Rocket Chat is a web chat server, developed in JavaScript, by using the Meteor full stack framework. Rocket Chat is free and open source and distributed under MIT license.

It is a great solution for communities and companies wanting to privately host their own chat service or for developers looking forward to build and evolve their own chat platforms. (Courtesy: GitHub)


Rocket Chat Features:

Some of the major features of Rocket Chat are:

  • Multiple Rooms
  • Direct Messages
  • Private Groups
  • Public Channels
  • Desktop Notifications
  • Mentions
  • Avatars
  • Markdown
  • Emojis
  • Reactions
  • One Touch Geolocations
  • File Upload / Sharing
  • LDAP Authentication
  • Audio calls
  • Multi-users Audio Conference
  • Screen sharing


Environment Specification:

We are using a minimally installed CentOS 8 virtual machine with following specification.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - CentOS Linux 8.2
  • Hostname –
  • IP Address - /24


Update Linux Software Packages:

Connect with as root user by using a ssh client.

By following the best practice, you should update all the software packages in Linux operating system before installing a new software.

# dnf update -y

Check Kernel version of your Linux operating system.

# uname -r

Check version of your Linux operating system.

# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)


Installing MongoDB Server on CentOS / RHEL 8:

To install MongoDB database server, you need to add MongoDB official yum repository in your Linux operating system.

Create a repo file for MongoDB yum repository by using vim text editor.

# vi /etc/yum.repos.d/mongodb-org-4.2.repo

Add following directives in this file.

name=MongoDB Repository

Build cache for MongoDB yum repository.

# dnf makecache
CentOS-8 - AppStream                            4.4 kB/s | 4.3 kB     00:00
CentOS-8 - Base                                 182  B/s | 3.9 kB     00:21
CentOS-8 - Extras                               2.0 kB/s | 1.5 kB     00:00
MongoDB Repository                              9.4 kB/s |  12 kB     00:01
Metadata cache created.

MongoDB yum repository has been added. Now, you can easily install MongoDB server on CentOS / RHEL 8 by executing dnf command.

# dnf install -y mongodb-org

Configure following settings in MongoDB configuration files as required by Rocket Chat software.

# sed -i "s/^#replication:/replication:\n  replSetName: rs01/" /etc/mongod.conf

Enable and start MongoDB database service.

# systemctl enable --now mongod.service

Initiate a MongoDB replica set.

# mongo --eval "printjson(rs.initiate())"
MongoDB shell version v4.2.9
connecting to: mongodb://
Implicit session: session { "id" : UUID("62a95226-85a3-4716-bf55-e98ed1510cec") }
MongoDB server version: 4.2.9
        "info2" : "no configuration specified. Using a default configuration for the set",
        "me" : "",
        "ok" : 1,
        "$clusterTime" : {
                "clusterTime" : Timestamp(1598207737, 1),
                "signature" : {
                        "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                        "keyId" : NumberLong(0)
        "operationTime" : Timestamp(1598207737, 1)


Installing Node.js Server on CentOS / RHEL 8:

Rocket Chat requires Node.js server to run its services. Therefore, you need to install Node.js on your Linux server.

Node.js requires following software packages for compilation and to make the executables. Therefore, we are installing these packages by using dnf command.

# dnf install -y gcc-c++ make

Before installing Node.js, we need to add Node.js official yum repository in our Linux server.

Use the following command to install Node.js yum repository in your Linux server.

# curl -sL | bash

## Installing the NodeSource Node.js 12.x repo...

## Inspecting system...

+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m

## Confirming "el8-x86_64" is supported...

+ curl -sLf -o /dev/null ''

## As yum will try to install Node.js from the AppStream repository
instead of the NodeSource repository, the AppStream's version of Node.js has to be disabled.
## Run `sudo yum module enable -y nodejs` to reactivate the AppStream's Node.js repository.

+ yum module disable -y nodejs
Last metadata expiration check: 0:06:13 ago on Sun 23 Aug 2020 12:58:45 PM PKT.
Dependencies resolved.
 Package           Architecture     Version             Repository         Size
Disabling modules:

Transaction Summary


## Downloading release setup RPM...

+ mktemp
+ curl -sL -o '/tmp/tmp.bCqMCmLHXC' ''

## Installing release setup RPM...

+ rpm -i --nosignature --force '/tmp/tmp.bCqMCmLHXC'

## Cleaning up...

+ rm -f '/tmp/tmp.bCqMCmLHXC'

## Checking for existing installations...

+ rpm -qa 'node|npm' | grep -v nodesource

## Run `sudo yum install -y nodejs` to install Node.js 12.x and npm.
## You may also need development tools to build native addons:
     sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
     curl -sL | sudo tee /etc/yum.repos.d/yarn.repo
     sudo yum install yarn

Node.js yum repository has been added in your Linux operating system. Now, we can easily install Node.js by using dnf command.

# dnf install -y nodejs


Installing GraphicsMagick on CentOS / RHEL 8:

GraphicsMagick is a robust set of tools and libraries to read, write, and manipulate an image in any of the more popular image formats.

GraphicsMagick is required by Rocket Chat. GraphicsMagick is not available in standard yum repositories, therefore, you need to install EPEL (Extra Packages for Enterprise Linux) yum repository.

# dnf install -y epel-release

Now, you can install GraphicsMagick by using dnf command.

# dnf install -y GraphicsMagick

Install inherits and n packages by using npm (Node Package Manager) command.

# npm install -g inherits n
/usr/bin/n -> /usr/lib/node_modules/n/bin/n
+ inherits@2.0.4
+ n@6.7.0
added 2 packages from 4 contributors in 2.858s

Install the Node.js 12.14.0 as required by Rocket Chat server.

# n 12.14.0

  installing : node-v12.14.0
       mkdir : /usr/local/n/versions/node/12.14.0
       fetch :
   installed : v12.14.0 (with npm 6.13.4)

Note: the node command changed location and the old location may be remembered in your current shell.
         old : /usr/bin/node
         new : /usr/local/bin/node
To reset the command location hash either start a new shell, or execute PATH="$PATH"


Installing Rocket Chat Server on CentOS / RHEL 8:

Download latest version of Rocket Chat software by using the following command.

# curl -L -o /tmp/
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   132  100   132    0     0    106      0  0:00:01  0:00:01 --:--:--   106
100  158M  100  158M    0     0  1056k      0  0:02:33  0:02:33 --:--:-- 1711k

Extract downloaded zip file in a temporary directory.

# tar -xzf /tmp/ -C /tmp

You can install Rocket Chat server on Linux by using npm command.

# cd /tmp/bundle/programs/server
# npm install
npm WARN deprecated request@2.88.2: request has been deprecated, see
npm WARN deprecated har-validator@5.1.5: this library is no longer supported

> fibers@4.0.3 install /tmp/bundle/programs/server/node_modules/fibers
> node build.js || nodejs build.js

`linux-x64-72-glibc` exists; testing
Binary is fine; exiting
npm WARN lifecycle meteor-dev-bundle@~install: cannot run in wd meteor-dev-bundle@ node npm-rebuild.js (wd=/tmp/bundle/programs/server)
added 146 packages from 122 contributors and audited 147 packages in 22.341s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Move Rocket Chat software to /opt directory.

# mv /tmp/bundle /opt/Rocket.Chat

Create an user to own Rocket Chat software and processes.

# useradd -M rocketchat

Lock rocketchat user, so nobody can use it to login to our Linux server.

# usermod -L rocketchat

Grant ownership of software directory to rocketchat user.

# chown -R rocketchat:rocketchat /opt/Rocket.Chat


Create Systemd Service for Rocket Chat:

To configure autostart of Rocket Chat server, we need to create a systemd unit.

Create a systemd unit file by using vim editor.

[root@rocket-chat-server server]# vi /lib/systemd/system/rocketchat.service

Add following directives in this file.

Description=The Rocket.Chat server

ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 ROOT_URL=http://localhost:3000/ PORT=3000


Enable and start Rocket Chat service.

# systemctl enable --now rocketchat.service
Created symlink /etc/systemd/system/ รข /usr/lib/systemd/system/rocketchat.service.


Configure Linux Firewall for Rocket Chat:

Node.js uses default port 3000. Therefore, to access Rocket Chat web interface, we need to allow the incoming traffic to this port in Linux firewall.

# firewall-cmd --permanent --add-port=3000/tcp
# firewall-cmd --reload


Accessing Rocket Chat Web Interface:

Open URL in a web browser.


Provide Admin info and click on Continue.


You need to provide the Organization info on this page. Click on Continue.


Provide the Server info and click on Continue.


Register your Rocket Chat server online or keep it stand alone. Click on Continue.


Your Rocket Chat workplace is ready to use now. Click on Go to workplace.


You are now at the Home page of Rocket Chat web interface. Click on Administration from the top-left toolbar.




You have successfully installed Rocket Chat server on CentOS / RHEL 8. If you found this article too advanced, then you should buy and read How Linux Works, 2nd Edition: What Every Superuser Should Know Second Edition written by Brian Ward.


  1. How do you change to port 80 / 443 ?

    1. There are many ways to do it, But I recommend to set a port forwarding by using firewalld.

  2. Followed example from the same kernel and release.

    My rocketchat service keeps failing.

    1. Please discuss it with me on our Facebook page.

  3. Hey. how to set up video calls with Jitsi. video call shows 404
    sorry for my English

    1. Your request has been noted down. We will work on Jitsi a.s.a.p.

  4. Everything worked except when i got to starting Rocket Chat service. I had to do the following:
    Change the path to new nodejs in the service config:
    sudo nano /lib/systemd/system/rocketchat.service
    In the line beginning with “ExecStart=” replace “/usr/local/bin/node” with “/usr/bin/node”