Linux Tactic

Streamline Team Communication with RocketChat: A Step-by-Step Guide

Installing and Setting up Rocket.Chat

Are you looking for an open-source messaging platform that allows you to communicate and collaborate with your team? Rocket.Chat is a perfect solution.

It offers a wide range of features and functionalities and can be installed on your server or in the cloud. In this article, we’ll guide you through the process of installing and setting up Rocket.Chat on Ubuntu 18.04.

Prerequisites

Before we start installing Rocket.Chat, let’s make sure we have all the necessary prerequisites. We’ll need to install Node.js, Meteor framework, and MongoDB, which is a NoSQL data store.

Installing Node.js

Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine. To install it, we’ll use npm, which is a package manager for Node.js.

First, update your package list:

sudo apt update

Then, install the required packages:

sudo apt install nodejs npm

To check if Node.js is installed, run the following command:

node -v

You should see the version of Node.js installed on your server.

Installing MongoDB

MongoDB is a popular NoSQL data store used by many applications. To install it on Ubuntu 18.04, add its official repository:

sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv 9DA31620334BD75D9DCB49F368818C72E52529D4

echo “deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list

Then, update your package list:

sudo apt update

Finally, install MongoDB:

sudo apt install -y mongodb-org

To check if MongoDB is running, run the following command:

sudo systemctl status mongod

You should see the status of MongoDB in the output.

Creating a new System User

We’ll create a new user and group for the Rocket.Chat server. We’ll also add the www-data user to the rocket group, which is required for file permissions.

sudo adduser –system –group rocket

sudo usermod -aG rocket www-data

Installing Rocket.Chat

Now that we have all the prerequisites installed, we can proceed to install Rocket.Chat. We’ll install the stable version of Rocket.Chat using npm packages.

We’ll also set environment variables required for the installation. First, switch to the rocket user:

sudo su – rocket

Then, install Rocket.Chat:

npm install rocket.chat –unsafe-perm

Finally, set the environment variables:

export ROOT_URL=http://your_server_ip:3000/

export PORT=3000

Creating a Systemd unit

We’ll create a Systemd unit for the Rocket.Chat server. This allows us to manage it as a service.

First, create a unit file:

sudo nano /etc/systemd/system/rocketchat.service

Add the following contents:

[Unit]

Description=Rocket.Chat server

After=network.target remote-fs.target nss-lookup.target nginx.service mongod.service

[Service]

ExecStart=/usr/bin/nodejs /home/rocket/Rocket.Chat/main.js

Restart=always

StandardOutput=syslog

StandardError=syslog

SyslogIdentifier=rocketchat

User=root

Group=root

Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01

Environment=MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01

Environment=ROOT_URL=http://your_server_ip:3000/

Environment=PORT=3000

WorkingDirectory=/home/rocket/Rocket.Chat

[Install]

WantedBy=multi-user.target

Then, reload the systemd daemon:

sudo systemctl daemon-reload

Start the service:

sudo systemctl start rocketchat.service

And enable it to start at boot time:

sudo systemctl enable rocketchat.service

Setting up a reverse proxy with Nginx

Finally, we’ll set up a reverse proxy with Nginx. This allows us to serve Rocket.Chat over HTTPS.

We’ll also enable Let’s Encrypt SSL certificates. First, install Nginx:

sudo apt install nginx

Then, create a server block:

sudo nano /etc/nginx/sites-available/your_domain.conf

Add the following contents:

server {

listen 80;

server_name your_domain;

return 301 https://$host$request_uri;

}

server {

listen 443 ssl;

server_name your_domain;

ssl_certificate /etc/letsencrypt/live/your_domain/fullchain.pem;

ssl_certificate_key /etc/letsencrypt/live/your_domain/privkey.pem;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

location / {

proxy_pass http://your_server_ip: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-Forward-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forward-Proto http;

proxy_set_header X-Nginx-Proxy true;

proxy_redirect off;

}

}

Activate the server block:

sudo ln -s /etc/nginx/sites-available/your_domain.conf /etc/nginx/sites-enabled/

Then, test the configuration:

sudo nginx -t

If there are no errors, reload Nginx:

sudo systemctl reload nginx

And finally, enable Let’s Encrypt SSL certificates:

sudo add-apt-repository ppa:certbot/certbot

sudo apt update

sudo apt install python-certbot-nginx

sudo certbot –nginx -d your_domain

Rocket.Chat Setup Wizard

Now that we have Rocket.Chat installed and the server set up, we can proceed with the Rocket.Chat setup wizard.

Admin user setup

During the setup wizard, we’ll set up an administrator user. We’ll need to provide a username, email, and password.

Organization setup

We’ll also set up an organization. We’ll need to provide a name and an email domain.

Server setup

Finally, we’ll set up the server. We’ll need to provide a server name and a public URL.

Rocket.Chat’s preconfigured gateways and proxies

Rocket.Chat comes with preconfigured gateways and proxies, such as apps marketplace and push notifications. These can be enabled during the setup wizard or later through the admin interface.

Conclusion

Rocket.Chat is a powerful open-source messaging platform that allows you to collaborate and communicate with your team. In this article, we’ve guided you through the process of installing and setting up Rocket.Chat on Ubuntu 18.04.

We’ve also covered the Rocket.Chat setup wizard and its preconfigured gateways and proxies. Happy chatting!

In this article, we learned how to install and set up Rocket.Chat on Ubuntu 18.04.

We outlined the prerequisites required, including Node.js, Meteor framework, and MongoDB, and provided step-by-step instructions for creating a new system user, installing and configuring Rocket.Chat, setting up a reverse proxy with Nginx, and running the Rocket.Chat setup wizard. Ultimately, the article highlights the importance of communication and collaboration for businesses and organizations and provides readers with a useful tool to achieve those goals.

By following the steps outlined in this article, readers can create an open-source messaging platform that’s both efficient and reliable for their teams and enjoy seamless and secure communication that promotes productivity and growth.

Popular Posts