How to Install RustDesk Remote Desktop Server on Ubuntu 25.04
RustDesk is an open-source remote desktop tool that enables secure and private connections. Below is a complete guide to set it up on Ubuntu 25.04 using Docker, Docker Compose, Nginx, and SSL.
Prerequisites
- Ubuntu 25.04 server (e.g., hosted on Vultr)
- A subdomain (e.g., rust.example.com) pointing to your server's IP
- Docker and Docker Compose
- Non-root sudo user with SSH access
Install Docker & Docker Compose
sudo apt update
sudo apt install -y docker.io
sudo systemctl enable --now docker
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
Set Up RustDesk Server Using Docker Compose
sudo mkdir -p /opt/rustdesk
cd /opt/rustdesk
sudo nano rustdesk.yml
Paste the following into rustdesk.yml
:
version: '3'
networks:
rustdesk-net:
external: false
services:
hbbs:
container_name: hbbs
ports:
- 21115:21115
- 21116:21116
- 21116:21116/udp
- 21118:21118
image: rustdesk/rustdesk-server:latest
command: hbbs -r 127.0.0.1:21117 -k _
volumes:
- ./hbbs:/root
networks:
- rustdesk-net
depends_on:
- hbbr
restart: unless-stopped
hbbr:
container_name: hbbr
ports:
- 21117:21117
- 21119:21119
image: rustdesk/rustdesk-server:latest
command: hbbr -k _
volumes:
- ./hbbr:/root
networks:
- rustdesk-net
restart: unless-stopped
Save the file (Ctrl+O, Enter, Ctrl+X) and run:
sudo docker-compose -f rustdesk.yml up -d
sudo docker ps
Install and Configure Nginx
sudo apt install -y nginx
sudo ufw allow 80/tcp
sudo ufw enable
sudo ufw reload
Create Nginx configuration:
sudo nano /etc/nginx/conf.d/rust.example.com.conf
Replace rust.example.com
with your domain:
server {
listen 80;
listen [::]:80;
server_name rust.example.com;
location / {
proxy_pass http://127.0.0.1:21117;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Save and exit. Test and restart Nginx:
sudo nginx -t
sudo systemctl restart nginx
Secure with SSL (Certbot)
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d rust.example.com
Reload Nginx after SSL setup:
sudo nginx -t
sudo systemctl reload nginx
Get Public Key for Client Configuration
cat /opt/rustdesk/hbbs/id_ed25519.pub
Copy the output key for client use.
Configure the RustDesk Client
- Download client from https://rustdesk.com/
- Open client and go to Settings > ID/Relay Server
- Enter:
- ID Server:
rust.example.com
- Key: Paste the key from the previous step
- ID Server:
- Click OK and start connecting
Test the Setup
- Install the RustDesk client on another device
- Use the remote ID shown on the target system
- Initiate a connection through your private server
🎉 You now have a fully working RustDesk server with Docker, Nginx, and SSL on Ubuntu 25.04!
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