Installing Rocket.Chat on Ubuntu 16.04

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  days.

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

  1. If you have not already done so, create a Linode account and Compute Instance. See our Getting Started with Linode and Creating a Compute Instance guides.

  2. Follow our Setting Up and Securing a Compute Instance guide to update your system. You may also wish to set the timezone, configure your hostname, create a limited user account, and harden SSH access.

  3. Complete the Add DNS Records steps to register a domain name that will point to your Rocket.Chat server instance.

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.

  1. Install Rocket.Chat

    sudo snap install rocketchat-server
    
  2. 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

  1. Download NGINX from the package manager:

    sudo apt install nginx
    
  2. Ensure NGINX is running and enabled to start automatically on reboot:

    sudo systemctl start nginx
    sudo systemctl enable nginx
    

Set up NGINX Reverse Proxy

  1. 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
  2. Remove this link to disable the default site:

    sudo rm /etc/nginx/sites-enabled/default
    
  3. Create /etc/nginx/sites-available/rocketchat.conf and add the necessary values to point to your domain name and to add the reverse proxy. Replace example.com with your domain name:

    File: /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/;
        }
    }
  4. 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/
    
  5. Test the configuration:

    sudo nginx -t
    
  6. 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:

  1. Install the Certbot and web server-specific packages, then run Certbot:

     sudo apt update
     sudo apt install certbot python3-certbot-nginx
     sudo certbot --nginx
    
  2. 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):
  3. Certbot will also ask if you would like to automatically redirect HTTP traffic to HTTPS traffic. It is recommended that you select this option.

  4. 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.

  5. 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

  1. Certbot updated your NGINX configuration. Test the new configuration to make sure it works:

    sudo nginx -t
    
  2. If no errors are reported, reload the new configuration:

    sudo nginx -s reload
    
  3. 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.

This page was originally published on


Your Feedback Is Important

Let us know if this guide was helpful to you.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.
The Disqus commenting system for Linode Docs requires the acceptance of Functional Cookies, which allow us to analyze site usage so we can measure and improve performance. To view and create comments for this article, please update your Cookie Preferences on this website and refresh this web page. Please note: You must have JavaScript enabled in your browser.