Home Domains Support News Company

How to Deploy a RustDesk Server on a LuckVM Cloud Server: Complete Ubuntu 24.04 Guide

RustDesk is a popular open-source remote desktop solution that allows users to build their own remote desktop infrastructure instead of relying entirely on a third-party service. By deploying RustDesk Server on a LuckVM cloud server, you can host the ID and relay services yourself and have greater control over the network environment.
 

This guide uses LuckVM Cloud Server + Ubuntu 24.04 + Docker Compose as an example. It covers the entire deployment process, including Docker installation, RustDesk Server configuration, firewall rules, server keys, client configuration, and basic troubleshooting.

 

1. Requirements for Deploying RustDesk Server

 

RustDesk Server does not require a powerful server for personal use. A small cloud server is generally sufficient if it is mainly used for remote access between a few computers.

                                                                                                                                                                                      
Item Recommended Configuration
Operating System Ubuntu 22.04 / Ubuntu 24.04
CPU 1 vCPU or more
Memory 1 GB or more
Storage 10 GB or more
IP Address Public IPv4 address
Network Required RustDesk ports must be accessible
 

For personal remote access, the server configuration is usually not the main concern. However, if many connections need to use the relay service, network bandwidth and traffic become much more important.

 

2. How Does RustDesk Server Work?

 

A RustDesk Server deployment mainly consists of two core services:

 
       
  • hbbs: Handles ID registration, device discovery, and connection coordination.
  •    
  • hbbr: Provides relay services when two clients cannot establish a direct P2P connection.
  •  
 

Under normal circumstances, the connection process can look like this:

 
Computer A
    │
    ▼
   hbbs
    │
    ▼
Attempt P2P Connection
    │
    ▼
Computer B
 

If a direct connection cannot be established, the relay server may be used:

 
Computer A
    │
    ▼
   hbbs
    │
    ▼
   hbbr
    │
    ▼
Computer B
 

This is why both hbbs and hbbr should be deployed when setting up a complete RustDesk Server.

 

3. Log in to Your LuckVM Cloud Server

 

First, connect to your LuckVM cloud server through SSH. If you are using the root account, run:

 
ssh root@YOUR_SERVER_IP
 

For example:

 
ssh root@123.123.123.123
 

After logging in, update the Ubuntu system:

 
apt update
apt upgrade -y
 

4. Install Docker

 

Docker Compose makes it much easier to deploy and manage RustDesk Server. Install Docker with:

 
curl -fsSL https://get.docker.com | sh
 

Check the Docker installation:

 
docker --version
 

Then check Docker Compose:

 
docker compose version
 

If both commands return version information, Docker is ready for the RustDesk deployment.

 

5. Create the RustDesk Data Directory

 

Create a dedicated directory for RustDesk:

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

The final directory structure will look like this:

 
/opt/rustdesk/
├── docker-compose.yml
└── data/
 

The data directory is particularly important because RustDesk stores its server keys and persistent data there. Do not delete this directory during normal upgrades.

 

6. Create the Docker Compose File

 

Create the Docker Compose configuration:

 
nano /opt/rustdesk/docker-compose.yml
 

Add the following configuration:

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

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

Save the file and exit Nano:

 
Ctrl + O
Enter
Ctrl + X
 

The configuration uses network_mode: "host", allowing the RustDesk containers to use the host server's network directly.

 

7. Start RustDesk Server

 

Go to the RustDesk directory:

 
cd /opt/rustdesk
 

Download the required Docker image:

 
docker compose pull
 

Start the services:

 
docker compose up -d
 

Check the container status:

 
docker compose ps
 

You should see both hbbs and hbbr running.

 

To check the hbbs logs:

 
docker logs hbbs
 

To check the hbbr logs:

 
docker logs hbbr
 

8. Open the Required RustDesk Ports

 

Firewall configuration is one of the most common reasons for RustDesk connection problems.

                                                                                                                                                                                                                                       
Port Protocol Purpose
21115 TCP NAT type detection
21116 TCP TCP connections and ID services
21116 UDP ID registration and heartbeat
21117 TCP Relay service
21118 TCP Web Client, optional
21119 TCP Web Client Relay, optional
 

For a standard RustDesk deployment, it is recommended to allow at least:

 
21115 TCP
21116 TCP
21116 UDP
21117 TCP
 

9. Configure Ubuntu UFW

 

If UFW is enabled on Ubuntu, allow the required ports with:

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

Reload the firewall:

 
ufw reload
 

Check the current rules:

 
ufw status
 

If LuckVM provides an additional security group or cloud firewall, the same ports should also be allowed there.

 

In other words, the network path may look like:

 
Internet
   ↓
LuckVM Security Group
   ↓
Ubuntu UFW
   ↓
Docker
   ↓
RustDesk
 

If any layer blocks the required ports, the RustDesk client may fail to connect even though the containers are running normally.

 

10. Get the RustDesk Server Key

 

After RustDesk Server starts, it will generate a server key automatically.

 

Run:

 
cat /opt/rustdesk/data/id_ed25519.pub
 

The command will return a string similar to:

 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 

This is the public key that should be entered into your RustDesk clients.

 

You will normally find two key files in the data directory:

 
id_ed25519
id_ed25519.pub
 

id_ed25519 is the private key, while id_ed25519.pub is the public key.

 

Never publish or share the private key. Only the content of id_ed25519.pub should be configured on the client side.

 

11. Configure the RustDesk Client

 

Open RustDesk on your computer and go to:

 
Settings → Network
 

Find the ID Server field and enter the public IP address of your LuckVM server.

 

For example:

 
123.123.123.123
 

Then enter the public key obtained from:

 
cat /opt/rustdesk/data/id_ed25519.pub
 

If you want to specify the relay server manually, use:

 
123.123.123.123:21117
 

Save the settings and restart the RustDesk client.

 

12. Use a Domain Name Instead of an IP Address

 

If RustDesk will be used for a long time, using a domain name is generally more convenient than configuring the server IP address on every client.

 

For example, create a DNS record:

 
rustdesk.example.com → YOUR_LUCKVM_SERVER_IP
 

The RustDesk client can then use:

 
ID Server:
rustdesk.example.com
 

For the relay server:

 
rustdesk.example.com:21117
 

If the server IP changes in the future, you only need to update the DNS record instead of changing the configuration on every RustDesk client.

 

13. Check Whether RustDesk Ports Are Listening

 

Run the following command on the LuckVM server:

 
ss -lntup | grep 211
 

This allows you to check whether RustDesk is listening on the expected ports.

 

Also check the Docker containers:

 
docker ps
 

You should see:

 
hbbs
hbbr
 

If the connection still does not work, check the latest logs:

 
docker logs --tail 100 hbbs
 
docker logs --tail 100 hbbr
 

14. Common RustDesk Connection Problems

 

If the RustDesk client cannot connect to your self-hosted server, check the following items in order:

 
       
  1. Make sure the hbbs container is running.
  2.    
  3. Make sure the hbbr container is running.
  4.    
  5. Make sure LuckVM's security group allows the required ports.
  6.    
  7. Make sure Ubuntu UFW is not blocking the ports.
  8.    
  9. Make sure port 21116 is open for both TCP and UDP.
  10.    
  11. Verify that the client is using the correct server IP or domain name.
  12.    
  13. Verify that the client Key matches the server's id_ed25519.pub.
  14.    
  15. Make sure the server has a publicly reachable IPv4 address.
  16.    
  17. Check the hbbs and hbbr logs for specific errors.
  18.  
 

15. Why Is the Relay Server Important?

 

Not every RustDesk connection needs to pass through the server.

 

When two clients can establish a direct P2P connection, the server mainly handles device discovery and connection coordination.

 

However, some network environments make direct connections difficult. This can happen because of strict NAT, firewalls, or network restrictions.

 

In these situations, traffic may be forwarded through the hbbr relay server:

 
Computer A
    ↓
LuckVM hbbr Relay
    ↓
Computer B
 

For personal remote access, a small LuckVM cloud server is usually sufficient. If many users are expected to use the relay service, network bandwidth, traffic limits, and network quality should receive much more attention.

 

16. Common RustDesk Management Commands

 

Enter the RustDesk directory:

 
cd /opt/rustdesk
 

Start RustDesk:

 
docker compose up -d
 

Stop RustDesk:

 
docker compose down
 

Restart RustDesk:

 
docker compose restart
 

Check service status:

 
docker compose ps
 

View hbbs logs:

 
docker logs hbbs
 

View hbbr logs:

 
docker logs hbbr
 

Update RustDesk Server:

 
cd /opt/rustdesk
docker compose pull
docker compose up -d
 

17. Conclusion

 

Deploying RustDesk Server on a LuckVM cloud server is relatively straightforward when using Ubuntu 24.04 and Docker Compose. The basic process involves installing Docker, deploying the hbbs and hbbr services, opening the required firewall ports, obtaining the server public key, and configuring the RustDesk clients.

 

For personal remote access, a small LuckVM cloud server can usually handle the job without requiring a high-end configuration. When direct P2P connections are available, the server does not need to handle the full remote desktop traffic. When relay connections are required, however, server bandwidth and traffic become much more important.

 

Finally, make sure to back up the /opt/rustdesk/data directory and protect the server's private key. During future RustDesk upgrades, update the Docker image without deleting the persistent data directory. This helps keep the existing server identity and client configuration working normally.