Rocket.chat is an open source application that can be used as a team communication solution and can be deployed on your own server. There are many options for this application, such as chatting with team members and friends, using audio and video chat, interacting with website visitors in real time, sharing files and more. In this tutorial, we will Install and deploy Rocket.Chat on Debian 9 server. Let’s get started!
1. Update the system
Once you are logged in to your server, you need to update and upgrade RPM packages. You can upgrade and upgrade your server with the following commands:
sudo apt update sudo apt upgrade -y
2. Install Dependencies
Before starting the Rocket.Chat installation, you need to install the following required dependencies so that the application can work:
MongoDB – is an open-source leading NoSQL database program written in C++.
cURL- know as “Client URL” is the command-line tool for transferring data.
GraphicsMagick – is a collection of tools and image processing libraries. GraphicsMagick is an ImageMagick fork.
First, we are going to install cURL , MongoDB and GraphicsMagick with this command:
sudo apt install -y curl mongodb graphicsmagick
Run the next command to install the Node.js:
sudo curl -sL https://deb.nodesource.com/setup | sudo bash - sudo apt install -y nodejs
also you need to install the npm package
sudo npm install -g n
Use n to download and install Node.js version 8.9.3 which is required by Rocket.Chat
sudo n 8.9.3
You can check the Node.js current version with the following command:
node --version v8.9.3
In order for some npm packages which require building from source, you will need to install the build-essentials and python-dev packages:
sudo apt install build-essential python-dev
Now when you set all the necessary dependencies we can continue with installing the Rocket.Chat.
3. Installing Rocket.Chat
We will use the curl command to download the Rocket.Chat latest version and we will extract into the /opt directory:
cd /opt curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz tar zxvf rocket.chat.tgz mv bundle Rocket.Chat cd Rocket.Chat/programs/server npm install cd ../..
There are two ways to populate and start the Rocket.Chat. First one is manually to set the necessary environment variables and start the Rocket.Chat:
export ROOT_URL=http://your_domain-or-IP_addres:3000/ export MONGO_URL=mongodb://localhost:27017/rocketchat export PORT=3000
Replace ‘your_domain-or-IP_addres’ with your actual domain name or server’s IP address.
Run the Rocket.Chat server
The second one is to create the Rocket.Chat systemd service unit:
[Unit] Description=RocketChat Server After=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 # The location of node and location of main.js Restart=always # When is set to always, the service will be restarted in any case (hit a timeout, got terminated) RestartSec=15 # If node service crashes, restart the service after 15 seconds StandardOutput=syslog # Output to syslog StandardError=syslog # Output to syslog SyslogIdentifier=nodejs-example #User= #Group= Environment=NODE_ENV=production PORT=3000 ROOT_URL=https://your_domain.com MONGO_URL=mongodb://localhost:27017/rocketchat [Install] WantedBy=multi-user.target
You can change ROOT_URL and replace the domain you want to use. If you do not have an available domain, you can instead enter your IP address on your server. You can also change the port number that is currently set to 3000 to a port number of your choice.
In order to notify the systemd that you just created a new unit file you need to execute the following command:
sudo systemctl daemon-reload
Start the MongoDB and Rocket.Chat services:
sudo systemctl start mongodb sudo systemctl start rocketchat
You can check the status of the service by running the command:
sudo systemctl status rocketchat
Output: ● rocketchat.service - RocketChat Server Loaded: loaded (/etc/systemd/system/rocketchat.service; enabled; vendor preset: disabled) Active: active (running) since Sat 2018-08-25 08:35:50 CDT; 4s ago Main PID: 894 (node) CGroup: /system.slice/rocketchat.service └─894 /usr/local/bin/node /opt/Rocket.Chat/main.js
If the Rocketchat.service is enabled and there are no errors, you can enable it also the automatically to start at boot time:
sudo systemctl enable rocketchat
4. Access Rocket.Chat in the web browser
Now, open http://your_domain-or-IP_addres:3000 in your favorite web browser and you should see the RocketChat login/register screen. The first user created will get administrative privileges by default.
That’s it. You have successfully installed Rocket.Chat on your Debian 9 VPS. For more information about how to manage your Rocket.Chat installation, please refer to the official Rocket.Chat documentation.
Of course, you don’t have to do any of this if you use one of our Debian Cloud VPS plans, in which case you can simply ask our expert Linux admins to set Rocket.Chat web communication and collaboration software for you. They are available 24×7 and will take care of your request immediately.