Install Rocket Chat Server on CentOS 8 - CentLinux


Wednesday, 26 August 2020

Install Rocket Chat Server on CentOS 8

Install Rocket Chat Server on CentOS 8

Rocket Chat is a free and open source web chat server. In this article, you will learn how to install Rocket Chat server on CentOS 8.


Table of Contents:


    What is Rocket Chat? :

    Rocket Chat is a web chat server, developed in JavaScript, by using the Meteor full stack framework. Rocket Chat is free and open source and distributed under MIT license.

    It is a great solution for communities and companies wanting to privately host their own chat service or for developers looking forward to build and evolve their own chat platforms. (Courtesy: GitHub)


    Rocket Chat Features:

    Some of the major features of Rocket Chat are:

    • Multiple Rooms
    • Direct Messages
    • Private Groups
    • Public Channels
    • Desktop Notifications
    • Mentions
    • Avatars
    • Markdown
    • Emojis
    • Reactions
    • One Touch Geolocations
    • File Upload / Sharing
    • LDAP Authentication
    • Audio calls
    • Multi-users Audio Conference
    • Screen sharing


    Environment Specification:

    We are using a minimally installed CentOS 8 virtual machine with following specification.

    • CPU - 3.4 Ghz (2 cores)
    • Memory - 2 GB
    • Storage - 20 GB
    • Operating System - CentOS 8.2
    • Hostname –
    • IP Address - /24


    Update CentOS 8 Software Packages:

    Connect with as root user by using a ssh client.

    By following the best practice, we are updating all the software packages in CentOS 8 server before installing Rocket Chat software.

    [root@rocket-chat-server ~]# dnf update -y ... Upgraded: NetworkManager-1:1.22.8-5.el8_2.x86_64 NetworkManager-libnm-1:1.22.8-5.el8_2.x86_64 NetworkManager-team-1:1.22.8-5.el8_2.x86_64 NetworkManager-tui-1:1.22.8-5.el8_2.x86_64 bind-export-libs-32:9.11.13-5.el8_2.x86_64 ca-certificates-2020.2.41-80.0.el8_2.noarch dbus-1:1.12.8-10.el8_2.x86_64 dbus-common-1:1.12.8-10.el8_2.noarch dbus-daemon-1:1.12.8-10.el8_2.x86_64 dbus-libs-1:1.12.8-10.el8_2.x86_64 dbus-tools-1:1.12.8-10.el8_2.x86_64 dnf-4.2.17-7.el8_2.noarch dnf-data-4.2.17-7.el8_2.noarch gnutls-3.6.8-11.el8_2.x86_64 grub2-common-1:2.02-87.el8_2.noarch grub2-pc-1:2.02-87.el8_2.x86_64 grub2-pc-modules-1:2.02-87.el8_2.noarch grub2-tools-1:2.02-87.el8_2.x86_64 grub2-tools-efi-1:2.02-87.el8_2.x86_64 grub2-tools-extra-1:2.02-87.el8_2.x86_64 grub2-tools-minimal-1:2.02-87.el8_2.x86_64 iptables-1.8.4-10.el8_2.1.x86_64 iptables-ebtables-1.8.4-10.el8_2.1.x86_64 iptables-libs-1.8.4-10.el8_2.1.x86_64 kernel-tools-4.18.0-193.14.2.el8_2.x86_64 kernel-tools-libs-4.18.0-193.14.2.el8_2.x86_64 libdnf-0.39.1-6.el8_2.x86_64 libnghttp2-1.33.0-3.el8_2.1.x86_64 microcode_ctl-4:20191115-4.20200609.1.el8_2.x86_64 open-vm-tools-11.0.5-3.el8.x86_64 python3-dnf-4.2.17-7.el8_2.noarch python3-hawkey-0.39.1-6.el8_2.x86_64 python3-libdnf-0.39.1-6.el8_2.x86_64 python3-perf-4.18.0-193.14.2.el8_2.x86_64 selinux-policy-3.14.3-41.el8_2.5.noarch selinux-policy-targeted-3.14.3-41.el8_2.5.noarch systemd-239-31.el8_2.2.x86_64 systemd-libs-239-31.el8_2.2.x86_64 systemd-pam-239-31.el8_2.2.x86_64 systemd-udev-239-31.el8_2.2.x86_64 yum-4.2.17-7.el8_2.noarch Installed: kernel-4.18.0-193.14.2.el8_2.x86_64 kernel-core-4.18.0-193.14.2.el8_2.x86_64 kernel-modules-4.18.0-193.14.2.el8_2.x86_64 Removed: kernel-4.18.0-147.5.1.el8_1.x86_64 kernel-core-4.18.0-147.5.1.el8_1.x86_64 kernel-modules-4.18.0-147.5.1.el8_1.x86_64 Complete!

    Check Kernel version of our CentOS 8 machine.

    [root@rocket-chat-server ~]# uname -r 4.18.0-193.6.3.el8_2.x86_64

    Check version of our CentOS 8 operating system.

    [root@rocket-chat-server ~]# cat /etc/redhat-release CentOS Linux release 8.2.2004 (Core)


    Installing MongoDB Database on CentOS 8:

    To install MongoDB database server, we need to add MongoDB official yum repository in our CentOS 8 machine.

    Create a repo file for MongoDB yum repository.

    [root@rocket-chat-server ~]# vi /etc/yum.repos.d/mongodb-org-4.2.repo

    Add following directives in this file.

    [mongodb-org-4.2] name=MongoDB Repository baseurl=$releasever/mongodb-org/4.2/x86_64/ gpgcheck=1 enabled=1 gpgkey=

    Build cache for MongoDB yum repository.

    [root@rocket-chat-server ~]# dnf makecache CentOS-8 - AppStream 4.4 kB/s | 4.3 kB 00:00 CentOS-8 - Base 182 B/s | 3.9 kB 00:21 CentOS-8 - Extras 2.0 kB/s | 1.5 kB 00:00 MongoDB Repository 9.4 kB/s | 12 kB 00:01 Metadata cache created.

    MongoDB yum repository has been added. Now, we can easily install MongoDB server on CentOS 8 by using dnf command.

    [root@rocket-chat-server ~]# dnf install -y mongodb-org ... Installed: mongodb-org-4.2.9-1.el8.x86_64 mongodb-org-mongos-4.2.9-1.el8.x86_64 mongodb-org-server-4.2.9-1.el8.x86_64 mongodb-org-shell-4.2.9-1.el8.x86_64 mongodb-org-tools-4.2.9-1.el8.x86_64 python2-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x86_64 python2-libs-2.7.17-1.module_el8.2.0+381+9a5b3c3b.x86_64 python2-pip-9.0.3-16.module_el8.2.0+381+9a5b3c3b.noarch python2-pip-wheel-9.0.3-16.module_el8.2.0+381+9a5b3c3b.noarch python2-setuptools-39.0.1-11.module_el8.2.0+381+9a5b3c3b.noarch python2-setuptools-wheel-39.0.1-11.module_el8.2.0+381+9a5b3c3b.noarch Complete!

    Configure following settings in MongoDB configuration files as required by Rocket Chat.

    [root@rocket-chat-server ~]# sed -i "s/^#replication:/replication:\n replSetName: rs01/" /etc/mongod.conf

    Enable and start MongoDB database service.

    [root@rocket-chat-server ~]# systemctl enable --now mongod.service

    Initiate a MongoDB replica set.

    [root@rocket-chat-server ~]# mongo --eval "printjson(rs.initiate())" MongoDB shell version v4.2.9 connecting to: mongodb:// Implicit session: session { "id" : UUID("62a95226-85a3-4716-bf55-e98ed1510cec") } MongoDB server version: 4.2.9 { "info2" : "no configuration specified. Using a default configuration for the set", "me" : "", "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1598207737, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1598207737, 1) }


    Installing Node.js Server on CentOS 8:

    Rocket Chat requires Node.js server to run its services. Therefore, we need to install Node.js on our CentOS 8 server.

    Node.js requires following software packages for compilation and to make the executables. Therefore, we are installing these packages using dnf command.

    [root@rocket-chat-server ~]# dnf install -y gcc-c++ make ... Installed: binutils-2.30-73.el8.x86_64 cpp-8.3.1-5.el8.0.2.x86_64 gcc-8.3.1-5.el8.0.2.x86_64 gcc-c++-8.3.1-5.el8.0.2.x86_64 glibc-devel-2.28-101.el8.x86_64 glibc-headers-2.28-101.el8.x86_64 isl-0.16.1-6.el8.x86_64 kernel-headers-4.18.0-193.14.2.el8_2.x86_64 libmpc-1.0.2-9.el8.x86_64 libstdc++-devel-8.3.1-5.el8.0.2.x86_64 libxcrypt-devel-4.1.1-4.el8.x86_64 make-1:4.2.1-10.el8.x86_64 Complete!

    Before installing Node.js, we need to add Node.js official yum repository in our Linux server.

    Use the following command to install Node.js yum repository on CentOS 8.

    [root@rocket-chat-server ~]# curl -sL | bash ## Installing the NodeSource Node.js 12.x repo... ## Inspecting system... + rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release + uname -m ## Confirming "el8-x86_64" is supported... + curl -sLf -o /dev/null '' ## As yum will try to install Node.js from the AppStream repository instead of the NodeSource repository, the AppStream's version of Node.js has to be disabled. ## Run `sudo yum module enable -y nodejs` to reactivate the AppStream's Node.js repository. + yum module disable -y nodejs Last metadata expiration check: 0:06:13 ago on Sun 23 Aug 2020 12:58:45 PM PKT. Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Disabling modules: nodejs Transaction Summary ================================================================================ Complete! ## Downloading release setup RPM... + mktemp + curl -sL -o '/tmp/tmp.bCqMCmLHXC' '' ## Installing release setup RPM... + rpm -i --nosignature --force '/tmp/tmp.bCqMCmLHXC' ## Cleaning up... + rm -f '/tmp/tmp.bCqMCmLHXC' ## Checking for existing installations... + rpm -qa 'node|npm' | grep -v nodesource ## Run `sudo yum install -y nodejs` to install Node.js 12.x and npm. ## You may also need development tools to build native addons: sudo yum install gcc-c++ make ## To install the Yarn package manager, run: curl -sL | sudo tee /etc/yum.repos.d/yarn.repo sudo yum install yarn

    Node.js yum repository has been added in CentOS 8. Now, we can easily install Node.js by using dnf command.

    [root@rocket-chat-server ~]# dnf install -y nodejs ... Installed: nodejs-2:12.18.3-1nodesource.x86_64 python3-pip-9.0.3-16.el8.noarch python3-setuptools-39.2.0-5.el8.noarch python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64 Complete!


    Installing GraphicsMagick on CentOS 8:

    GraphicsMagick is a robust set of tools and libraries to read, write, and manipulate an image in any of the more popular image formats.

    GraphicsMagick is required by Rocket Chat. GraphicsMagick is not available in standard yum repositories, therefore, we are installing EPEL (Extra Packages for Enterprise Linux) yum repository.

    [root@rocket-chat-server ~]# dnf install -y epel-release ... Installed: epel-release-8-8.el8.noarch Complete!

    Install GraphicsMagick by using dnf command.

    [root@rocket-chat-server ~]# dnf install -y GraphicsMagick ... Installed: GraphicsMagick-1.3.34-1.el8.x86_64 fontconfig-2.13.1-3.el8.x86_64 fontpackages-filesystem-1.44-22.el8.noarch jasper-libs-2.0.14-4.el8.x86_64 jbigkit-libs-2.1-14.el8.x86_64 lcms2-2.9-2.el8.x86_64 libICE-1.0.9-15.el8.x86_64 libSM-1.2.3-1.el8.x86_64 libX11-1.6.8-3.el8.x86_64 libX11-common-1.6.8-3.el8.noarch libXau-1.0.8-13.el8.x86_64 libXcursor-1.1.15-3.el8.x86_64 libXext-1.3.3-9.el8.x86_64 libXfixes-5.0.3-7.el8.x86_64 libXi-1.7.9-7.el8.x86_64 libXinerama-1.1.4-1.el8.x86_64 libXmu-1.1.2-12.el8.x86_64 libXrandr-1.5.1-7.el8.x86_64 libXrender-0.9.10-7.el8.x86_64 libXt-1.1.5-12.el8.x86_64 libXxf86misc-1.0.4-1.el8.x86_64 libXxf86vm-1.1.4-9.el8.x86_64 libfontenc-1.1.3-8.el8.x86_64 libjpeg-turbo-1.5.3-10.el8.x86_64 libmcpp-2.7.2-20.el8.x86_64 libtiff-4.0.9-17.el8.x86_64 libwebp-1.0.0-1.el8.x86_64 libwmf-lite-0.2.9-8.el8_0.x86_64 libxcb-1.13.1-1.el8.x86_64 mcpp-2.7.2-20.el8.x86_64 urw-base35-bookman-fonts-20170801-10.el8.noarch urw-base35-c059-fonts-20170801-10.el8.noarch urw-base35-d050000l-fonts-20170801-10.el8.noarch urw-base35-fonts-20170801-10.el8.noarch urw-base35-fonts-common-20170801-10.el8.noarch urw-base35-gothic-fonts-20170801-10.el8.noarch urw-base35-nimbus-mono-ps-fonts-20170801-10.el8.noarch urw-base35-nimbus-roman-fonts-20170801-10.el8.noarch urw-base35-nimbus-sans-fonts-20170801-10.el8.noarch urw-base35-p052-fonts-20170801-10.el8.noarch urw-base35-standard-symbols-ps-fonts-20170801-10.el8.noarch urw-base35-z003-fonts-20170801-10.el8.noarch xorg-x11-font-utils-1:7.5-40.el8.x86_64 xorg-x11-server-utils-7.7-27.el8.x86_64 Complete!

    Install inherits and n packages by using npm (Node Package Manager) command.

    [root@rocket-chat-server ~]# npm install -g inherits n /usr/bin/n -> /usr/lib/node_modules/n/bin/n + inherits@2.0.4 + n@6.7.0 added 2 packages from 4 contributors in 2.858s

    Install the Node.js 12.14.0 as required by Rocket Chat server.

    [root@rocket-chat-server ~]# n 12.14.0 installing : node-v12.14.0 mkdir : /usr/local/n/versions/node/12.14.0 fetch : installed : v12.14.0 (with npm 6.13.4) Note: the node command changed location and the old location may be remembered in your current shell. old : /usr/bin/node new : /usr/local/bin/node To reset the command location hash either start a new shell, or execute PATH="$PATH"


    Installing Rocket Chat Server on CentOS 8:

    Download latest version of Rocket Chat by using following command.

    [root@rocket-chat-server ~]# curl -L -o /tmp/ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 132 100 132 0 0 106 0 0:00:01 0:00:01 --:--:-- 106 100 158M 100 158M 0 0 1056k 0 0:02:33 0:02:33 --:--:-- 1711k

    Extract downloaded zip file in temporary directory.

    [root@rocket-chat-server ~]# tar -xzf /tmp/ -C /tmp

    Install Rocket Chat server on CentOS 8 by using npm command.

    [root@rocket-chat-server ~]# cd /tmp/bundle/programs/server [root@rocket-chat-server server]# npm install npm WARN deprecated request@2.88.2: request has been deprecated, see npm WARN deprecated har-validator@5.1.5: this library is no longer supported > fibers@4.0.3 install /tmp/bundle/programs/server/node_modules/fibers > node build.js || nodejs build.js `linux-x64-72-glibc` exists; testing Binary is fine; exiting npm WARN lifecycle meteor-dev-bundle@~install: cannot run in wd meteor-dev-bundle@ node npm-rebuild.js (wd=/tmp/bundle/programs/server) added 146 packages from 122 contributors and audited 147 packages in 22.341s 2 packages are looking for funding run `npm fund` for details found 0 vulnerabilities

    Move Rocket Chat software to /opt directory.

    [root@rocket-chat-server server]# mv /tmp/bundle /opt/Rocket.Chat

    Create an user to own Rocket Chat software and processes.

    [root@rocket-chat-server server]# useradd -M rocketchat

    Lock rocketchat user, so nobody can use it to login to our Linux server.

    [root@rocket-chat-server server]# usermod -L rocketchat

    Grant ownership of Rocket Chat software to rocketchat user.

    [root@rocket-chat-server server]# chown -R rocketchat:rocketchat /opt/Rocket.Chat


    Create Systemd Service for Rocket Chat:

    To configure autostart of Rocket Chat service, we need to create a systemd unit.

    Create a unit file for Rocket Chat service by using vim editor.

    [root@rocket-chat-server server]# vi /lib/systemd/system/rocketchat.service

    Add following directives in this file.

    [Unit] Description=The Rocket.Chat server [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://localhost:3000/ PORT=3000 [Install]

    Enable and start Rocket Chat service.

    [root@rocket-chat-server ~]# systemctl enable --now rocketchat.service Created symlink /etc/systemd/system/ รข /usr/lib/systemd/system/rocketchat.service.


    Configure Linux Firewall for Rocket Chat:

    Node.js uses default port 3000. Therefore, to access Rocket Chat web interface, we need to allow the incoming traffic to this port in Linux firewall.

    [root@rocket-chat-server ~]# firewall-cmd --permanent --add-port=3000/tcp success [root@rocket-chat-server ~]# firewall-cmd --reload success


    Accessing Rocket Chat Web Interface:

    Open URL in a web browser.


    Provide Admin info and click on Continue.


    We need to provide the Organization info on this page. Click on Continue.


    Provide the Server info and click on Continue.


    Register your Rocket Chat server online or keep it stand alone. Click on Continue.


    Your Rocket Chat workplace is ready to use now. Click on Go to workplace.


    You are now at the Home page of Rocket Chat web interface. Click on Administration from the top-left toolbar.




    We have successfully installed Rocket Chat server on CentOS 8. If you found this article to advanced, then you should buy and read How Linux Works, 2nd Edition: What Every Superuser Should Know Second Edition written by Brian Ward.