Linux Deployment (systemd)
This guide covers Linux physical servers, cloud instances, and virtual machines. The one-line installer asks for a language, detects the CPU architecture, downloads the latest stable release from CheeseSec’s official source first, verifies its checksum, installs the systemd service when systemd is available, and prints the first-setup URLs. GitHub is the backup for failed downloads. Use the offline path when the host has no outbound access.
Summary
For a host without outbound access: download the archive and SHA256SUMS, verify the checksum, extract the complete package, and run sudo ./install-linux.sh from the package root.
Prepare
| Item | Requirement |
|---|---|
| OS | 64-bit Linux matching the release artifact: amd64, arm64, or loong64 |
| Resources | 1–2 cores and 2 GB RAM can run the lightweight setup profile; allocate more for production traffic |
| Privilege | root or an administrator with sudo |
| Disk | Space for the archive, Web assets, runtime data, and logs |
| Access | A browser that can reach port 9443, possibly through a restricted network or SSH tunnel |
| Firewall | Restrict 9443 to trusted administration networks; open the data-plane port only where business traffic needs it |
| Tools | curl, tar, sha256sum, systemctl, and ss |
1. One-line installation (recommended)
When already running as root, omit sudo:
The script reads language, install-root, and entry-name input from /dev/tty, so interactive answers are not consumed as script source. For unattended provisioning, set the documented CHEESEWAF_* environment variables and invoke the downloaded script; never put passwords or setup tokens in shell arguments or history.
Downloads and redirects must use HTTPS. The installer prefers official release metadata and files, and tries GitHub only when an official download fails. A checksum failure or a failed signature verification stops the run before extraction or installation; do not switch sources to bypass a failed check. To verify release provenance as well as the checksum, install a trusted cosign separately and set CHEESEWAF_VERIFY_SIGNATURE=1; verification requires the release workflow identity for the exact selected tag.
GitHub backup entry
If the official install.sh cannot be downloaded, use the GitHub release entry:
This is a download fallback. It must not be used to retry an installation that stopped on a checksum or signature error.
Select a version or installation directory
To install a specific stable or beta tag, set CHEESEWAF_RELEASE (the v prefix is optional):
During the interactive flow, choose an application install root after selecting the language. Entering /opt/cheesewaf, for example, places the binary, Web assets, runtime configuration, data, and logs under bin/, web/, config/, data/, and logs/ beneath that root. Press Enter to keep the split FHS layout shown below. The systemd unit remains under /etc/systemd/system unless CHEESEWAF_UNIT_DIR is overridden.
For automation, set CHEESEWAF_INSTALL_DIR before invoking the installer. Individual CHEESEWAF_PREFIX, CHEESEWAF_WEB_DIR, CHEESEWAF_CONFIG_DIR, CHEESEWAF_DATA_DIR, and CHEESEWAF_LOG_DIR values take precedence for their respective paths:
Install roots must be absolute dedicated directories whose path components contain only ASCII letters, digits, ., _, or -; shared system directories and paths containing shell metacharacters are rejected.
The installer will:
- Ask for 中文 or English and check Linux, architecture, disk space,
curl,tar,sha256sum,awk, andodprerequisites. - Download the selected server archive from the official source first, using GitHub only for failed downloads, and verify its single matching
SHA256SUMSentry. When signature verification is enabled, verify the checksum file against the exact release tag. A failed verification stops before installation or service startup. - Install the binary, Web Console, runtime configuration, and systemd unit, then create the non-login
cheesewafservice account. - Generate an HTTPS management listener, a one-time setup token, and a security-entry path. The entry path accepts ASCII letters and digits only; a random value is generated by default, and a custom value is accepted only when it passes the same validation.
- Start the service when systemd is available, check the listener and health state, and print the version, architecture, installation paths, service state, public management URL, detected private management URLs, token lifetime, and next steps. Without systemd, the files are installed but the service is reported as not started.
Save the complete setup URL printed at the end. On an interactive terminal the installer prints the public setup URL and the security-entry URL, and also prints each detected private-address setup URL. In a non-interactive run, secrets are withheld from stdout and stored in the root-only install-secrets.txt receipt under the configuration directory; set CHEESEWAF_SHOW_SECRETS=1 only when the output is protected. The setup URL envelope expires after 10 minutes. The setup token itself has no timer; it is revoked after the first successful setup or by an explicit reset. Do not paste the complete URL into tickets, screenshots, shell history, or logs.
2. First setup and public entry
Open the https:// URL printed by the installer. The setup URL always uses the fixed /setup path:
ONE_TIME_TOKEN is the one-time bootstrap token. The browser reads the token from the URL fragment, clears it from the address bar, and sends it in the X-CheeseWAF-Setup-Token header. The token is never placed in query parameters, cookies, or localStorage.
After setup completes, open https://PUBLIC_IP:9443/SECURITY_ENTRY. The security entry contains ASCII letters and digits only; it is generated by default or accepted as a validated custom value. The entry endpoint signs an access Cookie and redirects to the login page. Keep the setup route and the post-setup security entry as separate paths.
The management plane uses HTTPS and binds on all interfaces by default for this installation path. The installer writes the detected public host to admin.env; set CHEESEWAF_ADMIN_PUBLIC_HOST when the host has no directly assigned public address, for example behind NAT or a reverse proxy. Restrict security groups, firewalls, and any reverse proxy to trusted administration networks before exposing port 9443 to the Internet. A locally generated certificate may cause a browser warning on first access; replace it with a trusted certificate for production use.
After setup completes, the bootstrap token is invalid. If the URL is lost before an administrator is created, reset it on the host:
The command prints a new URL when --show is set; without it, the URL is written to the protected setup.url file under the data directory. Adjust the paths when the service uses a custom install root. The old URL cannot be recovered.
Running the installer again against an existing configuration performs an upgrade. It keeps the existing listener, TLS settings, sites, policies, and security-entry path; choose the same install root or set the same CHEESEWAF_*_DIR overrides so the intended service is upgraded.
3. Verify
Expected result: the service is enabled and active, the expected process owns 9443, and the readiness endpoint returns successfully. Confirm that the version and architecture match the target host. After first setup, add one protected site and configure the data-plane listener from the Console.
Standard paths
| Path | Purpose |
|---|---|
/usr/local/bin/cheesewaf | Main binary |
/usr/local/bin/waf-cli | CLI symlink |
/usr/share/cheesewaf/web | Web Console assets |
/etc/cheesewaf/cheesewaf.yaml | Runtime configuration copy |
/var/lib/cheesewaf | Local database, certificates, setup state, and runtime data |
/var/log/cheesewaf | Access and audit logs |
With CHEESEWAF_INSTALL_DIR=/opt/cheesewaf, the corresponding application paths are /opt/cheesewaf/bin/cheesewaf, /opt/cheesewaf/web, /opt/cheesewaf/config/cheesewaf.yaml, /opt/cheesewaf/data, and /opt/cheesewaf/logs.
4. Offline or manual installation
On a connected machine, prefer the official CheeseSec website to obtain the architecture-specific .tar.gz, SHA256SUMS, and signature files when published. GitHub Releases is the backup download source. Keep every file from the same release, then transfer them to the target host. Verify the files in the download directory, extract the archive, and run the installer from the package root:
The packaged installer expects the matching cheesewaf, web/dist, configs/, and systemd unit in its working directory; it does not download a release by itself. Do not pipe an arbitrary script from an unverified URL into bash, and do not run the packaged installer outside its extracted package root.
The offline script still asks for the language and entry path locally, generates the setup token, and starts the service. On a host without systemd, copy the binary and web/dist into your process manager’s paths and start the service there. Keep a runtime configuration copy and a dedicated data directory; never edit the tracked configs/cheesewaf.yaml template in place.
Do not use unverified binaries, third-party mirrors, or stale installer scripts. A complete Linux archive contains cheesewaf, Web assets, configuration templates, the systemd unit, and the installer; stop and download the archive again if any item is missing.
Troubleshooting
| Symptom | Check | Action |
|---|---|---|
cheesewaf binary not found | pwd and ls in the extracted directory | Run the packaged installer from the package root; do not extract only the binary. |
web/dist/index.html missing | find web -maxdepth 2 -type f | Download the complete release archive again. |
| Checksum or signature verification fails | Check the selected release and matching checksum/signature files | Stop installation and investigate the mismatch. Do not switch to the backup source or disable verification to continue. |
| Service exits immediately | sudo journalctl -u cheesewaf -b --no-pager | Fix the first validation error; confirm the runtime config is a copy, not the tracked template. |
Port 9443 is unreachable remotely | ss -ltnp | grep ':9443' | Allow 9443 from trusted administration networks in the firewall or security group, and confirm the listener and CHEESEWAF_ADMIN_PUBLIC_HOST. |
| Setup page loads but initialization fails | sudo ls -l /etc/cheesewaf/install-secrets.txt | Use the setup URL from the receipt, or reset the token with sudo -u cheesewaf /usr/local/bin/cheesewaf --config /etc/cheesewaf/cheesewaf.yaml --data-dir /var/lib/cheesewaf setup token reset --show; never paste the URL into logs or tickets. |
Proxy returns 502 | Check the configured upstream from the Console and test it from the WAF host | Confirm the origin is reachable and that the site points at the data-plane listener, not the management port. |
| Production storage refuses to start | Inspect the storage error in journalctl | Configure the required production storage; do not force a local SQLite fallback. |
For Docker-specific port and data-volume behavior, use the Docker guide. For backups and upgrades, continue with Operations.