In this blog post we will show you how to install RocketChat on an Ubuntu 14.04 VPS. RocketChat is a web chat server which runs on Node.js and MongoDB. RocketChat allows you to chat with your colleagues and friends face-to-face over audio and video, upload files, record and transmit voice messages and many more. This guide should work on other Linux VPS systems as well but was tested and written for Ubuntu 14.04 VPS.
Login to your VPS via SSH
ssh user@vps
Update the system and install necessary packages.
sudo apt-get update && sudo apt-get -y upgrade sudo apt-get install -y software-properties-common git nano curl build-essential graphicsmagick
Install Node.Js and npm modules
We will install the latest Node.js package and the Node.js package manager (npm)from the official Ubuntu repository.
sudo apt-get install -y nodejs npm
To install nave globally (Virtual Environments for Node) and set node to version 0.10.43 run:
sudo npm install nave -g sudo nave usemain 0.10.43
Install MongoDB
We will install the latest MongoDB package from the official MongoDB repository.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list sudo apt-get update sudo apt-get install -y mongodb-org
When the installation is complete, we will setup MongoDB replica set. Open your editor of choice
nano /etc/mongod.conf
and append the following at the end of the file
replication:
replSetName: "001-rs"
Once you saved the file, restart the MongoDB service,
sudo service mongod restart
open up the MongoDB shell
sudo mongo
and run
rs.initiate()
you should see something like this:
{ "info2" : "no configuration explicitly specified -- making one", "me" : "vps:27017", "info" : "Config now saved locally. Should come online in about a minute.", "ok" : 1 }
If you get an error message like below, open the /etc/mongod.conf file and change the bind_ip to 0.0.0.0.
"errmsg" : "couldn't initiate : can't find self in the replset config"
Install RocketChat
Download the latest stable Rocket.Chat release to your server
cd /opt/ curl -L https://rocket.chat/releases/latest/download -o rocket.chat.tgz
and unpack the downloaded archive
tar zxvf rocket.chat.tgz
All Rocket.Chat files will be unpacked in a ‘bundle’ directory. We will rename the directory to ‘Rocket.Chat’
mv bundle rocket.chat cd rocket.chat/programs/server npm install cd ../..
Set the necessary environment variables
export ROOT_URL=http://yourdomainname.com:3000/ export MONGO_URL=mongodb://localhost:27017/rocketchat export PORT=3000
Replace ‘yourdomainname.com’ with your actual domain name.
and run the Rocket.Chat server
node main.js
Now, open http://yourdomainname.com:3000 in your favorite web browser and you should see the RocketChat login/register screen. The first user created is the admin user by default.
That’s it. You have successfully installed RocketChat on your Ubuntu 14.04 VPS. For more information about how to manage your RocketChat installation, please refer to the official RocketChat documentation.
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to set RocketChat web chat software for you. They are available 24×7 and will take care of your request immediately. A new version is available here: How to Install Rocket.Chat on Ubuntu 18.04.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.
Hi I’m in the process of following your great tutorial, but I’m running into an error when trying setup Mongo. I receive the following after entering rs.initiate() into the Mongo shell prompt:
{
“info2” : “no configuration explicitly specified — making one”,
“errmsg” : “exception: bad –replSet config string format is: [/,,…]”,
“code” : 13093,
“ok” : 0
}
I’ve tried searching on this error without much luck. Any ideas?
Did you add the ‘replSet=001-rs’ line in the MongoDB config (/etc/mongod.conf) ?