Updated 2 July 2020



Rocket.Chat is an open source messenger that provides support for group chats, data exchange, videoconferencing, bot and much more.

Creating LXC container

We recommend that you install Rocket.Chat in a separate container, to be configured according to the manual.

Installing and configuring MongoDB

Install MongoDB:

emerge -a dev-db/mongodb

Configure MongoDB for it to handle Rocket.Chat:

  dbPath: "/var/lib/mongodb"
  engine: mmapv1

  replSetName: rs01

Now start MongoDB:

/etc/init.d/mongodb start

And add it to autostart:

rc-update add mongodb

Initialize the database

mongo --eval "printjson(rs.initiate())"

Getting Let's Encrypt certificate

Get the Nginx domain certificate for для Nginx, as described in the manual.

Installing and configuring Nginx

Install and configure the Nginx Web server as a reverse proxy, as described in the manual. Add the following setting for

server {
    listen 443 ssl;

    include ssl.conf;
    ssl_certificate /etc/nginx/ssl/;
    ssl_certificate_key /etc/nginx/ssl/;
    client_max_body_size 200M;

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

        proxy_redirect off;

Installing and configuring Rocket.Chat

First install accessory software:

emerge -a dev-python/nodeenv media-gfx/graphicsmagick

Create a system user called rocketchat:

useradd -m -d /var/calculate/rocketchat -s /bin/bash rocketchat

Install Node.js to the user directory:

su - rocketchat

nodeenv --node=12.18.0 .node-12

ln -sfT .node-12 .node-live

source .node-live/bin/activate

echo 'source ~/.node-live/bin/activate' >> ~/.bash_profile

Install the server

Using the release server

Download and unpack Rocket.Chat:

curl -L -o Rocket.Chat.tar.gz

tar xf Rocket.Chat.tar.gz

Install all necessary libraries for NodeJS and quit as rocketchat:

cd ~/bundle/programs/server

npm install && exit

Building a server from source code

Install the Meteor framework for the 'web' user:

curl | sh

echo 'PATH="${PATH}:${HOME}/.meteor"' >>.bash_profile


Fetch the source for your future Rocket.Chat server:

git clone Rocket.Chat.Source

Go to the source directory and build the archive:

cd Rocket.Chat.Source

meteor npm install

meteor build --directory ~

Install all necessary libraries for NodeJS and quit as rocketchat:

cd ~/bundle/programs/server

npm install && exit

Running Rocket.Chat

Make the previously obtained Rocket.Chat directory the current one:

mv /var/calculate/rocketchat/{bundle,Rocket.Chat}

Create an OpenRC script to control Rocket.Chat by specifying as ROOT_URL:

# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

name="Rocketchat daemon"
start_stop_daemon_args="-e ROOT_URL=$ROOT_URL -e MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 -e PORT=3000 -e MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 -e PATH=/var/calculate/rocketchat/.node-live/lib/node_modules/.bin:/var/calculate/rocketchat/.node-live/bin:\"$PATH\""

depend() {
        need nginx mongodb

start_pre() {
    checkpath -f -o rocketchat -m 0600 /var/log/rocketchat.log

Set the privileges:

chmod 755 /etc/init.d/rocketchat

Launch the Rocket.Chat daemon:

/etc/init.d/rocketchat start

Add Rocket.Chat to autostart:

rc-update add rocketchat

Go to page in your Internet browser to complete your Rocket.Chat configuration.

Rocket.Chat update

Log in as rocketchat:

su - rocketchat

Get the bundle directory for Rocket.Chat. Several ways to do this are described above in the Server installation section.

Stop the old Rocket.Chat server:

/etc/init.d/rocketchat stop

Replace the old server with the later one:

mv /var/calculate/rocketchat/Rocket.Chat{,.old}

mv /var/calculate/rocketchat/{bundle,Rocket.Chat}

Start the new Rocket.Chat server:

/etc/init.d/rocketchat start