How to Install RustDesk Remote Desktop Server on Ubuntu 26.10

RustDesk is an open-source remote desktop solution that allows users to connect to computers remotely. By hosting your own RustDesk server, you can manage your own ID and relay infrastructure.

This guide explains how to install RustDesk Server OSS using Docker Compose on Ubuntu 26.10, configure firewall ports, obtain the server public key, and connect RustDesk clients. It also covers optional Nginx and SSL configuration for WebSocket connections.

The latest stable RustDesk Server OSS release verified for this guide is 1.1.16. The Docker latest tag is used below to simplify updates.

Prerequisites

  • Ubuntu 26.10 server with root or sudo access.
  • A public IPv4 address.
  • A domain or subdomain pointing to your server's IP address, such as rust.example.com.
  • Access to the required RustDesk ports through your firewall.
  • Docker and Docker Compose.

Install Docker and Docker Compose

Update the package list and install Docker:

sudo apt update
sudo apt install -y docker.io curl
sudo systemctl enable --now docker

Install the Docker Compose plugin:

sudo apt install -y docker-compose-v2

Verify the installations:

docker --version
docker compose version

Check that Docker is running:

sudo systemctl status docker --no-pager

Set Up RustDesk Server Using Docker Compose

Create the RustDesk directory:

sudo mkdir -p /opt/rustdesk/data
cd /opt/rustdesk

Create the Compose configuration:

sudo nano compose.yaml

Add the following configuration. Replace rust.example.com with your actual public hostname.

services:
  hbbs:
    image: rustdesk/rustdesk-server:latest
    container_name: hbbs
    command: hbbs -r rust.example.com:21117
    network_mode: host
    volumes:
      - ./data:/root
    depends_on:
      - hbbr
    restart: unless-stopped

  hbbr:
    image: rustdesk/rustdesk-server:latest
    container_name: hbbr
    command: hbbr
    network_mode: host
    volumes:
      - ./data:/root
    restart: unless-stopped

Save the file and download the images:

sudo docker compose pull

Start the services:

sudo docker compose up -d

Check the running containers:

sudo docker compose ps

View the logs if needed:

sudo docker compose logs --tail=50

The hbbs service handles ID registration and connection coordination, while hbbr provides relay services when direct peer-to-peer connections are not possible.

Host networking allows RustDesk to listen directly on the server's network interfaces and avoids the need for Docker port mappings.

Configure the Firewall

RustDesk requires specific ports for its ID and relay services.

If UFW is enabled, allow the following ports:

sudo ufw allow 21115/tcp
sudo ufw allow 21116/tcp
sudo ufw allow 21116/udp
sudo ufw allow 21117/tcp

If you need RustDesk WebSocket support, also allow the following ports as required by your configuration:

sudo ufw allow 21118/tcp
sudo ufw allow 21119/tcp

Check the firewall status:

sudo ufw status

If UFW is not enabled, do not enable it without first allowing SSH and any other ports required by your server. Also check your VPS provider's firewall or security group settings.

The ports have the following purposes:

  • 21115/TCP: NAT type testing.
  • 21116/TCP and UDP: ID registration, heartbeat, and connection coordination.
  • 21117/TCP: Relay connections.
  • 21118/TCP and 21119/TCP: WebSocket support for web clients.

Get the RustDesk Public Key

After starting the containers, retrieve the public key:

sudo cat /opt/rustdesk/data/id_ed25519.pub

Copy the complete output. This key is required when configuring RustDesk clients to use your server.

If the key file does not exist immediately, check the container logs:

sudo docker compose logs hbbs

Wait for the server to initialize and check the file again.

Important: Keep the private key file id_ed25519 secure. Only distribute the public key id_ed25519.pub to clients.

Configure the RustDesk Client

Download and install the RustDesk client from the official website:

https://rustdesk.com/

Open RustDesk and navigate to Settings → Network → ID/Relay Server. Depending on your client version, the settings labels may vary.

Configure the following:

  • ID Server: rust.example.com
  • Relay Server: rust.example.com:21117
  • Key: Paste the public key from /opt/rustdesk/data/id_ed25519.pub
  • API Server: Leave blank when using RustDesk Server OSS.

Replace the example hostname with your actual domain. Save the settings and test a connection between two RustDesk clients.

Optional: Install Nginx

Nginx is not required for standard RustDesk client connections. If you want to use a domain with HTTPS for WebSocket connections, you can install Nginx as a reverse proxy.

Install Nginx and Certbot:

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

Create a configuration file for your domain:

sudo nano /etc/nginx/sites-available/rustdesk.conf

For WebSocket support, configure the following:

server {
    listen 80;
    listen [::]:80;
    server_name rust.example.com;

    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name rust.example.com;

    ssl_certificate /etc/letsencrypt/live/rust.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/rust.example.com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:21118;
        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-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Enable the configuration:

sudo ln -s /etc/nginx/sites-available/rustdesk.conf /etc/nginx/sites-enabled/rustdesk.conf

Test the configuration:

sudo nginx -t

Note: The HTTPS certificate must exist before Nginx can start with this configuration. Obtain the certificate first using the next steps, or initially configure only the HTTP server block.

Obtain an SSL Certificate

Ensure that rust.example.com resolves to your server's public IP and that TCP port 80 is accessible.

Request the certificate:

sudo certbot certonly --nginx -d rust.example.com

Test and reload Nginx:

sudo nginx -t
sudo systemctl enable --now nginx
sudo systemctl reload nginx

For WebSocket deployments, expose ports 21118 and 21119 only through a trusted reverse proxy and restrict direct access to those ports. Configure the appropriate proxy for both WebSocket services if you need both ID and relay WebSocket support.

Important: Nginx HTTPS does not replace the native RustDesk ports. Standard RustDesk clients still require the appropriate TCP and UDP ports to be reachable. The configuration above is optional and intended for WebSocket connections.

Verify the RustDesk Server

Check the running containers:

cd /opt/rustdesk
sudo docker compose ps

Check the logs:

sudo docker compose logs --tail=50 hbbs
sudo docker compose logs --tail=50 hbbr

Check the listening ports:

sudo ss -lntup | grep -E '21115|21116|21117|21118|21119'

Confirm that the public key exists:

sudo cat /opt/rustdesk/data/id_ed25519.pub

Update RustDesk Server

Back up the persistent server data before updating:

cd /opt/rustdesk
sudo tar -czf /root/rustdesk-backup-$(date +%F).tar.gz data

Pull the latest image and recreate the containers:

sudo docker compose pull
sudo docker compose up -d

Verify the services:

sudo docker compose ps
sudo docker compose logs --tail=50

Review the release notes before upgrading production installations. Back up the data and private key before making changes.

Conclusion

RustDesk Server OSS is now running on Ubuntu 26.10 using Docker Compose. You can connect RustDesk clients through your own ID and relay server using your hostname and public key.

For additional details, refer to the official documentation:


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS