Installing Rocket.Chat on Ubuntu 16.04
Updated by Linode Written by Linode
Rocket.Chat is an open source chat software alternative to Slack that ships with the feature rich components users have come to expect for team productivity. Chat with team members, make video and audio calls with screen sharing, create channels and private groups, upload files and more. With Rocket.Chat’s source code hosted on GitHub, you can develop new features and contribute back to the project.
This guide provides the steps to deploy Rocket.Chat on a Linode running Ubuntu 16.04 LTS, using NGINX as a reverse proxy with SSL.
Before You Begin
Familiarize yourself with our Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.
This guide uses sudo wherever possible. Complete the sections of our Securing Your Server guide to create a standard user account, harden SSH access and remove unnecessary network services.
Complete the Add DNS Records steps to register a domain name that will point to your Rocket.Chat server instance.
Ensure your system is up to date:
sudo apt update && sudo apt upgrade
Install Rocket.Chat
The quickest way to install Rocket.Chat is to use its Snap. Snaps are containerized software packages that run on all major Linux systems. Snapd is the service that runs and manages snaps. Snapd is installed by default on Ubuntu 16.04 LTS.
Install Rocket.Chat
sudo snap install rocketchat-server
Once installed, the Rocket.Chat service starts automatically. To check if Rocket.Chat is running:
sudo service snap.rocketchat-server.rocketchat-server status
Visit the Rocket.Chat snaps documentation to view a list of other useful commands.
Install and Configure NGINX to use Reverse Proxy and SSL
A reverse proxy is a server that sits between internal applications and external clients, forwarding client requests to the appropriate server. While many common applications are able to function as servers on their own, NGINX has a number of advanced load balancing, security, and acceleration features that most specialized applications lack. Using NGINX as a reverse proxy enables you to add these features to any application. We will use NGINX as a reverse proxy for Rocket.Chat.
Install NGINX
Download NGINX from the package manager:
sudo apt install nginx
Ensure NGINX is running and and enabled to start automatically on reboot:
sudo systemctl start nginx sudo systemctl enable nginx
Set up NGINX Reverse Proxy
Disable the default Welcome to NGINX page. The default page is configured within
/etc/nginx/sites-enabled/default
. This is actually a link to a file within/etc/nginx/sites-available/
:sudo ls -l /etc/nginx/sites-enabled
total 0 lrwxrwxrwx 1 root root 34 Aug 16 14:59 default -> /etc/nginx/sites-available/default
Remove this link to disable the default site:
sudo rm /etc/nginx/sites-enabled/default
Create
/etc/nginx/sites-available/rocketchat.conf
and add the necessary values to point to your domain name and to add the reverse proxy. Replaceexample.com
with your domain name:- /etc/nginx/conf.d/rocketchat.conf
-
1 2 3 4 5 6 7 8 9
server { listen 80; server_name example.com; location / { proxy_pass http://localhost:3000/; } }
Enable the new configuration by creating a link to it from
/etc/nginx/sites-available/
:sudo ln -s /etc/nginx/sites-available/rocketchat.conf /etc/nginx/sites-enabled/
Test the configuration:
sudo nginx -t
If no errors are reported, reload the new configuration:
sudo nginx -s reload
Generate SSL certificates using Certbot
Your Rocket.Chat site will use an SSL certificate from Let’s Encrypt, which is a free certificate provider trusted by common web browsers. A popular tool called Certbot makes getting and using a Let’s Encrypt certificate easy:
Install the Certbot and web server-specific packages, then run Certbot:
sudo apt-get update sudo apt-get install software-properties-common sudo add-apt-repository ppa:certbot/certbot sudo apt-get update sudo apt-get install python-certbot-nginx sudo certbot --nginx
Certbot will ask for information about the site. The responses will be saved as part of the certificate:
# sudo certbot --nginx Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator nginx, Installer nginx Which names would you like to activate HTTPS for? ------------------------------------------------------------------------------- 1: example.com 2: www.example.com ------------------------------------------------------------------------------- Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel):
Certbot will also ask if you would like to automatically redirect HTTP traffic to HTTPS traffic. It is recommended that you select this option.
When the tool completes, Certbot will store all generated keys and issued certificates in the
/etc/letsencrypt/live/$domain
directory, where$domain
is the name of the domain entered during the Certbot certificate generation step.Note
Certbot recommends pointing your web server configuration to the default certificates directory or creating symlinks. Keys and certificates should not be moved to a different directory.Finally, Certbot will update your web server configuration so that it uses the new certificate, and also redirects HTTP traffic to HTTPS if you chose that option.
If you have a firewall configured on your Linode, you can add a firewall rule to allow incoming and outgoing connections to the HTTPS service. On Ubuntu, UFW is a commonly used and simple tool for managing firewall rules. Install and configure UFW for HTTP and HTTPS traffic:
sudo apt install ufw sudo systemctl start ufw && sudo systemctl enable ufw sudo ufw allow http sudo ufw allow https sudo ufw enable
View Your Rocket.Chat Site
Certbot updated your NGINX configuration. Test the new configuration to make sure it works:
sudo nginx -t
If no errors are reported, reload the new configuration:
sudo nginx -s reload
In a browser, navigate to your domain address. Follow the Rocket.Chat setup wizard steps.
More Information
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
- Deploying Rocket.Chat on Ubuntu
- NGINX Reverse Proxy – NGINX
- Configuring SSL Reversae Proxy
- Configuring HTTPS Servers
Join our Community
Find answers, ask questions, and help others.
This guide is published under a CC BY-ND 4.0 license.