Why this step matters 🔍
dstack compiles kernel-level helpers (via WireGuard) and runs micro-VMs.Before it can start, your host must have:
- Kernel headers that exactly match your running kernel (for out-of-tree modules).
- Build-essential tool-chain (gcc, make, etc.).
- Rust tool-chain (dstack, guest helpers, and some plugins are written in Rust).
- WireGuard userspace & kernel module for encrypted overlay networking.
Good to know:
These commands assume Ubuntu 20.04+ (including 24.04).
For other distros, install the equivalent packages (e.g.dnf groupinstall "Development Tools"
on Fedora).
Prerequisites
- A bare-metal TDX server set up via canonical/tdx
(ensures hardware isolation + SGX/TDX firmware support). - Public IPv4 address on the machine.
- 16 GB RAM and 100 GB free disk (minimum).
- A domain with DNS control if you’ll expose
dstack-gateway
over HTTPS.
1 – Update the package cache
Always refresh apt metadata first:2 – Install kernel headers, dev tools, and WireGuard
linux-headers-$(uname -r)
– must matchuname -r
; otherwise DKMS fails.build-essential
– gcc, g++, make, libc headers.wireguard
+wireguard-tools
– encrypted overlay between VM and gateway.chrpath
,diffstat
,lz4
,xorriso
– helpers pulled in by dstack build scripts.
💡 If you just upgraded your kernel and the exact header package is not yet published, reboot into an older kernel (via GRUB) whose headers exist, or wait until the mirror catches up.
3 – Install the Rust tool-chain
dstack targets stable Rust. Userustup
so future updates are one command away:
4 – Create the dstack environment file
dstack reads runtime settings from/etc/dstack/.env
.
Variable | Reason |
---|---|
DSTACK_DOMAIN | Enables automatic HTTPS via ACME (Zero-Trust gateway). |
DSTACK_EMAIL | Required by Let’s Encrypt for expiry notices & abuse reports. |
DSTACK_API_PORT / DSTACK_UI_PORT | Separate the JSON API from the user-facing UI so you can lock one down via firewall if needed. |
5 – Register dstack as a systemd
service
Running dstack under systemd
guarantees auto-start on boot and automatic restart on crash.
Verify
Listening on https://<DSTACK_DOMAIN>
and no errors about WireGuard or TLS.
Next Steps
- Open ports
80
and443
(or your custom ports) on any cloud firewall. - Proceed to Step 4 – Deploy dstack UI to push your first container or notebook.
- Optionally harden the host (fail2ban, UFW rules, unattended-upgrades).