--- title: "Deploy Rocket Chat on Ubuntu for Secure Messaging" slug: "deploy-with-ubuntu" description: "Set up Rocket Chat on Ubuntu to enable secure messaging and collaboration. Benefit from open source flexibility, scalability, and reliable communication tools." updated: 2026-10-05T13:33:43Z published: 2026-10-05T13:33:43Z canonical: "docs.rocket.chat/deploy-with-ubuntu" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.rocket.chat/llms.txt > Use this file to discover all available pages before exploring further. # Deploy with Ubuntu > [!WARNING] > Rocket.Chat does not support this deployment method. Using it may lead to unexpected challenges or compatibility issues. The recommended deployment methods are [Docker](/deploy-with-docker-docker-compose) and [Kubernetes](/deploy-with-kubernetes). Rocket.Chat offers several deployment options, one of which is on Ubuntu. Whether you’re new to server administration or an experienced professional, this document will provide a step-by-step walkthrough to set up a secure and efficient Rocket.Chat environment on Ubuntu. ## Prerequisites > For any Rocket.Chat version you want to install, check the [release notes](https://github.com/RocketChat/Rocket.Chat/releases) to see the supported engine versions for MongoDB and NodeJs, and install as recommended below. ### Install Node.js Follow the [official guide](https://github.com/nodesource/distributions/blob/master/README.md#debinstall) to install NodeJS on Ubuntu, or use third-party tools like [nvm](https://github.com/nvm-sh/nvm#installing-and-updating) or [n](https://www.npmjs.com/package/n) for easier version management. ### Set up MongoDB > [!WARNING] > When deploying MongoDB, it is crucial to secure MongoDB instances by restricting public access to all MongoDB ports. Unsecured instances can create serious security vulnerabilities, so taking these precautions is critical to ensuring the integrity and safety of your systems. 1. Start by installing MongoDB on Ubuntu. Refer to the official [MongoDB documentation](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/) for the latest installation instructions 2. Once MongoDB is installed, open the MongoDB configuration file (`/etc/mongod.conf`) by running: ```bash nano /etc/mongod.conf ``` 3. In this file, enable replication and specify the replica set name as `rs01` > [!WARNING] > The MongoDB replica set is mandatory for Rocket.Chat > 1.0.0. Your MongoDB configuration file should look something like the below: ```yaml # 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: # Replace with your IP address # how the process runs processManagement:  timeZoneInfo: /usr/share/zoneinfo # Replication settings replication:  replSetName: rs01 ``` > [!NOTE] > Refer to the official [MongoDB configuration documentation](https://docs.mongodb.org/manual/reference/configuration-options/) for additional configuration options. 4. Start MongoDB with this command: ```bash sudo systemctl enable --now mongod sudo systemctl restart mongod ``` 5. Next, initialize the replica set: ```bash mongosh --eval "printjson(rs.initiate())" ``` 6. To ensure MongoDB is running successfully, run this: ```bash sudo systemctl status mongod ``` With all the prerequisites in place, you're ready to install Rocket.Chat. ## Step 1: Install Rocket.Chat on Ubuntu 1. Install the required packages and dependencies ```bash sudo apt install -y curl build-essential graphicsmagick ``` 2. Check the Rocket.Chat [release document](https://github.com/RocketChat/Rocket.Chat/releases) to choose the version you need. For stability and compatibility, we recommend downloading a specific version. For example, to download version 6.13.0, run this command: ```bash curl -L https://releases.rocket.chat/6.13.0/download -o /tmp/rocket.chat.tgz ``` Alternatively, if you prefer to download the [latest version,](https://github.com/RocketChat/Rocket.Chat/releases/latest) you can use the following command: ```bash curl -L https://releases.rocket.chat/latest/download -o /tmp/rocket.chat.tgz ``` 3. Extract the Rocket.Chat server files using this command: ```bash tar -xzf /tmp/rocket.chat.tgz -C /tmp ``` This command extracts the contents of the downloaded “rocket.chat.tgz” compressed tar archive located in the `/tmp` directory and places the extracted files into the same `/tmp` directory. 4. Next, run the command below to change the current directory and install the necessary production dependencies. ```bash cd /tmp/bundle/programs/server && npm install --production ``` > [!WARNING] > When executing `npm install`, it is recommended to operate using a non-root account. Alternatively, you can utilize the `npm install --unsafe-perm --production` command. This approach eliminates the necessity for building libc or upgrading the host system. 5. Move the extracted files to the `/opt` directory. ```bash sudo mv /tmp/bundle /opt/Rocket.Chat ``` > [!NOTE] > This guide uses the `/opt` *directory*. However, you can choose your preferred directory. ## Step 2: Configure the Rocket.Chat service 1. Start by adding the Rocketchat user and setting the right permissions on the Rocket.Chat folder. ```bash sudo useradd -M rocketchat && sudo usermod -L rocketchat ``` ```bash sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat ``` 2. Depending on how you install NodeJS, the binary path may be different. Save the path to a variable. ```bash NODE_PATH=$(which node) ``` 3. Now, save the systemd service file. ```bash 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 ``` The command above will create a barebone service file, which the system will use to start your Rocket.Chat daemon/process. > [!NOTE] > You may need to replace `User=rocketchat` with your current user (e.g., `User=ubuntu`) if Rocket.Chat or any pre-requisite software is running under a different user on your system. ## Step 3: Passing environment variables Running the Rocket.Chat daemon requires passing some environment variables. See Rocket.Chat [environmental variables](/v1/docs/deployment-environment-variables) for more details. - Update the Rocket.Chat file by running: ```bash sudo systemctl edit rocketchat ``` - Next, update the file with the information below and save it. ```bash [Service] Environment=ROOT_URL=http://localhost:3000 Environment=PORT=3000 Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 ``` - Now, start your Rocket.Chat workspace using this command: ```bash sudo systemctl enable --now rocketchat ``` If you edit your Rocket.Chat configuration file, make sure to reload the daemon and restart the Rocket.Chat process by running the following commands: ```bash sudo systemctl daemon-reload sudo systemctl restart rocketchat ``` You can also check the status of the Rocket.Chat process with this command: ```bash sudo systemctl status rocketchat ``` ## Step 4: Configure your Rocket.Chat server - To access your Rocket.Chat workspace, open a web browser, and navigate to the "ROOT URL" you specified in the Rocket.Chat configuration file. This is typically accessible at `http://your-host-name.com:3000`. - Follow the on-screen prompts to [configure your workspace.](/v1/docs/rocketchat-setup-wizard) ## Next steps Great! You’ve successfully created your Rocket.Chat workspace and logged in. Next, check out the following documents to get started: - [User Guides](/user-guides): Learn the basics of your Rocket.Chat account, the types of rooms, and how to communicate with your workspace users. - [Workspace Administration](/workspace-administration): Administrators and owners can set and manage various configurations. - [Marketplace](/rocketchat-marketplace): Explore the available apps to enhance your workspace. You can also apply the following additional configuration to your Rocket.Chat setup for enhanced security and performance: ### Enable HTTPS for your Rocket.Chat workspace For your workspace’s security, your domain should be accessible only via HTTPS. While there are various ways to set up a reverse proxy, this section provides a walkthrough on using Nginx or Traefik. NginxTraefik #### Prerequisite You must set up a DNS record for your domain before configuring Nginx with Let's Encrypt. This domain must have A or AAAA records pointing to the IP address where Nginx is running. #### Using Nginx 1. Install Nginx ```bash sudo apt update sudo apt install nginx ``` 2. Create a new Nginx configuration file: ```bash sudo nano /etc/nginx/sites-available/rocketchat ``` Add the following configuration, replacing `your_domain.com` with your actual domain: ```nginx 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 $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 http;        proxy_set_header X-Nginx-Proxy true;        proxy_redirect off;    } } ``` 3. Enable the configuration: ```bash sudo ln -s /etc/nginx/sites-available/rocketchat /etc/nginx/sites-enabled/ ``` Test and restart Nginx: ```bash sudo nginx -t sudo systemctl restart nginx ``` This proxies requests from port 80 to Rocket.Chat running on `localhost:3000`. 4. Enable SSL with Let's Encrypt and Certbot by installing the Certbot and the Nginx plugin: ```bash sudo apt update sudo apt install certbot python3-certbot-nginx ``` Run Certbot to obtain and configure the SSL certificate: ```bash sudo certbot --nginx -d your_domain.com ``` > Ensure `your_domain.com` is set correctly in your Nginx config. Follow the prompts to provide an email, agree to terms, and enable HTTPS redirection. Certbot will automatically configure SSL and set up renewal. 5. After completion, verify HTTPS by visiting `https://your_domain.com`. #### Prerequisite You must set up a DNS record for your domain before configuring Traefik with Let's Encrypt. This domain must have A or AAAA records pointing to the IP address where Traefik is running. #### Using Traefik 1. Install Traefik: ```bash sudo apt update && sudo apt install -y wget wget https://github.com/traefik/traefik/releases/download/v2.10.4/traefik_v2.10.4_linux_amd64.tar.gz tar -zxvf traefik_v2.10.4_linux_amd64.tar.gz sudo mv traefik /usr/local/bin/ ``` 2. Create a Traefik configuration file: ```bash sudo mkdir -p /etc/traefik sudo nano /etc/traefik/traefik.toml ``` Add the following: ```ini [entryPoints]  [entryPoints.web]    address = ":80"  [entryPoints.websecure]    address = ":443" [certificatesResolvers.letsencrypt.acme]  email = "your_email@your_domain.com"  storage = "/etc/traefik/acme.json"  [certificatesResolvers.letsencrypt.acme.tlsChallenge] [providers.file]  directory = "/etc/traefik/dynamic_conf" [api]  dashboard = true ``` > Replace `your_email@your_domain.com` with your email address. 3. Create a dynamic configuration file for Rocket.Chat: ```bash sudo mkdir -p /etc/traefik/dynamic_conf sudo nano /etc/traefik/dynamic_conf/rocketchat.toml ``` Add the below: ```ini [http.routers]  [http.routers.rocketchat]    rule = "Host(`your_domain.com`)"    service = "rocketchat"    entryPoints = ["websecure"]    [http.routers.rocketchat.tls]      certResolver = "letsencrypt" [http.services]  [http.services.rocketchat.loadBalancer]    [[http.services.rocketchat.loadBalancer.servers]]      url = "http://your_ip:3000" ``` > Make sure `your_domain.com` and `http://your_ip:3000` point to the appropriate domain and IP address respectively. 4. Create a `systemd` service file for Traefik: ```bash sudo nano /etc/systemd/system/traefik.service ``` Add: ```ini [Unit] Description=Traefik Documentation=https://doc.traefik.io/traefik/ After=network-online.target Wants=network-online.target [Service] Type=simple ExecStart=/usr/local/bin/traefik --configfile=/etc/traefik/traefik.toml Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target ``` 5. Start and enable Traefik: ```bash sudo systemctl daemon-reload sudo systemctl enable --now traefik ``` 6. Open your Rocket.Chat `systemd` service file to set the correct ROOT_URL: ```bash sudo systemctl edit rocketchat ``` Update the Environment variable:: ```bash Environment=ROOT_URL=https://your_domain.com ``` 7. Restart Rocket.Chat: ```bash sudo systemctl daemon-reload sudo systemctl restart rocketchat ``` 8. Make sure ports 80 and 443 are open: ```bash sudo ufw allow 80/tcp sudo ufw allow 443/tcp ``` Now, you can access your Rocket.Chat workspace securely via HTTPS using `https://your_domain.com`. If you're not using a reverse proxy and have a firewall enabled, you may need to allow traffic on port 3000. For more details, refer to the [firewall rule](/v1/docs/firewall-configuration) documentation. Here are other additional configuration options to consider when optimizing your Rocket.Chat server: - [Configure Mongo access control](/v1/docs/mongodb-uri-authentication) - [Configure production values for Mongodb](/v1/docs/additional-mongodb-driver-options) ### Monitor and log your deployment This section provides a guide to monitoring your deployments' health and quickly diagnosing any issues. #### Rocket.Chat logs - Check the latest Rocket.Chat logs: ```bash sudo journalctl -u rocketchat --no-pager --lines=50 ``` - View logs in real-time: ```bash sudo journalctl -u rocketchat -f ``` - Check Rocket.Chat status: ```bash sudo systemctl status rocketchat ``` #### MongoDB logs - Check MongoDB logs: ```bash sudo journalctl -u mongod --no-pager --lines=50 ``` - View logs in real-time: ```bash sudo journalctl -u mongod -f ``` - Check MongoDB status: ```bash sudo systemctl status mongod ``` - Connect to MongoDB and verify the replica set: ```bash mongosh --eval "rs.status()" ``` #### Check system-wide logs - If a service is failing and you need system-wide logs: ```bash sudo journalctl -xe ``` - For logs of a specific time range (e.g., last 30 minutes): ```bash sudo journalctl --since "30 minutes ago" ``` #### Nginx logs - Check error logs: ```bash sudo tail -n 50 /var/log/nginx/error.log ``` - Check access logs: ```bash sudo tail -n 50 /var/log/nginx/access.log ``` - Monitor logs in real-time: ```bash sudo tail -f /var/log/nginx/error.log ``` - Check if Nginx is running: ```bash sudo systemctl status nginx ``` - Test the Nginx configuration: ```bash sudo nginx -t ``` - If there are configuration issues, restart Nginx after fixing them: ```bash sudo systemctl restart nginx ``` #### Traefik logs - Check Traefik logs with: ```bash sudo journalctl -u traefik --no-pager --lines=50 ``` - View logs in real-time: ```bash sudo journalctl -u traefik -f ``` - Check Traefik’s status: ```bash sudo systemctl status traefik ``` - Inspect Traefik’s logs for routing issues: ```bash sudo cat /var/log/traefik.log | tail -n 50 ``` ### Update your workspace version It’s important to keep your workspaces updated to enjoy the benefits of new features and fixes. Follow these steps to update your workspace version: 1. Stop the Rocket.Chat service with this command: ```bash sudo systemctl stop rocketchat ``` 1. Remove the installation folder, usually in `/opt`: ```bash sudo rm -rf /opt/Rocket.Chat ``` 2. Ensure you have the supported node and MongoDB versions by checking the [releases](https://github.com/RocketChat/Rocket.Chat/releases). 3. Download the version of Rocket.Chat that you need: ```bash curl -L https://releases.rocket.chat/7.0.0/download -o /tmp/rocket.chat.tgz ``` > Using `latest` instead of the version number is not recommended. 4. Extract the Rocket.Chat server files using the following command: ```bash tar -xzf /tmp/rocket.chat.tgz -C /tmp ``` 1. Next, run the following command to change the current directory and install the necessary production dependencies: ```bash cd /tmp/bundle/programs/server && npm install ``` 1. Move the extracted files to the `/opt` directory: ```bash sudo mv /tmp/bundle /opt/Rocket.Chat ``` 1. Start the Rocket.Chat service: ```bash sudo systemctl start rocketchat ``` Check the status of the Rocket.Chat process with this command: ```bash sudo systemctl status rocketchat ``` If you have any questions or issues when updating [Rocket.Chat](http://Rocket.Chat), refer to the [Updating Rocket.Chat FAQ](/updating-rocketchat-faq). For information on supported MongoDB versions, see the [MongoDB version support](/support-prerequisites#mongodb-version-support) document.