Install the Nezha Agent (Official Script and Environment Variables)
This tutorial shows how to invoke the official Nezha agent installer with xyz.sh/nezha. Use the real connection values from your own Dashboard; do not connect with sample values from the docs.
$ curl -fsSL xyz.sh/nezha | bash
Details · xyz.sh/nezha · Last updated:
Prepare
Copy NZ_SERVER and NZ_CLIENT_SECRET from the install command in your Nezha Dashboard. Optional: NZ_TLS, NZ_UUID. Official docs: https://nezha.wiki/guide/agent.html
Root and a supported Linux distribution are required.
Install and uninstall
curl -fsSL xyz.sh/nezha | env NZ_SERVER=host:port NZ_TLS=false NZ_CLIENT_SECRET=your_secret bash
The wrapper prints the plan with the secret redacted, downloads and previews the official script, then runs it after confirmation. The secret is passed only into the official installer on this machine.
Run curl -fsSL xyz.sh/nezha | bash -s -- uninstall, which calls the official script with uninstall.
Return to the server list in your Nezha Dashboard and check whether the host comes online. The official script prints a success message when the install finishes.