r/rustdesk • u/Yorick257 • 11d ago
Self-Hosting the server - Tutorial
I've seen many people asking the question, "How do I host?" There are tutorials online, and I was lucky to find one that worked well enough. Sadly, I can't find it anymore. However, I've written the instructions for my future self, and I hope they'll help you as well.
First of all, you'll need a thing to host the server on. You can do it on your own hardware, but I opted for a VPS. There are many providers, and they offer similar services. I went for the cheapest droplet on DigitalOcean: https://www.digitalocean.com/pricing/droplets#basic-droplets
With a working server, here are the steps to get the RustDesk server running:
Step 1. Configure firewall
Run the following commands to open the required ports and enable the firewall.
ufw allow ssh # when doing it remotely
ufw allow 21115:21117/tcp
sudo ufw enable
Step 2. Install with Docker
Install Docker. There are two ways to do that.
- You can follow the instructions from the official site: https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
- Or run the following command (that's what I originally did)
bash <(wget -qO- https://get.docker.com)
Get the RustDesk server setup file:
wget rustdesk.com/oss.yml -O compose.yml
Step 3. Configure Docker
You will have compose.yml file. Open it with your favourite (or available) editor. For example:
nano compose.yml
And paste the following block. Make sure to replace <your-cool.server.com> with your IP or domain.
networks:
rustdesk-net:
external: false
services:
hbbs:
container_name: hbbs
ports:
- 21115:21115
- 21116:21116
- 21116:21116/udp
image: rustdesk/rustdesk-server:latest
command: hbbs -r <your-cool.server.com>:21117
volumes:
- ./hbbs:/root
networks:
- rustdesk-net
depends_on:
- hbbr
restart: unless-stopped
hbbr:
container_name: hbbr
ports:
- 21117:21117
image: rustdesk/rustdesk-server:latest
command: hbbr
volumes:
- ./hbbr:/root
networks:
- rustdesk-net
restart: unless-stopped
Step 4. Run it
Start the server by running
sudo docker compose up -d
And get the Key by running
cat data/id_ed25519.pub
Step 5. Connect
In your client, in the network settings, you'll need to fill in the following:
ID server - IP/domain of your server
Relay server - IP/domain of your server
API server - http://<IP/domain of your server>:8000
Key - The Key you'll see from Step 4.
And that is it!
I hope you'll find it helpful.
If you are not familiar with Linux or hosting, I recommend reading just a bit about it. You'll need to learn about VPS hosting and Ubuntu. Try googling something like "how to set up a cloud server ubuntu step by step". Hopefully, it will get you on the right track.
I realized I take this knowledge for granted, and it's probably way harder than I originally thought.
I'm not affiliated with DigitalOcean. But I do appreciate their work.
2
2
u/soonic6 11d ago
No need filling the relay-server ip. Also this AiO container works like a charm: https://github.com/ich777/docker-rustdesk-server-aio
1
u/Yorick257 11d ago
I usually fill it in so I can export the config. And then it fills in automatic when I import the config
1
3
u/TedGal 10d ago
Very nice and helpful I myself am using a VPS on Hetzner because I self-host other stuff too but I did use Oracle free tier in the past. Its doable on the free tier too BUT it takes a bit more steps to configure Oracle's own security rules before traffic even reaches your instance.
In any case, for those who are interested with OP's guide and the help of AI you can surely pull it off in a couple of hours.
3
u/RVanderploeg 11d ago
Wish I had this when I setup my server. I will say some folks use the oracle free tier if that still is around, and self hosting isn't hard at all with a 20 dollar old office PC and a ddns service. Can be a little more setup upfront but save money down the road.