Vieni a trovarci su Discord e chatta direttamente con il team!Discordtop-bar-close-icon
hamburger-mobile-icon
Regalo CloudBlastRichiedi 5€ gratis

· 6 min di lettura ·

How to Install RustDesk on the Latest Ubuntu and Debian Server

tutorials
How to Install RustDesk on the Latest Ubuntu and Debian Server

RustDesk is an open-source remote desktop platform. Its self-hosted server has two small services: hbbs, which handles IDs and rendezvous, and hbbr, which relays connections when two devices cannot connect directly.

This guide installs RustDesk Server OSS on a fresh Ubuntu or Debian VPS with Docker Compose. It is the server-side setup; the RustDesk client still needs to be installed on each computer you want to manage.

Before You Start

Prepare:

  • A fresh Ubuntu or Debian VPS with SSH and sudo access
  • A public IPv4 address; a DNS name such as rustdesk.example.com is optional but easier to remember
  • Docker Engine and the Docker Compose plugin
  • Enough disk space for logs and configuration data
  • A firewall that allows RustDesk's service ports

RustDesk's server is lightweight, but relay traffic uses your VPS bandwidth. Direct peer-to-peer connections use little server bandwidth; connections that fall back to hbbr can consume considerably more, especially at high screen resolutions.

If you use a hostname, create an A record before configuring clients:

rustdesk.example.com    A    203.0.113.10

Replace the example IP with your VPS address.

Update the VPS and Open the Firewall

Update the package list and install the tools used in the setup:

sudo apt update
sudo apt full-upgrade -y
sudo apt install -y ca-certificates curl wget ufw

Open SSH and the core RustDesk ports:

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

RustDesk also documents ports 21114, 21118, and 21119 for Pro or web-client features. Add them only if you use those features:

sudo ufw allow 21114:21115/tcp
sudo ufw allow 21118:21119/tcp

Check the firewall rules:

sudo ufw status

Install Docker and Docker Compose

Install the current Docker Engine and Compose plugin:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo apt install -y docker-compose-plugin
sudo systemctl enable --now docker
rm get-docker.sh

Confirm that the commands are available:

docker --version
docker compose version

Download the RustDesk Server Configuration

Create a directory with a persistent data folder:

sudo mkdir -p /opt/rustdesk-server/data
sudo chown -R "$USER":"$USER" /opt/rustdesk-server
cd /opt/rustdesk-server

Download the official RustDesk OSS Compose file:

wget https://rustdesk.com/oss.yml -O compose.yml

The official file starts both hbbs and hbbr with host networking and stores their keys and configuration in the data directory. Host networking is recommended on Linux because the services can see the VPS's real network interfaces without extra port mapping.

Review the file before starting it:

nano compose.yml

For a normal single-server deployment, the downloaded configuration can be used as-is. If you need to force all traffic through the relay, add the documented ALWAYS_USE_RELAY=Y environment setting to the hbbs service.

Start RustDesk Server

Pull the image and start the services:

docker compose -f compose.yml pull
docker compose -f compose.yml up -d

Confirm that both containers are running:

docker compose -f compose.yml ps
docker compose -f compose.yml logs --tail=100 hbbs
docker compose -f compose.yml logs --tail=100 hbbr

The server key is generated on the first hbbs start. Print the public key:

cat /opt/rustdesk-server/data/id_ed25519.pub

Keep this public key available for client configuration. Never publish the private id_ed25519 file.

Configure RustDesk Clients

Install the RustDesk client on the computers you want to connect. In each client:

  1. Open the RustDesk menu beside the local ID.
  2. Choose Network.
  3. Set ID Server to rustdesk.example.com, or use the VPS IP address.
  4. Paste the contents of data/id_ed25519.pub into the Key field.
  5. Leave Relay Server blank unless you need to specify it manually.
  6. Save the settings and restart the client if it does not register immediately.

The ID server is hbbs; the relay server is hbbr on port 21117. RustDesk can usually infer the relay address when both services are on the same host.

Test the setup from two clients on different networks. The devices should appear online, and a connection should still work when direct peer-to-peer networking is unavailable.

Keep the Server Secure

Use SSH keys instead of password-only SSH where possible, keep the VPS updated, and expose only the ports you need. The OSS server does not provide the management features of RustDesk Server Pro, so access control is largely handled by the clients and your server security.

Back up the /opt/rustdesk-server/data directory. It contains the server key and persistent state; losing the key means existing clients will need to be reconfigured with a new key.

Update RustDesk Server

Before upgrading, back up the data directory and review the current RustDesk Server OSS documentation.

Update the container image with:

cd /opt/rustdesk-server
docker compose -f compose.yml pull
docker compose -f compose.yml up -d

Do not remove the data directory during an update. The containers are disposable; the key and configuration are not.

Troubleshooting

Clients cannot find the server

Check that the hostname resolves to the VPS and that TCP 21115, TCP/UDP 21116, and TCP 21117 are open in both the VPS firewall and any CloudBlast network firewall. Then inspect the logs:

docker compose -f /opt/rustdesk-server/compose.yml logs --tail=200 hbbs hbbr

The key is rejected

Make sure you copied id_ed25519.pub, not the private id_ed25519 file. Remove extra spaces or line breaks when pasting the public key into the client.

Connections work only when both devices are on the same network

This usually means direct NAT traversal is failing or the relay port is blocked. Verify TCP 21117 and confirm that hbbr is running:

docker compose -f /opt/rustdesk-server/compose.yml ps hbbr
docker compose -f /opt/rustdesk-server/compose.yml logs --tail=100 hbbr

The relay uses too much bandwidth

Relay traffic passes through the VPS. Lower the remote session's display quality or add a larger bandwidth plan if many devices will connect through hbbr.

Frequently Asked Questions

Is RustDesk Server OSS free?

Yes. RustDesk Server OSS is the open-source backend containing the ID/rendezvous and relay services. RustDesk Server Pro adds centralized management and other business features.

Can I install RustDesk Server without Docker?

Yes. RustDesk documents native systemd and Debian package options. Docker Compose is usually easier to reproduce and upgrade on an Ubuntu or Debian VPS.

Do I need HTTPS for the OSS server?

The core ID and relay services use their own RustDesk ports, so HTTPS is not required for a basic OSS deployment. A domain is still useful for a stable server address, and Pro web-console features may require additional HTTPS configuration.

Can I run the RustDesk client on a headless server?

The client is intended for a graphical desktop session. For a headless Linux machine, install the RustDesk client only if you have configured the required display environment; the self-hosted server itself does not need a desktop.

Get Started

Deploy a CloudBlast VPS with a public IP, open the RustDesk ports, and run the lightweight server stack above. Check CloudBlast plans and pricing if you expect several simultaneous relay sessions.

For version-specific changes, use the official RustDesk Server installation guide, Docker guide, and client configuration guide.