# Install Hermitbox

> Let your agent do it: Install Hermitbox on this Linux machine. Run `curl -fsSL https://hbx.sh | sh` on `x86_64` or `aarch64` as my ordinary user, never with sudo, unless I ask for the server or node preset. If I want to see the plan first, run `hermitbox up --check`. Then run `~/.local/bin/hermitbox run -- echo hello` and show me the output. The installer saves the API URL and key privately, so never copy the key into a config file or this chat. Follow the exact steps in https://docs.hermitbox.dev/v0.2.1/get-started/install.md.

Install and start Hermitbox with one command on Linux (`x86_64` or `aarch64`), as your own user,
with no root and no Docker. The installer asks nothing, prints the API URL and key, and saves them
privately.

```sh
curl -fsSL https://hbx.sh | sh
```

Check that it works:

```sh
~/.local/bin/hermitbox run -- echo hello
```

The installer detects the host and takes its preset. `hermitbox up --check` prints the plan
without changing anything. `--preset user|container|server|node` overrides what the installer
detected.

## User preset

An ordinary account gets the user preset, with no sudo, Docker or system manager. The release
bundle is signed with the ML-DSA-65 release keys. It includes PostgreSQL, RustFS, control, edge,
`hermitboxd` and its agent.

The installer takes the release built for the host's machine. On `aarch64`, `wasm`, `vm` and the
native process tools are off and say why: their pinned agentOS sidecar, VM bundle and tool bundle
are built for `x86_64`.

Data, configuration, state and runtime sockets follow absolute XDG paths below home. The defaults
are:

- `~/.local/share/hermitbox`
- `~/.config/hermitbox`
- `~/.local/state/hermitbox`
- `~/.cache/hermitbox-runtime/hermitbox`

Hermitbox refuses an XDG path that escapes home. The runtime falls back below home when
`/run/user` is outside it.

The service listens on loopback port 7331, or on another free unprivileged port when 7331 is busy.
Sandboxes use authenticated path aliases, so a domain is optional.

Process isolation needs enforceable Landlock ABI 3. On compatible GNU hosts without it, the user
preset selects and reports Wasm instead. Hermitbox refuses any unsupported backend you request by
name.

When systemd user services and linger are available, Hermitbox installs and starts
`~/.config/systemd/user/hermitbox.service`. Otherwise it stays in the foreground and prints how
to keep it running after logout. In a second terminal, run `~/.local/bin/hermitbox run -- echo hello`.

New POSIX shells find `hermitbox` through a managed `PATH` block. Read-only, unsafe or symlinked
shell profiles stay untouched. The absolute path works in the current shell.

Process sandboxes share your UID, so use them for work you trust. The setup summary reports
whether the managed service supports [process memory and CPU limits](https://docs.hermitbox.dev/v0.2.1/reference/process-tier.md#limits).

### Upgrade or remove

- `hermitbox upgrade` authenticates the latest release and keeps state and credentials. Under
  foreground supervision it stays attached to the upgraded service. Deployment requirements stay
  in place across user-manager restarts and upgrades. A backend change needs an explicit data
  migration.
- `hermitbox down` stops the service and its retained compute, and keeps data.
- `hermitbox down --purge` also removes the managed bundle, configuration, state, cache,
  bootstrap, CLI shortcut, exact `PATH` block and user unit. It prints the removed paths. It
  reverses linger only when this installation enabled it. Save backups before purging.

## Server with root

Root on a systemd host, outside a container, gets the server preset. For a public domain, point a
DNS A record at the server and allow inbound TCP 443 for HTTPS and certificate validation. The edge
needs local TCP ports 80 and 443 for its HTTP and TLS fronts.

```sh
curl -fsSL https://hbx.sh | sudo HERMITBOX_DOMAIN=sandboxes.example.com sh
```

A systemd host gets Docker, nftables, persistent Docker volumes for the database and object store,
control and edge units, and its enrolled local node. Debian and Ubuntu can install missing packages
automatically. Other distributions need Docker and nftables installed first, and the installer
names them before it provisions anything.

Server sandbox placement needs private network and PID namespaces and enforced CPU and memory
limits. The main daemon's unit hardening stays in force.

The API is available at `https://sandboxes.example.com` with an automatically renewed certificate.
Omit `HERMITBOX_DOMAIN` to install a local server with loopback port 7331 and path aliases.
Existing domains stay immutable.

See [Host on a server with root](https://docs.hermitbox.dev/v0.2.1/hosting/server.md) for the full setup, and
[operations](https://docs.hermitbox.dev/v0.2.1/guides/operate.md) for DNS, TLS, server upgrades and explicit data removal.

## Inside a container

```sh
curl -fsSL https://hbx.sh | sh
```

An ordinary account still gets the user preset. Root in a container gets the container preset,
with managed files under:

- `/opt/hermitbox`
- `/etc/hermitbox-local`
- `/var/lib/hermitbox`
- `/run/hermitbox-local`

Embedded PostgreSQL drops to its dedicated nonzero UID.

Process confinement must actually pass. Missing kernel syscalls cause a refusal that says what to
change. A mounted Docker socket alone does not establish correct host bind paths or firewall
coverage, so use the server preset on the engine host for image workloads.

## Platform that runs images

```sh
docker run -p 8080:8080 -v hermitbox:/var/lib/hermitbox ghcr.io/hermitbox/hermitbox:0.2.1
```

The same supervisor runs inside the release image. The first key appears once in its log. Keep the
named volume, and configure a trusted TLS terminator for remote access.

See [Deploy the release image](https://docs.hermitbox.dev/v0.2.1/hosting/container.md) for Render, external stores and image
tiers, and [Hosting](https://docs.hermitbox.dev/v0.2.1/hosting.md) for each platform.

## Node joining a fleet

```sh
export HERMITBOX_JOIN_TOKEN='<fleet-token>'

curl -fsSL https://hbx.sh | \
  sudo --preserve-env=HERMITBOX_JOIN_TOKEN HERMITBOX_PRESET=node sh
```

The token stays in the environment, which only the account that set it and root can read. A token
in a command's arguments is visible to every account on the host while the command runs.

The node preset uses the existing root and systemd fleet join. It installs the verifier and uses
the supplied fleet token. It verifies the signed daemon and agent bootstrap independently of the
fleet before joining. The token is an operator credential: keep it out of shell history and CI
output.

On first enrollment the node denies all container images by default. To allow selected images, add
`HERMITBOX_NODE_ALLOW_IMAGES='alpine:,registry.example/team/'` beside `HERMITBOX_PRESET=node` in
the command above. Separate entries with commas. Each means the same as one
`hermitbox node join --allow-image` value:

- A repository ending in `:` permits its tags.
- A namespace ending in `/` permits images under it.
- A complete SHA-256 image reference permits that digest alone.

Repeat enrollment keeps the node's saved policy. See [operations](https://docs.hermitbox.dev/v0.2.1/guides/operate.md) for issuing
a token and node policy, [Nodes and fleet](https://docs.hermitbox.dev/v0.2.1/concepts/fleet.md) for how nodes and control work
together, and [Add machines](https://docs.hermitbox.dev/v0.2.1/guides/add-machines.md) for machine providers.

## Install options

Set `HERMITBOX_NO_UP=1` on the installer process to install only the CLI. Preview builds are signed
with a separate ML-DSA-65 identity and cannot replace production release keys.

Local installations use every supported tier by default. To serve one backend, set
`HERMITBOX_RUNTIME` to `container`, `process` or `wasm` when installing. Restarts and upgrades use
the saved runtime, and each workload keeps its chosen tier.

The container tier needs a supported engine running on the same host, so an installation inside a
container keeps that tier off. `hermitbox doctor` and `hermitboxd doctor` report tier availability.
