UbuntuUbuntu Based

How To Install Rocket.Chat on Ubuntu 24.04 LTS

Install Rocket.Chat on Ubuntu 24.04

Rocket.Chat has emerged as a powerful open-source communication platform that offers businesses complete control over their messaging infrastructure. Unlike proprietary solutions such as Slack or Microsoft Teams, this self-hosted team collaboration tool provides organizations with enhanced privacy, customization options, and cost-effectiveness. The platform supports real-time messaging, file sharing, video conferencing, voice messages, and extensive integrations that make it an ideal choice for teams of all sizes.

Ubuntu 24.04 LTS stands out as the perfect operating system for hosting Rocket.Chat due to its long-term support guarantee, exceptional stability, and robust security features. This latest LTS release offers enhanced performance optimizations, improved container support, and strengthened security measures that ensure your communication platform runs smoothly for years to come. The strong community support and comprehensive documentation make troubleshooting and maintenance straightforward for system administrators.

This comprehensive guide covers multiple installation methods, from the simplified snap package approach to detailed manual installation procedures. You’ll learn how to configure SSL certificates, implement security best practices, optimize performance, and troubleshoot common issues. Whether you’re setting up Rocket.Chat for a small team or planning a large-scale enterprise deployment, this tutorial provides the knowledge and tools necessary for a successful implementation.

Prerequisites and System Requirements

Hardware Requirements

Before beginning the Rocket.Chat installation process, understanding the hardware requirements ensures optimal performance and scalability. For small teams with fewer than 50 users, minimum specifications include 1 vCPU, 2GB RAM, and 40GB storage space. However, these basic requirements may result in slower response times during peak usage periods.

Recommended specifications for better performance include 2 or more vCPUs, 4GB RAM, and 80GB SSD storage. SSD storage significantly improves database operations and file handling, resulting in faster message delivery and file uploads. Network bandwidth requirements depend on usage patterns, but a stable connection with at least 10 Mbps upload speed ensures smooth video conferencing and file sharing capabilities.

Large enterprise deployments serving hundreds of users require more substantial resources: 16 vCPUs, 12GB RAM, and dedicated storage solutions. Consider implementing load balancing and database clustering for high-availability scenarios. Monitor resource usage regularly and scale hardware accordingly as your user base grows.

Software Prerequisites

Ensure your Ubuntu 24.04 LTS server is properly configured with root or sudo privileges before starting the installation. A registered domain name pointing to your server’s IP address is essential for SSL certificate configuration and proper functionality. Basic Linux command-line knowledge helps navigate the installation process and perform ongoing maintenance tasks.

SSH access to your server enables remote administration and troubleshooting. Configure SSH keys for enhanced security and consider changing the default SSH port to reduce automated attack attempts. Stable internet connectivity is crucial for downloading packages, updates, and accessing external services.

Pre-installation Setup

Update your system packages to ensure compatibility and security:

sudo apt update && sudo apt upgrade -y

Configure proper timezone settings for accurate logging and scheduling:

sudo timedatectl set-timezone America/New_York

Set up locale settings to match your organization’s requirements:

sudo localectl set-locale LANG=en_US.UTF-8

Create a dedicated user account for enhanced security (optional for snap installation):

sudo adduser rocketchat
sudo usermod -aG sudo rocketchat

Method 1: Installing Rocket.Chat Using Snap (Recommended)

Why Snap Installation is Recommended

The snap package installation method represents the most straightforward approach for deploying Rocket.Chat on Ubuntu systems. Snap packages include all necessary dependencies, eliminating version conflicts and compatibility issues that often complicate manual installations. The sandboxed environment provides enhanced security by isolating the application from the host system.

Automatic updates ensure your Rocket.Chat installation remains secure and up-to-date without manual intervention. The Rocket.Chat team officially supports and maintains the snap package, guaranteeing compatibility and timely security patches. Snap installations also simplify backup and migration procedures, making system maintenance more manageable.

The containerized nature of snap packages prevents conflicts with other system applications and services. This isolation reduces the risk of system-wide issues and makes troubleshooting more predictable. Additionally, snap installations can be easily removed without leaving behind configuration files or dependencies.

Step-by-Step Snap Installation

Begin by installing snapd if it’s not already present on your system:

sudo apt install snapd -y

Install the Rocket.Chat server using the snap package manager:

sudo snap install rocketchat-server

The installation process automatically downloads and configures all required dependencies, including Node.js, MongoDB, and necessary libraries. Monitor the installation progress and wait for completion before proceeding to configuration steps.

Check the installation status and verify service startup:

sudo snap services rocketchat-server

View installation logs to troubleshoot any potential issues:

sudo snap logs rocketchat-server

The snap installation automatically creates a systemd service that starts Rocket.Chat on system boot. File locations follow snap conventions, with data stored in /var/snap/rocketchat-server/common/ and application files in /snap/rocketchat-server/current/.

Initial Configuration

Access your Rocket.Chat installation by navigating to http://your-server-ip:3000 in a web browser. The setup wizard guides you through creating an administrator account and configuring basic server settings. Choose a strong password that includes uppercase letters, lowercase letters, numbers, and special characters.

Configure your organization information, including name, industry, and contact details. These settings affect email templates and branding throughout the platform. Set up basic server preferences such as language, timezone, and default user settings to match your organization’s requirements.

Verify the installation by testing core functionality including user registration, messaging, and file uploads. Document your administrator credentials securely and consider implementing two-factor authentication immediately after initial setup completion.

Method 2: Manual Installation with Node.js and MongoDB

Installing Dependencies

Manual installation provides greater control over individual components and enables custom configurations not available in snap packages. Begin by installing Node.js using the NodeSource repository for the latest stable version:

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

Verify the Node.js installation:

node --version
npm --version

Install MongoDB using the official MongoDB repository:

wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org

Install required system packages:

sudo apt-get install -y build-essential curl graphicsmagick

Configure MongoDB for Rocket.Chat by editing the configuration file:

sudo nano /etc/mongod.conf

Add replica set configuration:

replication:
  replSetName: "rs01"

Start and enable MongoDB:

sudo systemctl start mongod
sudo systemctl enable mongod

Initialize the MongoDB replica set:

mongo --eval "printjson(rs.initiate())"

Downloading and Installing Rocket.Chat

Create a dedicated system user for Rocket.Chat:

sudo useradd -M rocketchat
sudo usermod -L rocketchat

Download the latest stable Rocket.Chat release:

cd /tmp
curl -L https://releases.rocket.chat/latest/download -o rocket.chat.tgz
tar xzf rocket.chat.tgz

Move the application to the appropriate directory:

sudo mv bundle /opt/Rocket.Chat
sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat

Install NPM dependencies:

cd /opt/Rocket.Chat/programs/server
sudo npm install

Set proper file permissions:

sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat

Creating System Service

Create a systemd service file for Rocket.Chat:

sudo nano /etc/systemd/system/rocketchat.service

Add the following configuration:

[Unit]
Description=The Rocket.Chat server
After=network.target remote-fs.target nss-lookup.target nginx.target mongod.target
[Service]
ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocketchat
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 ROOT_URL=http://localhost:3000/ PORT=3000
[Install]
WantedBy=multi-user.target

Reload systemd and start the service:

sudo systemctl daemon-reload
sudo systemctl start rocketchat
sudo systemctl enable rocketchat

Verify the service status:

sudo systemctl status rocketchat

Monitor service logs for troubleshooting:

sudo journalctl -u rocketchat -f

Firewall and Security Configuration

UFW Firewall Setup

Ubuntu’s Uncomplicated Firewall (UFW) provides essential protection for your Rocket.Chat server. Install and enable UFW if not already active:

sudo apt install ufw -y
sudo ufw enable

Configure essential firewall rules for Rocket.Chat operation:

sudo ufw allow 22/tcp    # SSH access
sudo ufw allow 80/tcp    # HTTP traffic
sudo ufw allow 443/tcp   # HTTPS traffic
sudo ufw allow 3000/tcp  # Rocket.Chat (temporary)

Review active firewall rules:

sudo ufw status verbose

Consider implementing more restrictive rules for production environments by limiting SSH access to specific IP addresses:

sudo ufw delete allow 22/tcp
sudo ufw allow from YOUR_IP_ADDRESS to any port 22

Security Best Practices

Enhance server security by changing the default SSH port. Edit the SSH configuration:

sudo nano /etc/ssh/sshd_config

Change the port number and disable root login:

Port 2222
PermitRootLogin no
PasswordAuthentication no

Restart the SSH service:

sudo systemctl restart ssh

Install and configure fail2ban for brute force protection:

sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

Configure automatic security updates:

sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure unattended-upgrades

Implement regular backup procedures for both application data and database:

#!/bin/bash
# Create backup script
BACKUP_DIR="/backup/rocketchat"
DATE=$(date +%Y%m%d_%H%M%S)

mkdir -p $BACKUP_DIR
mongodump --host localhost --port 27017 --db rocketchat --out $BACKUP_DIR/db_$DATE
tar -czf $BACKUP_DIR/uploads_$DATE.tar.gz /opt/Rocket.Chat/uploads/

SSL/HTTPS Configuration with Let’s Encrypt

Installing Certbot

Secure your Rocket.Chat installation with free SSL certificates from Let’s Encrypt. Install Certbot and the Nginx plugin:

sudo apt install certbot python3-certbot-nginx -y

For Apache users, install the Apache plugin instead:

sudo apt install certbot python3-certbot-apache -y

Verify Certbot installation:

certbot --version

Obtaining SSL Certificate

Ensure your domain name is properly configured and pointing to your server’s IP address before requesting certificates. Stop any services using ports 80 and 443 temporarily:

sudo systemctl stop nginx  # or apache2

Request an SSL certificate for your domain:

sudo certbot certonly --standalone -d yourdomain.com -d www.yourdomain.com

Follow the interactive prompts to provide email address and agree to terms of service. The certificate files are stored in /etc/letsencrypt/live/yourdomain.com/.

Set up automatic certificate renewal:

sudo crontab -e

Add the following line for daily renewal checks:

0 12 * * * /usr/bin/certbot renew --quiet

Test the renewal process:

sudo certbot renew --dry-run

Configuring Reverse Proxy

Install and configure Nginx as a reverse proxy for Rocket.Chat:

sudo apt install nginx -y

Create an Nginx configuration file:

sudo nano /etc/nginx/sites-available/rocketchat

Add the following configuration:

server {
    listen 80;
    server_name yourdomain.com www.yourdomain.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    server_name yourdomain.com www.yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512;
    ssl_prefer_server_ciphers off;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Nginx-Proxy true;
        proxy_redirect off;
    }
}

Enable the site and restart Nginx:

sudo ln -s /etc/nginx/sites-available/rocketchat /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

Update the Rocket.Chat ROOT_URL environment variable to use HTTPS:

sudo systemctl edit rocketchat

Add the override configuration:

[Service]
Environment=ROOT_URL=https://yourdomain.com

Restart Rocket.Chat:

sudo systemctl restart rocketchat

Initial Setup and Configuration

First-Time Setup Wizard

Access your Rocket.Chat installation at https://yourdomain.com to begin the setup wizard. The first step involves creating an administrator account with strong security credentials. Use a complex password that combines uppercase letters, lowercase letters, numbers, and special characters to ensure maximum security.

Install Rocket.Chat on Ubuntu 24.04

Configure organization information including company name, industry type, and contact details. These settings influence email templates, branding elements, and default configurations throughout the platform. Select appropriate server settings such as default language, timezone, and user registration policies that align with your organizational requirements.

Complete the setup wizard by reviewing and confirming all configuration options. The system performs initial database setup and creates necessary indexes during this process. Document all administrator credentials securely and implement additional security measures immediately after completing the initial setup.

Install Rocket.Chat on Ubuntu 24.04

Essential Configuration Options

Configure email server settings to enable notifications, password resets, and user invitations. Navigate to Administration > Email and configure SMTP settings:

SMTP Host: your-smtp-server.com
SMTP Port: 587
SMTP Username: your-email@domain.com
SMTP Password: your-app-password
Use TLS: Yes

Set file upload limits and storage configurations based on your server capacity and user requirements. Large file uploads can impact server performance, so establish reasonable limits that balance functionality with system resources.

Configure user registration policies to control how new users join your Rocket.Chat instance. Options include open registration, invitation-only, or integration with existing authentication systems like LDAP or OAuth providers.

Establish channel creation permissions and default channel configurations. Consider creating general-purpose channels for company-wide communication and department-specific channels for focused collaboration.

Performance Optimization and Maintenance

Performance Tuning

Optimize MongoDB performance by configuring appropriate indexes and memory allocation. Edit the MongoDB configuration file:

sudo nano /etc/mongod.conf

Add performance optimizations:

storage:
  wiredTiger:
    engineConfig:
      cacheSizeGB: 2
net:
  maxIncomingConnections: 20000

Configure Node.js memory allocation for the Rocket.Chat process by updating the systemd service file:

Environment=NODE_OPTIONS="--max-old-space-size=2048"

Implement file storage optimization by configuring GridFS alternatives for better performance. Consider using external storage services like Amazon S3 or local file storage for large deployments.

Monitor system resources using tools like htop, iotop, and nethogs to identify performance bottlenecks. Establish baseline metrics and regular monitoring schedules to proactively address performance issues.

Regular Maintenance Tasks

Establish automated database cleanup procedures to remove old files and optimize storage usage. Create a maintenance script:

#!/bin/bash
# Database maintenance script
mongo rocketchat --eval "
db.rocketchat_uploads.deleteMany({uploadedAt: {\$lt: new Date(Date.now() - 90*24*60*60*1000)}});
db.runCommand({compact: 'rocketchat_message'});
"

Configure log rotation to prevent log files from consuming excessive disk space:

sudo nano /etc/logrotate.d/rocketchat

Add log rotation configuration:

/var/log/rocketchat/*.log {
    daily
    missingok
    rotate 52
    compress
    delaycompress
    notifempty
    copytruncate
}

Implement comprehensive backup strategies that include both database dumps and file storage backups. Test restoration procedures regularly to ensure backup integrity and recovery capabilities.

Schedule regular updates for both snap and manual installations. For snap installations, updates occur automatically, but manual installations require scheduled maintenance windows for version upgrades.

Troubleshooting Common Issues

Installation Problems

MongoDB connection issues often arise from incorrect replica set configuration or firewall restrictions. Verify MongoDB status and connectivity:

sudo systemctl status mongod
mongo --eval "rs.status()"

Port conflicts may occur if other services are using the default Rocket.Chat port (3000). Check for conflicting services:

sudo netstat -tlnp | grep :3000
sudo lsof -i :3000

Permission-related errors typically involve incorrect file ownership or insufficient user privileges. Verify and correct file permissions:

sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat
sudo chmod -R 755 /opt/Rocket.Chat

Dependency conflicts in manual installations can be resolved by updating Node.js versions or rebuilding npm packages:

cd /opt/Rocket.Chat/programs/server
sudo npm rebuild

Runtime Issues

Service startup failures often result from configuration errors or resource constraints. Examine service logs for specific error messages:

sudo journalctl -u rocketchat -n 50

Memory and CPU usage problems can cause service instability and performance degradation. Monitor resource consumption and adjust allocation accordingly:

free -h
top -p $(pgrep -f rocketchat)

WebSocket connection issues affect real-time messaging functionality and typically involve proxy configuration problems. Verify proxy settings and ensure proper header forwarding for WebSocket upgrades.

SSL certificate problems may prevent secure connections and cause browser warnings. Verify certificate validity and renewal status:

sudo certbot certificates
openssl x509 -in /etc/letsencrypt/live/yourdomain.com/cert.pem -text -noout

Useful Commands and Logs

Essential service management commands for troubleshooting:

# Service status and management
sudo systemctl status rocketchat
sudo systemctl restart rocketchat
sudo systemctl stop rocketchat
sudo systemctl start rocketchat

# Log analysis
sudo journalctl -u rocketchat -f
sudo tail -f /var/log/nginx/access.log
sudo tail -f /var/log/nginx/error.log

Snap-specific troubleshooting commands:

sudo snap logs rocketchat-server
sudo snap restart rocketchat-server
sudo snap revert rocketchat-server

Database diagnostic tools for MongoDB troubleshooting:

# Database connection test
mongo rocketchat --eval "db.stats()"

# Performance analysis
mongo rocketchat --eval "db.runCommand({serverStatus: 1})"

# Collection statistics
mongo rocketchat --eval "db.rocketchat_message.stats()"

Advanced Features and Integrations

Popular Integrations

Rocket.Chat supports extensive integration capabilities that enhance team productivity and workflow automation. Slack migration tools enable seamless transition from existing Slack workspaces, preserving message history, channels, and user accounts. The migration process involves exporting Slack data and importing it into Rocket.Chat using built-in migration tools.

GitHub and GitLab integrations provide development teams with real-time notifications about code commits, pull requests, and issue updates. Configure webhooks in your repository settings to send notifications directly to designated Rocket.Chat channels, enabling developers to stay informed about project developments.

Jira integration streamlines project management by connecting issue tracking with team communication. Configure Jira webhooks to send issue updates, assignment changes, and project milestones to relevant Rocket.Chat channels, improving project visibility and team coordination.

Custom bot development using Rocket.Chat’s Bot Framework enables automation of repetitive tasks and custom workflow implementations. Develop bots using popular programming languages and frameworks to create interactive experiences and process automation within your communication platform.

Scaling Considerations

Load balancing multiple Rocket.Chat instances enables horizontal scaling for large deployments serving thousands of users. Implement reverse proxy load balancing using Nginx or HAProxy to distribute traffic across multiple application servers while maintaining session consistency.

Database clustering with MongoDB replica sets provides high availability and improved read performance. Configure multiple MongoDB instances with automatic failover capabilities to ensure continuous service availability during hardware failures or maintenance periods.

CDN integration for file sharing reduces server bandwidth usage and improves file download speeds for geographically distributed teams. Configure external storage providers like Amazon S3 or Google Cloud Storage with CDN capabilities to optimize file delivery performance.

Monitoring and alerting systems using tools like Prometheus, Grafana, and Alertmanager enable proactive system management and issue detection. Implement comprehensive monitoring dashboards that track application performance, resource usage, and user activity metrics.

Security Hardening and Best Practices

Advanced Security Measures

Rate limiting configuration prevents abuse and protects against denial-of-service attacks. Configure rate limiting rules in your reverse proxy to limit request frequency per IP address and protect against automated attacks.

IP whitelisting for administrative access restricts sensitive operations to trusted network locations. Implement firewall rules and application-level restrictions to limit administrative access to specific IP addresses or network ranges.

Regular security audits using automated tools and manual assessments identify potential vulnerabilities and configuration weaknesses. Establish quarterly security review processes that include dependency updates, configuration assessments, and penetration testing.

Web Application Firewall (WAF) implementation provides additional protection against common web attacks including SQL injection, cross-site scripting, and malicious file uploads. Configure WAF rules specific to Rocket.Chat requirements while maintaining application functionality.

Compliance Considerations

GDPR compliance settings ensure your Rocket.Chat installation meets European data protection requirements. Configure data retention policies, user consent mechanisms, and data export capabilities to comply with GDPR regulations.

Data retention policies automatically remove old messages and files according to legal requirements and organizational policies. Implement automated cleanup procedures that balance compliance requirements with operational needs.

Audit logging configuration tracks administrative actions, user access patterns, and system changes for compliance and security monitoring. Enable comprehensive logging that captures sufficient detail for regulatory requirements without impacting system performance.

Privacy settings and user controls enable individuals to manage their data and communication preferences. Configure granular privacy options that allow users to control message visibility, file sharing permissions, and data retention settings.

Congratulations! You have successfully installed Rocket.Chat. Thanks for using this tutorial for installing Rocket.Chat on Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official Rocket.Chat website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button