Rocket.Chat is a great self-host alternative to Slack. You can also use it as a live chat for your website.
the minimum According to the official Rocket Rocket.Chat server requirements are:
- Single-core (2 GHz) CPU
- 1 GB RAM
- 30 GB of SSD
This server should be fine for a maximum of 50 active users and a total of 200 users. Jmsolution Meets those requirements.
You will need root access to the server.
Step 1: Update the server and necessary packages
The first step should always be to update the server:
yum update -y
Then, install some required packages (if they are not already installed):
yum install epel-release curl nano tar gcc-c++ make GraphicsMagick -y
Step 2: Install MongoDB
Rocket.Chat uses MongoDB as its database server. To install MongoDB, first create a repo file:
And add the following to the file:
[mongodb-org-4.4] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc
As of writing, the latest recommended MongoDB version is 4.4. While you’re reading this, it may be a different version, so update the file accordingly.
Next, to install MongoDB, run:
yum install mongodb-org -y
Then enable MongoDB at boot and start the service:
systemctl start mongod systemctl enable mongod
Next, install a storage engine and replication for MongoDB with the following command:
sed -i "s/^# engine:/ engine: mmapv1/" /etc/mongod.conf sed -i "s/^#replication:/replication:n replSetName: rs01/" /etc/mongod.conf
Check if everything is okay:
mongo --eval "printjson(rs.initiate())"
Step 3: Install Nodejs
The repository of CentOS 8 has Nodejs version 10.x, but Rocket.Chat must be run with a new node version. To install node 12x, run the following command:
curl -fsSL https://rpm.nodesource.com/setup_12.x | bash -
yum install nodejs -y
Next, you should install the inherit, en, and node versions by Rocket.Chat (as it is written 12.8.4, so check the official docs later.) Run the following command to install them.
npm install -g inherits n n 12.18.4
Read Also : How to install aaPanel in linux
Step 4: Download, install and configure Rocket.Chat
The next step is to download the latest Rocket.Chat:
curl -L https://releases.rocket.chat/latest/download -o /tmp/rocket.chat.tgz
And extract it with the following command:
tar -xzf /tmp/rocket.chat.tgz -C /tmp
To install Rocket.Chat, go to this directory:
And run the following command:
Then, move the content to a new directory for Rocket.Chat (you can use another one):
mv /tmp/bundle /opt/Rocket.Chat
Create a new user for Rocket.Chat:
useradd -M rocketchat && usermod -L rocketchat
Update more permissions:
chown -R rocketchat:rocketchat /opt/Rocket.Chat
Next, create a system file for Rocket.Chat:
with the following:
[Unit] Description=The Rocket.Chat server by quofact.com After=network.target remote-fs.target nss-lookup.target nginx.service mongod.service [Service] ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js StandardOutput=syslog StandardError=syslog SyslogIdentifier=rocketchat User=rocketchat Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 ROOT_URL=http://chat.quofact.com:3000/ PORT=3000 [Install] WantedBy=multi-user.target
The file may vary depending on which folder you have used for Rocket.Chat. Don’t forget to update ROOT_URL with your domain.
And now enable Rocket.Chat to boot and start the service:
systemctl enable rocketchat systemctl start rocketchat
Step 5: Finish the installation
The final step is to complete the installation using the Rocket.Chat setup wizard. Go to the domain you used for this installation (example.com:3000) and follow the self-explanatory steps.
And all! Rocket.Chat is now installed on your CentOS server.