This is the secondary deployment path: a single cloud-init.yaml
user-data file that installs 3x-ui non-interactively on a fresh Ubuntu/Debian
VM and generates unique random credentials per instance. Use it when you do
not want to build a golden image — it works on any cloud-init platform.
For AWS Marketplace / reusable images, use the Packer build in
../packer/instead.
/opt/xui-bootstrap.sh, which exports
XUI_NONINTERACTIVE=1 and pipes the project's install.sh into bash.install.sh runs end-to-end with zero prompts, picking secure random
values for any credential you didn't pin./etc/x-ui/install-result.env
(mode 600), echoed to the serial console, and appended to /etc/motd.Retrieve them after boot with either:
sudo cat /etc/x-ui/install-result.env # over SSH
…or read the provider's serial console output (handy before you have SSH).
Edit the export XUI_* lines inside the write_files block of
cloud-init.yaml. All knobs are optional; unset ⇒ random/secure default.
| Env var | Default | Meaning |
|---|---|---|
XUI_SSL_MODE |
none |
none (plain HTTP), ip (Let's Encrypt IP cert), domain |
XUI_USERNAME |
random | Admin username |
XUI_PASSWORD |
random | Admin password |
XUI_PANEL_PORT |
random high port | Panel listen port |
XUI_WEB_BASE_PATH |
random | Panel base path (obscures the URL) |
XUI_DOMAIN |
— | Required when XUI_SSL_MODE=domain |
XUI_ACME_EMAIL |
— | Let's Encrypt account email (domain mode) |
XUI_DB_TYPE / XUI_DB_DSN |
sqlite |
Set postgres + DSN to use PostgreSQL |
TLS note:
noneserves the panel over plain HTTP on a random high port — fine behind a reverse proxy or an SSH tunnel, but put TLS in front of it before exposing the panel publicly.domainmode needs a public DNS A record pointing at the box and port 80 reachable at install time.
hcloud server create --image ubuntu-24.04 --user-data-from-file cloud-init.yaml ...aws ec2 run-instances --user-data file://cloud-init.yaml ...
(For a reusable Marketplace image use the Packer AMI build instead.)doctl compute droplet create --user-data-file cloud-init.yaml ...gcloud compute instances create xui \
--image-family ubuntu-2404-lts-amd64 --image-project ubuntu-os-cloud \
--metadata-from-file user-data=cloud-init.yamlaz vm create --image Ubuntu2404 --custom-data cloud-init.yaml ...cloud-init schema --config-file deploy/cloud-init/cloud-init.yaml