Step 1: Update and Prepare Ubuntu
Make sure your system is up to date:
bashsudo apt update && sudo apt upgrade -y
Install required dependencies:
bashsudo apt install curl wget unzip -y
Step 2: Download RustDesk Server (hbbs
and hbbr
)
RustDesk has two key server components:
hbbs
(RustDesk ID relay server)hbbr
(RustDesk NAT traversal server)
Download the latest RustDesk server release:
bashmkdir -p /opt/rustdesk && cd /opt/rustdesk
wget https://github.com/rustdesk/rustdesk/releases/latest/download/rustdesk-server-linux-amd64.zip
unzip rustdesk-server-linux-amd64.zip
chmod +x hbbs hbbr
Step 3: Configure and Start RustDesk Server
- Start
hbbr
(Relay Server)
Run the relay server first: bashCopyEdit./hbbr &
- Start
hbbs
(ID Server) bashCopyEdit./hbbs -r <your-server-ip>:21117 &
- Confirm Processes are Running bashCopyEdit
ps aux | grep hbbs ps aux | grep hbbr
Step 4: Enable Firewall Rules (If Enabled)
Open necessary ports:
bashsudo ufw allow 21115/tcp
sudo ufw allow 21116/tcp
sudo ufw allow 21117/tcp
sudo ufw enable
Step 5: Configure Clients to Use Your Server
On RustDesk clients (Windows, macOS, Linux), go to:
- Settings > Network
- Set the ID Server to
your-server-ip:21117
- Apply changes
Step 6: Set Up Systemd Services (Optional)
To ensure RustDesk server starts on boot, create systemd services.
- Create a Service for
hbbr
bash sudo nano /etc/systemd/system/rustdesk-hbbr.service
Add the following content: iniCopyEdit[Unit] Description=RustDesk Relay Server After=network.target [Service] ExecStart=/opt/rustdesk/hbbr Restart=always User=root [Install] WantedBy=multi-user.target
- Create a Service for
hbbs
bash sudo nano /etc/systemd/system/rustdesk-hbbs.service
Add: iniCopyEdit[Unit] Description=RustDesk ID Server After=network.target [Service] ExecStart=/opt/rustdesk/hbbs -r <your-server-ip>:21117 Restart=always User=root [Install] WantedBy=multi-user.target
- Enable and Start Services bash
sudo systemctl daemon-reload sudo systemctl enable rustdesk-hbbr rustdesk-hbbs sudo systemctl start rustdesk-hbbr rustdesk-hbbs
Step 7: Verify RustDesk Server is Running
Check logs for any errors:
bashsudo journalctl -u rustdesk-hbbr -f
sudo journalctl -u rustdesk-hbbs -f
You should see output indicating the server is running and clients are connecting.
Step 8: (Optional) Use a Domain with TLS
If you want to use a domain with RustDesk, you can set up Nginx as a reverse proxy with Let’s Encrypt for SSL. Let me know if you need help with that.
Final Notes
- Clients must use your server’s IP or domain name in the RustDesk settings.
- If you are behind NAT, ensure port forwarding is configured.
- Keep your server updated to avoid security vulnerabilities.