Article

Table of Contents
Theme:
Was this article helpful?
Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $600 by adding new articles.

How to Install Rocket.Chat on Debian 9

Last Updated: Fri, Jun 1, 2018
Debian Server Apps System Admin Web Servers
Archived content

This article is outdated and may not work correctly for current operating systems or software.

Rocket.Chat is an open source Slack-like team communication solution which can be deployed on your own server. With Rocket.Chat, you can chat with your team members and friends over audio and video, interact with website visitors in real time, share files, transmit voice messages, and much more.

Prerequisites

  • A fresh Vultr Debian 9 server instance with at least 1G of memory. Say its IP address is 192.167.100.100.

  • A domain pointing to your server instance. Say it is www.example.com.

1. Update the system

Log in as root and update the system to the latest stable status:

apt update

apt upgrade -y

shutdown -r now

2. Install MongoDB

Install the latest stable version of MongoDB:

apt install mongodb

3. Install Node.js, GraphicsMagick, npm and other dependencies

Rocket.Chat 0.60 and higher needs version 8.9.3 LTS of Node.js to work.

So first add the NodeSource Debian binary distributions repository:

curl -sL https://deb.nodesource.com/setup_8.x | bash -

Then we can install Node.js and other packages:

apt install nodejs curl graphicsmagick -y

npm install -g n

Use n to install Node.js version 8.9.3:

n 8.9.3

4. Install Rocket.Chat

Download and install Rocket.Chat:

cd /opt

curl -L https://rocket.chat/releases/latest/download -o rocket.chat.tgz

tar -zxvf rocket.chat.tgz

mv bundle Rocket.Chat

cd Rocket.Chat/programs/server

npm install

For your convenience, you need to create the RocketChat systemd service unit:

nano /etc/systemd/system/rocketchat.service

Populate the file. Make sure to replace the domain www.example.com with your own:

[Unit]

Description=RocketChat Server

After=network.target remote-fs.target nss-lookup.target mongod.target nginx.target  # Remove or Replace nginx with your proxy



[Service]

ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js    # Specify the location of node and location of main.js

Restart=always     # If set to always, the service will be restarted regardless of whether it exited cleanly or not, got terminated abnormally by a signal, or hit a timeout.

RestartSec=10       # Restart service after 10 seconds if node service crashes

StandardOutput=syslog                     # Output to syslog

StandardError=syslog                   # Output to syslog

SyslogIdentifier=nodejs-example

#User=<alternate user>

#Group=<alternate group>

Environment=NODE_ENV=production PORT=3000 ROOT_URL=https://www.example.com MONGO_URL=mongodb://localhost:27017/rocketchat



[Install]

WantedBy=multi-user.target

Note: In PORT, you can replace 3000 with the port number of your choosing. In ROOT_URL, you can replace www.example.com with your server's IP address 192.168.100.100, if your domain is not available.

Save and quit, CTRL + X, Y.

Start the MongoDB service:

systemctl start mongodb

Start the Rocket.Chat service:

systemctl start rocketchat

5. Access Rocket.Chat in the web browser

Point your web browser to http://www.example.com:3000, and then register the first user for administration. By default, only the first user will get administrative privileges.

Want to contribute?

You could earn up to $600 by adding new articles.