How to Install Rocket.Chat on Debian 9

Using a Different System?

  • How to Install Rocket.Chat on CentOS 7

Are we missing a guide for your target system? Request one, or submit your own!


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.

Step 1: Update the system

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

apt updateapt upgrade -yshutdown -r now

Step 2: Install MongoDB

Install the latest stable version of MongoDB:

apt install mongodb

Step 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 -ynpm install -g n

Use n to install Node.js version 8.9.3:

n 8.9.3

Step 4: Install Rocket.Chat

Download and install Rocket.Chat:

cd /optcurl -L https://rocket.chat/releases/latest/download -o rocket.chat.tgztar -zxvf rocket.chat.tgzmv bundle Rocket.Chatcd Rocket.Chat/programs/servernpm 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 ServerAfter=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.jsRestart=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 crashesStandardOutput=syslog                     # Output to syslogStandardError=syslog                   # Output to syslogSyslogIdentifier=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

Step 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 $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.