Let's Chat is a free, open source chat application. It is very lightweight and written in Node.js. It uses MongoDB to store the application data. Let's Chat has many features such as LDAP Authentication, XMPP multi user chat, Desktop notifications, Private chat rooms, File uploads etc. The application is available in more than 18 languages.
In this tutorial, we will learn to install Let's Chat on CentOS 7.
Let's Chat can be installed on a server with a small amount of memory. The requirement of RAM increases as the number of users increases. You will also need a minimal installation of CentOS 7 with root access on it. If you are logged in as a non-root user, you can run sudo -i to switch to root user.
Installing Let's Chat
Before installing any package it is recommended that you update the packages and repository using the following command.
yum -y update
Once your system is updated, you will need to install Node.js. To install the latest version of Node.js from the nodesource repository, run the following command.
Let's Chat uses MongoDB to store its data. MongoDB community version is not found on the YUM 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.
You can now start the application using the following command.
systemctl start letschat
To enable the application to automatically start at boot time run the following command.
systemctl enable letschat
You can check the status of the service using the following command.
systemctl status letschat
Instead of accessing the application on port 5000, you should create a reverse proxy for your application with either Apache or nginx. In this tutorial, we are going to use Apache as the reverse proxy for your application. We will also secure the application using Let's Encrypt free SSL. If you want to use more secure and trusted SSL certificates, you can purchase SSL certificates from HostPresto also.
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
Now you can start the Let's Chat service if not started already using the following command.
systemctl start letschat
Now you will need to disable your SELinux because reverse proxy does not work with SELinux policies. To temporary disable SELinux without restarting the server, run the following command.
To completely disable the SELinux you will need to edit the /etc/selinux/config file.
If you don't have nano installed, you can install it using yum -y install nano Find the following line:
Change it to:
Now you will need to reboot your server so that the new configuration can take effect. Once the server is up again you can access your application at the following URL.
In this tutorial, we have learned how to install Let's 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...