How To Install and Configure Rocket.Chat on CentOS

Rocket.Chat logo 300x300Rocket.Chat is one of the most feature-rich open-source Slack alternatives, featuring group chat, direct messaging, private rooms, desktop notifications, media embedding, link previews, file uploading, voice/video chat, screensharing, and more. There are native applications for Windows, Mac, and Linux, as well as mobile applications for iOS and Android. Developers can also use hubot to integrate with popular services like GitHub, Gitlab, Confluence, JIRA, and more.

Here we show how to deploy and configure Rocket.Chat on CentOS 7, and this should work well on CentOS-6 too. If you need to install Rocket.Chat on Ubuntu, refer to install and configure on Ubuntu at

The following steps have been tested with and Digital Ocean, and should work on too. I highly recommend you run Rocket.Chat on a VPS server which is aparted from your productive environment, since it does not have direct correlations with existed systems. Running on a VPS host comes as a good choice, you can click one of the links to open an account if you don’t have one.

Add the epel repository and update everything

yum -y install epel-release && yum -y update

Populate the yum repo with the mongodb repository
This command will create an repo configuration file for MongoDB,

cat > /etc/yum.repos.d/mongodb.repo<<__END
name=MongoDB Repository

Now install the dependencies from yum
With this command, we install related packages,

yum install -y nodejs curl GraphicsMagick npm mongodb-org-server mongodb-org gcc-c++

Now that we have Node.js and npm installed, we need to install a few more dependencies,

npm install -g inherits n

Rocket.Chat needs Node.js version 4.5 using n we are going to install that version,

n 4.5

Lets enable Mongodb to start with the host booting using,
On CentOS 6.x,
chkconfig mongod on && /etc/init.d/mongod start
On CentOS 7.x,
systemctl enable mongod && systemctl start mongod

Installing Rocket.Chat
Let’s download and install Rocket.Chat

cd /opt
curl -L -o
tar zxvf
mv bundle Rocket.Chat
cd Rocket.Chat/programs/server
npm install
cd ../..

There are some variables need to be set before running the service,

export PORT=3000
export ROOT_URL=http://your-host-name:3000/
export MONGO_URL=mongodb://localhost:27017/rocketchat

Replace 3000, with the port of your choosing.If you choose to use port 80 you will need to run Rocket.Chat as root.
If you don’t have DNS configured use your IP in place of the hostname. You can change it later in the admin menu.
To make the variables take effect every time when system boots, you can create a file in /etc/profile.d named with the above content,

# cat /etc/profile.d/
export PORT=3000
export ROOT_URL=http://your-host-name:3000/
export MONGO_URL=mongodb://localhost:27017/rocketchat

Now lets do a quick test and see if everything is working before we continue. Start the server,

node main.js

Browse to your new rocket-chat instance by opening your web browser and entering the url http://your-host-name:3000/
Replace your-host-name with the ip address or DNS hostname of your server you set above in the ROOT_URL.
Now that you’re connected. Let’s create an admin account,

  • Click “register a new account”
  • Enter the admin’s name, email and password twice. For my instance I entered:
    * name = admin
    * email =
    * password = R4nd0mPa55
  • Click SUBMIT
  • You will be prompted to select a username. I selected admin.
  • Click USE THIS USERNAME to continue.
  • You should now be logged in as an administrator on your new Rocket.Chat installation.

Hit Ctrl + c in your terminal to stop Rocket.Chat.

Auto Start Rocket.Chat
Now that we have all of the dependencies installed, and have verified that Rocket.Chat works. We need to configure Rocket.Chat to start as a service.
First we create the service file,

cat > /usr/lib/systemd/system/rocketchat.service<<__END
  Description=The Rocket.Chat server
  ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js
  Environment=MONGO_URL=mongodb://localhost:27017/rocketchat ROOT_URL= PORT=3000

Note: Replace the values in Environment with the values you used above.

Now you can enable this service by running,

systemctl enable rocketchat.service

And finally start it by running:

systemctl start rocketchat.service

Finally, don’t forget to install the native applications. Have fun!

Share Button

One thought on “How To Install and Configure Rocket.Chat on CentOS

  1. Thank you for compiling this tutorial. I am using centos6 on my server. I’ve followed this and it worked well to install rocket chat, until the end. Centos6 does not use systemctl commands, and I cannot get rocket chat to boot automatically. Any help in getting rocket chat to boot automatically in centos6 would be greatly appreciated! Thanks again.

Leave a comment

Your email address will not be published. Required fields are marked *