In this tutorial, we will install Rocket.Chat server on CentOS 7 after installing all the required dependencies. We will also setup Apache as a reverse proxy using Let's Encrypt SSL.
Rockt.Chat requires at least 1GB RAM and Single Core CPU to install, which is enough to server 200 users and 50 active users with activities. To serve more users you will need more resources like to server up to 1000 users and 300 active connection you will need to 6 Core CPU and 4GB RAM. To follow this tutorial you will need a server with minimal CentOS 7 installed. You will also need root access to the server, if you are logged in as non root user, run sudo -i to login in as root user. A domain pointing to your server is also required.
Install Rocket.Chat Server
Before installing any package it is recommended to update the server and available packages. Run the following command to do so.
yum -y update
Rocket.Chat requires few dependencies that are not included in YUM repository thus you will need to install the EPEL repository also.
yum -y install epel-releaseyum -y update
You can now restart your server so that the updates can take effect.
Rocket.Chat uses MongoDB to store its data. MongoDB community version is not found on the YUM or EPEL repository hence you need to install the MongoDB repository. Create a new repo file using the following command.
If you don't have nano installed, you can install it using yum -y install nano. Paste the following lines into the file and save the file and exit the editor using CTRL-O followed by CTRL-X.
Make sure that you change the ROOT_URL parameter in the above lines to your actual domain. Save the file and exit from the editor.
You can now start the application using the following command.
systemctl start rocketchat
To enable the application to automatically start at boot time run the following command.
systemctl enable rocketchat
You can check the status of the service using the following command.
systemctl status rocketchat
Configuring Apache as Reverse Proxy with Let's Encrypt SSL
Install Apache web server and mod_ssl using the following command.
yum -y install httpd mod_ssl
Now start Apache web server and enable it to automatically start at boot time using the following commands.
systemctl start httpdsystemctl enable httpd
Now we will need to generate SSL certificates from Let's Encrypt client. To install Let's Encrypt client also called Certbot, run the following command.
yum -y install python-certbot-apache
Once the installation finishes, run the following command to obtain the SSL certificates from Let's Encrypt. Make sure that your domain is pointed to the server, the Let's Encrypt will check the domain authority before providing the certificates.
certbot certonly --apache -d yourdomain.com
This command will run Let's Encrypt client to obtain the certificates only but not to install it. --apache tells the client to use Apache web server for authentication of domain authority. -d yourdomain.com tells the domain name for which the certificates needs to be obtained. It may ask you which SSL configuration to use during authentication, choose ssl.conf. All the changes made to the file will be automatically restored. Finally provide your email address and accept the terms and condition. Once the certificates are generated, they are likely to be stored in the following directory.
Where yourdomain.com is your actual domain. In the directory, you will find cert.pem which is your domains certificate and privkey.pem which is your certificate's private key.
Let's Encrypt SSL expires in 90 days, so it is recommended to set an automatic renewal for your certificates. Run the following command to open your crontab file.
In the above configuration change yourdomain.com to your actual domain. Also, make sure that the path to your SSL certificate and private key are correct. Once done, you will have to restart your Apache server so that the changes made can take effect.
systemctl restart httpd
Adjust SELinux so that it can connect to the port 3000 using the following command.
setsebool -P httpd_can_network_connect true
Now you can start the Rocket.Chat service if not started already using the following command.
systemctl start rocketchat
Now head to your favorite browser and access the following URL.
In this tutorial, we have learned how to install Rocket.Chat on CentOS 7 Server. You can now deploy the application on your own server to collaborate and communicate in your office to increase the productivity.
Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will...
Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you...