Rocket.Chat is an excellent open-source, free chat software solution that you can host on your own servers in your own environment. It is considered an alternative to Slack and offers similar functionality, including video chat and conferencing, file sharing, help desk systems and much more.
Rocket.Chat brings teams together to collaborate on projects so that work can be done as quickly and efficiently as possible… Whether you are a small or a large organization, this platform can help your team communicate and share ideas… and these conversations will be available on the desktop, on mobile devices, and anywhere the Rocket.Chat app is installed…
This short tutorial explains to new users how to install a Rocket.Chat server on an Ubuntu 18.04 LTS server.
For more information about Rocket.Chat, please visit its home page .
Some of the available features are listed below:
- Real-time translation
- Incoming and outgoing WebHook integrations with Rocket.Chat
- Live chat / Messaging call center / Voice calls
- Powerful APIs
- File upload and sharing
- Web, Desktop and Mobile apps for Linux, Android, iOS, Windows and Mac
- Remote video monitoring
- Custom themes, emojis, sounds and company assets
- and more…
When you are ready to install Rocket.Chat, follow the steps below:
Step 1: Install MongoDB
Rocket.Chat relies on the MongoDB database server. You will need to install and configure MongoDB before continuing. Follow the guide below to do so:
To get the latest version of MongoDB, you must add its repository to Ubuntu. To do this, run the following command to add the official repository key.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4--recv 9DA31620334BD75D9DCB49F368818C72E52529D4
After adding the repository key to Ubuntu, run the following command to add the MongoDB repository to your system…
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
Now that the repository and key have been added to Ubuntu, run the following commands to install the package.
sudo apt update
sudo apt install -y mongodb-org
After MongoDB is installed, the following commands can be used to stop, start and enable MongoDB to start automatically when the system boots.
ssudo systemctl stop mongod.service
sudo systemctl start mongod.service
sudo systemctl enable mongod.service
By default, MongoDB listens on port 27017. After installation, the local server should be able to communicate with MongoDB. To verify that MongoDB is running, run the following command:
sudo systemctl status mongod
You should see something similar to the following lines:
chat@ubuntu1804:~$ sudo systemctl status mongod
● mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2018-01-27 08:53:42 CST; 13min ago
Docs: https://docs.mongodb.org/manual
Main PID: 2383 (mongod)
Tasks: 23
Memory: 60.7M
CPU: 2.613s
CGroup: /system.slice/mongod.service
└─2383 /usr/bin/mongod --config /etc/mongod.conf
Jan 27 08:53:42 ubuntu1604 systemd[1]: Started High-performance, schema-free document-oriented database.
Jan 27 09:05:49 ubuntu1604 systemd[1]: Started High-performance, schema-free document-oriented database.
Configure MongoDB to support Rocket.Chat
Rocket.Chat uses a MongoDB replica set to improve performance through Meteor Oplog tailing .
Note: please check the release notes to make sure you are using a compatible version of Mongo.
To configure the replica set, add this section to /etc/mongod.conf :
sudo nano /etc/mongod.conf
Then copy and paste the lines at the end of the file and save.
replication:
replSetName: "rs01"
You can make the same settings as above by running the following command:
echo -e “replication:\n replSetName: \”rs01\”” | sudo tee -a /etc/mongod.conf
After running the commands above, run this to restart the MongoDB service:
sudo systemctl restart mongod
Next, start the MongoDB shell
mongo
Then run the following command to initiate the replica set
rs.initiate()
The output of the command should look like this:
{
"operationTime" : Timestamp(1562351876, 1),
"ok" : 0,
"errmsg" : "already initialized",
"code" : 23,
"codeName" : "AlreadyInitialized",
"$clusterTime" : {
"clusterTime" : Timestamp(1562351876, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
}
}
Exit, and you are done with MongoDB.
Step 2: Install Node.js
Rocket.Chat also requires Node.js, and the following steps show you how to install it on Ubuntu. At the time of writing, Rocket.Chat only supports Node.js from the 8.x repository .
sudo apt install nodejs npm build-essential curl software-properties-common graphicsmagick
After that, run the commands to get the recommended node and n packages.
sudo npm install -g inherits n && sudo n 8.11.4
After installation, both Node.js and the NPM modules should be installed and ready to use….
Step 3: Install the Rocket.Chat Server
Now that you have installed both MongoDB and Node.js, run the following commands to install Rocket.Chat.
First, run the following command to create a new user account for Rocket.Chat. You probably do not want to run it as root.
sudo useradd -m -U -r -d /opt/rocketchat rocketchat
Switch to the rocketchat user:
sudo su - rocketchat
The following commands assume you are currently running as the rocketchat user.
Next, download the latest Rocket.Chat server package to the rocketchat user's home directory.
curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz
Once downloaded, extract the Rocket.Chat archive and run npm install:
tar zxvf rocket.chat.tgz
mv bundle Rocket.Chat
cd /opt/rocketchat/Rocket.Chat/programs/server
npm install
After that, run the following lines:
export ROOT_URL=http://example.com:3000
export MONGO_URL=mongodb://localhost:27017/rocketchat
export MONGO_OPLOG_URL=mongodb://localhost:27017/local?replSet=rs01
export PORT=3000
Then switch to the rocketchat home directory.
cd /opt/rocketchat/Rocket.Chat/
and run the following command
node main.js
If everything goes as expected, you should see the status of the running server.
➔ System ➔ startup
➔ +---------------------------------------------+
➔ | SERVER RUNNING |
➔ +---------------------------------------------+
➔ | |
➔ | Rocket.Chat Version: 1.2.1 |
➔ | NodeJS Version: 8.11.4 - x64 |
➔ | MongoDB Version: 4.0.10 |
➔ | MongoDB Engine: wiredTiger |
➔ | Platform: linux |
➔ | Process Port: 3000 |
➔ | Site URL: http://0.0.0.0:3000/ |
➔ | ReplicaSet OpLog: Enabled |
➔ | Commit Hash: 7475d7628a |
➔ | Commit Branch: HEAD |
➔ | |
➔ +---------------------------------------------+
Exit the rocketchat user session by typing exit (maybe twice). This should bring you back to your account profile.
Next, run the following command to create the Rocket.Chat service.
sudo nano /etc/systemd/system/rocketchat.service
Then copy and paste the following lines into the file and save.
[Unit]
Description=Rocket.Chat server
After=network.target nss-lookup.target mongod.target
[Service]
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocketchat
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat MONGO_OPLOG_URL=mongodb://localhost:27017/local?replSet=rs01 ROOT_URL=http://example.com PORT=3000
ExecStart=/usr/local/bin/node /opt/rocketchat/Rocket.Chat/main.js
[Install]
WantedBy=multi-user.target
Save the file and exit.
Next, enable the rocketchat service we created above.
sudo systemctl daemon-reload
sudo systemctl enable rocketchat
sudo systemctl start rocketchat
Check the status of Rocket.Chat by running the following command:
sudo systemctl status rocketchat
You should see lines similar to the following:
● rocketchat.service - Rocket.Chat server
Loaded: loaded (/etc/systemd/system/rocketchat.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2019-07-05 13:09:07 CDT; 21s ago
Main PID: 4077 (node)
Tasks: 10 (limit: 4915)
CGroup: /system.slice/rocketchat.service
└─4077 /usr/local/bin/node /opt/rocketchat/Rocket.Chat/main.js
Jul 05 13:09:26 ubuntu1804 rocketchat[4077]: ➔ | MongoDB Version: 4.0.10 |
Jul 05 13:09:26 ubuntu1804 rocketchat[4077]: ➔ | MongoDB Engine: wiredTiger |
Jul 05 13:09:26 ubuntu1804 rocketchat[4077]: ➔ | Platform: linux |
Jul 05 13:09:26 ubuntu1804 rocketchat[4077]: ➔ | Process Port: 3000 |
Jul 05 13:09:26 ubuntu1804 rocketchat[4077]: ➔ | Site URL: http://0.0.0.0:3000/ |
Jul 05 13:09:26 ubuntu1804 rocketchat[4077]: ➔ | ReplicaSet OpLog: Enabled |
Jul 05 13:09:26 ubuntu1804 rocketchat[4077]: ➔ | Commit Hash: 7475d7628a |
Jul 05 13:09:26 ubuntu1804 rocketchat[4077]: ➔ | Commit Branch: HEAD |
Jul 05 13:09:26 ubuntu1804 rocketchat[4077]: ➔ | |
Jul 05 13:09:26 ubuntu1804 rocketchat[4077]: ➔ +---------------------------------------------+
Now everything is installed and configured.
Open your browser and browse to the server name followed by port 3000
http://example.com:3000
The setup wizard will guide you through setting up your first administrator user, configuring your organization, registering your server to receive free push notifications, and much more.

Next, enter your organization information and continue

After that, provide your server information

Then register your server.

Next,

That's it!

Congratulations! You have installed the Rocket.Chat server on Ubuntu 18.04 LTS