🚀 how to install and run rocket. Chat on debian vpsThis article describes how to install and run Rocket.Chat on Debian VPS.

What is Rocket.Chat?

Rocket.Chat is an open-source communication platform designed for team collaboration and messaging, similar to Slack or Microsoft Teams. It offers a flexible, self-hosted alternative for businesses, communities, and developers who want full control over their data and communication infrastructure.

Key Features:

  • Real-time chat (channels, private groups, direct messages)
  • Voice and video conferencing (via Jitsi or native integrations)
  • File sharing and screen sharing
  • End-to-end encryption
  • Extensive customization through themes, roles, and permissions
  • Powerful integrations (GitHub, GitLab, Zapier, Jira, etc.)
  • Mobile and desktop apps
  • Federation support (communicate across different Rocket.Chat servers)

Use Cases:

  • Team collaboration (remote or on-premise)
  • Customer support chat (via website widget)
  • Community engagement (for open-source or educational platforms)
  • Secure internal messaging (for enterprises and regulated industries)

Hosting Options:

  • Self-hosted (on your own VPS server)
  • Cloud-hosted (Rocket.Chat offers managed hosting)

It’s ideal for organizations seeking a secure, open-source, and customizable communication solution that doesn’t rely on third-party SaaS providers.

✅ Prerequisites

Ensure you have:

  • A Debian 12 VPS (1GB+ RAM minimum; 2GB+ recommended)
  • Root access or sudo privileges
  • A domain/subdomain (optional but recommended)
  • A static IP address

Launch 100% ssd debian vps from $2. 49/mo!

🚀 How to Install and Run Rocket.Chat on Debian VPS

To install and Run Rocket.Chat on Debian VPS, follow the steps below:

  1. Update System Packages

    sudo apt-get update && sudo apt-get upgrade -y
  2. Install Required Dependencies

    sudo apt-get install gnupg curl build-essential graphicsmagick -y
  3. Install Node.js

    Rocket.Chat supports Node.js v22. We’ll use NodeSource:

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

    Verify installation:

    node -v npm -v
  4. Install Deno

    Custom Deno install script automates supported version installation:

    curl -fsSL https://gist.githubusercontent.com/radwebhosting/d3b211bd2e2ac6e5f22b6b259e7d4a64/raw/2eb39985ba0b477aad633ef8bbe322d06ee8efa0/install-deno.sh | sh
  5. Install MongoDB

    1. To import the MongoDB public GPG key, run the following command:
      curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \ --dearmor
    2. Create the list file for Debian 12 (Bookworm):
      echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] http://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
    3. Reload local package database:
      sudo apt-get update
    4. Install the preferred MongoDB version:
      sudo apt-get install -y \ mongodb-org=7.0.22 \ mongodb-org-database=7.0.22 \ mongodb-org-server=7.0.22 \ mongodb-mongosh \ mongodb-org-shell=7.0.22 \ mongodb-org-mongos=7.0.22 \ mongodb-org-tools=7.0.22 \ mongodb-org-database-tools-extra=7.0.22
    5. To prevent unintended breaking updates, it is recommended to pin the package at the currently installed version:
      echo "mongodb-org hold" | sudo dpkg --set-selections echo "mongodb-org-database hold" | sudo dpkg --set-selections echo "mongodb-org-server hold" | sudo dpkg --set-selections echo "mongodb-mongosh hold" | sudo dpkg --set-selections echo "mongodb-org-mongos hold" | sudo dpkg --set-selections echo "mongodb-org-cryptd hold" | sudo dpkg --set-selections echo "mongodb-org-tools hold" | sudo dpkg --set-selections echo "mongodb-org-database-tools-extra hold" | sudo dpkg --set-selections
    6. Configure MongoDB to enable replication and specify the replication set as rs01, so that /etc/mongod.conf resembles the following:
      # mongod.conf # Where and how to store data. storage: dbPath: /var/lib/mongodb # where to write logging data. systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log # network interfaces net: port: 27017 bindIp: 127.0.0.1 # Replace with your IP address # how the process runs processManagement: timeZoneInfo: /usr/share/zoneinfo # Replication settings replication: replSetName: rs01
    7. Enable and start MongoDB:
      sudo systemctl enable --now mongod sudo systemctl restart mongod
    8. Next, initialize the replica set:
      mongosh --eval "printjson(rs.initiate())"
    9. Verify status:
      sudo systemctl status mongod
  6. Download and Extract Rocket.Chat

    For stability and compatibility, it is recommended to install a specific version (view Release Document for available versions):

    sudo curl -L https://releases.rocket.chat/7.9.0/download -o /tmp/rocket.chat.tgz tar -xzf /tmp/rocket.chat.tgz -C /tmp cd /tmp/bundle/programs/server && npm install sudo mv /tmp/bundle /opt/Rocket.Chat
  7. Create Rocket.Chat User

    sudo useradd -M rocketchat && sudo usermod -L rocketchat sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat

    Depending on how you install NodeJS, the binary path may be different. Save the path to a variable:

    NODE_PATH=$(which node)
  8. Configure Environment Variables

    Create a systemd service file:

    cat << EOF |sudo tee -a /lib/systemd/system/rocketchat.service [Unit] Description=The Rocket.Chat server After=network.target remote-fs.target nss-lookup.target nginx.service mongod.service [Service] ExecStart=$NODE_PATH /opt/Rocket.Chat/main.js StandardOutput=journal StandardError=journal SyslogIdentifier=rocketchat User=rocketchat [Install] WantedBy=multi-user.target EOF

    Update the Rocket.Chat file by running:

    sudo systemctl edit rocketchat

    Update the file with the information below and save it:

    [Service] Environment=ROOT_URL=http://localhost:3000 Environment=PORT=3000 Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 Environment=MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 # The `MONGO_OPLOG_URL` variable is not required. It has been deprecated and will be removed in the version 8.0.0
  9. Enable and Start Rocket.Chat

    Start Rocket.Chat:

    sudo systemctl enable --now rocketchat

    Check status:

    sudo systemctl status rocketchat

    If the Rocket.Chat configuration is edited, reload the daemon and restart Rocket.Chat using the following commands:

    sudo systemctl daemon-reload sudo systemctl restart rocketchat
  10. Install Nginx

    Install Nginx:

    sudo apt-get update sudo apt-get install nginx -y
  11. Reverse Proxy with Nginx

    Create the config file:

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

    Paste the following (replace your-domain.com):

    server { listen 80; server_name your-domain.com; 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 $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; proxy_set_header X-Forward-Proto http; proxy_set_header X-Nginx-Proxy true; proxy_redirect off; } }

    Enable the config:

    sudo ln -s /etc/nginx/sites-available/rocketchat /etc/nginx/sites-enabled/rocketchat sudo nginx -t sudo systemctl restart nginx
  12. Add SSL

    Install Certbot and Nginx plugin:

    sudo apt-get update sudo apt-get install certbot python3-certbot-nginx -y

    Install a free Let’s Encrypt SSL certificate:

    sudo certbot --nginx -d your-domain.com

    Certbot will automatically adjust your Nginx config and reload Nginx.

  13. Access Rocket.Chat

    Go to:
    📱 https://your-domain.com
    or
    🖥️ http://your-server-ip:3000 (if domain not configured)

    Complete the web setup wizard.

  14. Optional: Enable Auto-start on Boot

    Make sure Rocket.Chat and MongoDB auto-start:

    sudo systemctl enable rocketchat sudo systemctl enable mongod

🔧 Troubleshooting Tips

  • Rocket.Chat not starting? Run:
    journalctl -u rocketchat -f to view logs.
  • MongoDB connection error? Ensure MongoDB is running and accessible.
  • Web UI issues? Make sure you set correct ROOT_URL.

📌 Summary

Component Installed Location
Rocket.Chat /opt/Rocket.Chat/
Node.js /usr/bin/node
MongoDB Localhost port 27017
Nginx Config /etc/nginx/sites-available/rocketchat

Launch 100% ssd debian vps from $2. 49/mo!

Conclusion

You now know how to install and run Rocket.Chat on Debian VPS.

Avatar of editorial staff

Editorial Staff

Rad Web Hosting is a leading provider of web hosting, Cloud VPS, and Dedicated Servers in Dallas, TX.
lg