Rocket.Chat is an open-source team communication platform that allows teams to collaborate through real-time messaging, video conferencing, file sharing, and more. Installing Rocket.Chat on a VPS can provide your team with a secure, private communication channel. In this guide, we’ll walk you through the steps to install and configure Rocket.Chat on your VPS.
Step 1: Set Up Your VPS
-
Choose a VPS Provider
- A VPS with the following specs is recommended for optimal performance:
- CPU: 2 vCPUs or more
- RAM: 4 GB or higher (8 GB recommended for larger teams)
- Storage: 20 GB SSD or more (depending on the number of users and files shared)
- Operating System: Ubuntu 20.04 LTS or later (Other Linux distributions will also work)
- A VPS with the following specs is recommended for optimal performance:
-
Access Your VPS via SSH
- Open a terminal on your local machine and SSH into your VPS:
-
Update Your VPS
- Run the following command to update your system’s packages:
Step 2: Install Node.js and Required Dependencies
Rocket.Chat is built on Node.js, so the first step is to install Node.js and other dependencies.
-
Install Node.js (Recommended Version)
- Add the NodeSource repository and install the latest stable version of Node.js:
-
Install Build Tools
- Install the required build tools to compile native dependencies:
-
Install MongoDB
- Rocket.Chat requires MongoDB as its database. You can install it by following these steps:
-
Install Redis (Optional but Recommended)
- Rocket.Chat uses Redis for caching and performance optimization:
Step 3: Install Rocket.Chat
Once the dependencies are installed, you can proceed to install Rocket.Chat.
-
Create a New Directory for Rocket.Chat
- Navigate to the
/opt
directory (or another location of your choice) and create a new directory for Rocket.Chat:
- Navigate to the
-
Download Rocket.Chat
- Download the latest stable release of Rocket.Chat:
-
Extract the Files
- Extract the downloaded tarball:
-
Install Dependencies for Rocket.Chat
- Rocket.Chat requires npm (Node.js package manager) to install necessary dependencies. Run the following command inside the Rocket.Chat directory:
Step 4: Configure Rocket.Chat
Rocket.Chat requires environment variables for configuration. You will need to set the MongoDB URI, application port, and other parameters.
-
Set Environment Variables
- Create a
.env
file in the Rocket.Chat directory with the following configuration: - Add the following lines, adjusting the values as needed (especially the MongoDB URI):
- Create a
-
Create a Systemd Service for Rocket.Chat
- To run Rocket.Chat as a service and ensure it starts on boot, create a new systemd service:
-
Add the Following Service Configuration:
- Replace
your-vps-ip
with your VPS’s actual IP address.
- Replace
-
Reload systemd and Start Rocket.Chat
- Reload systemd to apply the new service:
Step 5: Configure Nginx as a Reverse Proxy (Optional but Recommended)
For better performance and security, it’s a good idea to set up Nginx as a reverse proxy in front of Rocket.Chat, allowing you to use HTTPS.
-
Install Nginx
-
Configure Nginx to Proxy Rocket.Chat
-
Create a new Nginx server block file:
-
Add the following configuration:
-
-
Enable the Nginx Configuration
- Create a symbolic link to enable the configuration:
-
Obtain an SSL Certificate (Optional)
- If you're using a domain, it's recommended to secure your Rocket.Chat server with SSL using Let’s Encrypt. Install Certbot:
- Obtain an SSL certificate:
-
Restart Nginx
- Restart Nginx to apply the changes:
Step 6: Access Rocket.Chat
Once Rocket.Chat is running, you can access the application by navigating to your server’s IP address or domain in a web browser.
-
Access Rocket.Chat via Browser
- Go to
http://your-vps-ip:3000
orhttp://your-domain.com
if you configured Nginx and SSL.
- Go to
-
Create an Admin Account
- On the first visit, you will be prompted to create an administrator account for Rocket.Chat. Fill out the form with your desired admin username and password.
Step 7: Configure Rocket.Chat Settings
After setting up Rocket.Chat, you can configure various settings for your team communication, such as:
- Create Channels and Direct Messages: Create channels for different departments or teams.
- Integrations: Connect Rocket.Chat with other services like GitHub, Slack, and others through the integration settings.
- User Permissions: Configure permissions for different user roles (admins, users, etc.).
- Enable Two-Factor Authentication (2FA): For enhanced security, enable two-factor authentication for user accounts.
Conclusion
You have now successfully installed and configured Rocket.Chat on your VPS for team communication. With Rocket.Chat, you can enjoy real-time chat, file sharing, and other collaboration tools that help keep your team connected. By configuring Nginx as a reverse proxy and securing your server with SSL, you ensure that your Rocket.Chat instance is both efficient and secure.