---
title: "How to Install RustDesk on the Latest Ubuntu and Debian Server - CloudBlast"
description: "Build a self-hosted RustDesk Server OSS on Ubuntu or Debian with Docker, relay networking, firewall rules, encryption keys, and client configuration."
url: "https://cloudblast.io/article/how-to-install-rustdesk-on-ubuntu-and-debian-server"
language: "en-US"
---

BLOG

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

5€ FREE BALANCE when you register

Register to cloudblast and get 5€ cloud credit to deploy your VPS's

[Claim Free 5€](https://console.cloudblast.io/auth/login?ref=2)

-   [Back](https://cloudblast.io/)
-   [All Articles](https://cloudblast.io/blog)

2026-07-25 · 6 min read · [By CloudBlast Team](https://cloudblast.io/author/cloudblast-team)

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

tutorials

[Add as a preferred source on Google](https://www.google.com/preferences/source?q=cloudblast.io)

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:

```text
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:

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

Open SSH and the core RustDesk ports:

```bash
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:

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

Check the firewall rules:

```bash
sudo ufw status
```

## Install Docker and Docker Compose

Install the current Docker Engine and Compose plugin:

```bash
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:

```bash
docker --version
docker compose version
```

## Download the RustDesk Server Configuration

Create a directory with a persistent data folder:

```bash
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:

```bash
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:

```bash
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:

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

Confirm that both containers are running:

```bash
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:

```bash
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](https://rustdesk.com/docs/en/self-host/rustdesk-server-oss/).

Update the container image with:

```bash
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:

```bash
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:

```bash
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](https://console.cloudblast.io/) with a public IP, open the RustDesk ports, and run the lightweight server stack above. Check [CloudBlast plans and pricing](https://cloudblast.io/pricing) if you expect several simultaneous relay sessions.

For version-specific changes, use the [official RustDesk Server installation guide](https://rustdesk.com/docs/en/self-host/rustdesk-server-oss/install/), [Docker guide](https://rustdesk.com/docs/en/self-host/rustdesk-server-oss/docker/), and [client configuration guide](https://rustdesk.com/docs/en/self-host/client-configuration/).

Share

## Continue Reading

[2026-07-25 How to Install and Set Up Mailcow on Ubuntu and Debian VPS tutorials](https://cloudblast.io/article/how-to-install-and-setup-mailcow-on-ubuntu-and-debian-vps)

[2026-07-25 How to Install Chatwoot on the Latest Ubuntu and Debian Server tutorials](https://cloudblast.io/article/how-to-install-chatwoot-on-ubuntu-and-debian-server)

[2026-07-25 How to Install Mattermost on the Latest Ubuntu and Debian Server tutorials](https://cloudblast.io/article/how-to-install-mattermost-on-ubuntu-and-debian-server)

[2026-07-08 How to Install Msty tutorials](https://cloudblast.io/article/how-to-install-msty)
