> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Install Formal Endpoint on Linux

> Install the Formal Endpoint on Debian and Ubuntu desktops and servers

## Overview

The Formal Endpoint ships two Debian and Ubuntu packages. Both add the `formal` CLI and a systemd user service named `formal.service`.

* **Desktop** (`formal-desktop`): for workstations with a graphical session. It adds a system tray icon and keeps your login in the system keyring.
* **Headless** (`formal-desktop-headless`): for servers, VMs, and other hosts without a GUI. It runs `formal agent --headless`.

People log in with Formal SSO through the browser on either package. Use an API key or [OIDC](https://docs.formal.ai/docs/guides/client-apps/oidc.md#log-in-with-oidc) only for machine identities, such as CI jobs and cloud workloads.

Enable Transparent Mode to intercept host traffic, including traffic from coding agents. For Kubernetes, use the [Formal Endpoint for Kubernetes](https://docs.formal.ai/docs/guides/client-apps/kubernetes-egress.md) instead.

## Prerequisites

* A Debian or Ubuntu host with `sudo` and systemd
* Outbound HTTPS to `api.joinformal.com`
* For the desktop package: a graphical session and an unlocked system keyring, such as GNOME Keyring or KWallet

Both packages support `amd64` and `arm64`. Print the host architecture with `dpkg --print-architecture`.

## Install on a Desktop

**1. Enable Transparent Mode**

The Endpoint reads `~/.formal/config.toml` on start. Create it before you install the package:

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
mkdir -p ~/.formal
cat > ~/.formal/config.toml <<'EOF'
[transparent_proxy]
enable = true
EOF
```

See [Configuration](https://docs.formal.ai/docs/guides/client-apps/configuration.md) for other `config.toml` keys.

**2. Download and install the package**

In the [Control Plane](https://app.formal.ai), click **Download Formal
Endpoint** at the bottom of the sidebar. Open **Linux** and pick
**Ubuntu/Debian (x86)** or **Ubuntu/Debian (ARM)**.

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
sudo apt-get update
sudo apt-get install --yes ./formal-desktop_*.deb
systemctl --user enable --now formal.service
```

The package lets members of the `sudo` group write the local CA directory, `/var/lib/formal/ca`.

**3. Log in**

Click **Login** in the Formal tray menu, or run:

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
formal auth login
```

Sign in with your Formal SSO in the browser. The Endpoint keeps your login in the system keyring, so it survives restarts.

## Install on a Server

**1. Download the package**

In the [Control Plane](https://app.formal.ai), click **Download
Endpoint** at the bottom of the sidebar. Open **Linux** and pick the
headless package for your architecture:

* **Ubuntu/Debian (x86, headless)** for `amd64`
* **Ubuntu/Debian (ARM, headless)** for `arm64`

Copy the `.deb` file to the host, for example with `scp`.

**2. Install the package**

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
sudo apt-get update
sudo apt-get install --yes ./formal-desktop-headless_*.deb
```

**Verify:**

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
command -v formal
# Expected: /usr/bin/formal
```

**3. Grant access to the local CA directory**

The Endpoint writes its local CA to `/var/lib/formal/ca`. Your user must be able to write that directory:

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
sudo chgrp "$(id -gn)" /var/lib/formal/ca
sudo chmod 0775 /var/lib/formal/ca
```

**4. Enable Transparent Mode**

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
mkdir -p ~/.formal
chmod 0700 ~/.formal
cat > ~/.formal/config.toml <<'EOF'
[transparent_proxy]
enable = true
EOF
```

See [Configuration](https://docs.formal.ai/docs/guides/client-apps/configuration.md) for other `config.toml` keys.

**5. Enable lingering and start the service**

Lingering lets systemd start the user service without an interactive login. This is required on servers and VMs.

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
sudo loginctl enable-linger "$(id -un)"
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
systemctl --user daemon-reload
systemctl --user enable --now formal.service
```

**Verify:**

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
XDG_RUNTIME_DIR="/run/user/$(id -u)" \
  systemctl --user is-active formal.service
# Expected: active
```

**6. Log in**

For a person, run:

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
formal auth login
```

The CLI prints a URL. Open it in any browser and sign in with your Formal SSO. The headless agent keeps the login in memory, so log in again after the service restarts.

For a machine identity, skip the browser login. Use [OIDC](https://docs.formal.ai/docs/guides/client-apps/oidc.md#log-in-with-oidc) to avoid long-lived keys. Or store an API key from [API Keys](https://app.formal.ai/api-keys) in `~/.formal/formal.env`, which the service loads on start:

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
printf 'FORMAL_API_KEY=<YOUR_API_KEY>\n' > ~/.formal/formal.env
chmod 0600 ~/.formal/formal.env
systemctl --user restart formal.service
```

## Verify

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
formal auth whoami
formal transparent-proxy status
```

`formal auth whoami` should show the user you logged in as, or the user that owns the API key. The Transparent Mode status should be enabled.

Write [network rules](https://docs.formal.ai/docs/guides/network-rules.md) to select which flows Transparent Mode intercepts. On Linux, match a hostname or `is_llm_hostname`. Linux has no process signing identity.

> [!TIP]
>
> Read service logs with `journalctl --user -u formal.service`. Set `XDG_RUNTIME_DIR` first when your shell has no session bus.

## Upgrade

Run:

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
formal upgrade
```

`formal upgrade` downloads the latest desktop or headless package, whichever is installed, for the host architecture. It installs the package with `sudo apt-get install` and restarts `formal.service`. Upgrading drops open sessions. Pass `--yes` to skip the confirmation prompt. On the headless package, run `formal auth login` again afterwards unless you use an API key or OIDC.

**Verify:**

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
formal version
# Expected: CLI version, Agent version, and Latest version match
```

## Headless Mode

The Formal Endpoint supports being launched in headless mode. This can be useful in server environments without a GUI or keyring support.

In this guide, "the agent" means the Endpoint's background process that `formal agent` starts. It is not the Control Plane's [Formal Agent](https://docs.formal.ai/docs/guides/getting-started/formal-agent.md) assistant.

To start the agent in headless mode, you can use the following command:

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
formal agent --headless
```

Now in a separate terminal, you can run the Formal CLI as normal to connect to resources:

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
formal auth login
formal ls
formal connect [resource-name]
```

In headless mode, Formal credentials are only stored in the agent's memory. This means that you'll need to reauthenticate when restarting the agent (e.g., when the machine itself reboots).

To skip `formal auth login`, configure [OIDC](https://docs.formal.ai/docs/guides/client-apps/oidc.md#log-in-with-oidc) or start the agent with an [API key](https://docs.formal.ai/docs/guides/client-apps/oidc.md#log-in-with-an-api-key).

On Linux, the Debian package installs a `formal.service` user unit.

### Explicit Proxy mode

The Endpoint is mainly meant to intercept traffic in Transparent Mode. Automatic interception needs the `NET_ADMIN` capability. Some environments, such as AWS Fargate, do not allow it. In those cases, the Endpoint can act as an HTTP and HTTPS proxy instead.

For that to work, enable Transparent Mode in `~/.formal/config.toml`. The proxy listens only while it is enabled:

```toml theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
[transparent_proxy]
enable = true
```

Start the agent with the proxy address:

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
formal agent --headless --explicit-proxy=127.0.0.1:3128
```

This requires you to explicitly point your application at it:

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
export HTTPS_PROXY=http://127.0.0.1:3128 HTTP_PROXY=http://127.0.0.1:3128
```

The address must be a loopback address. The agent applies network rules, policies, and logging to these connections as it does in Transparent Mode. Clients that ignore these variables connect directly and are not inspected.

**Verify:**

```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
formal transparent-proxy status
```

The status shows the address the explicit proxy listens on.

## Troubleshooting

> [accordion] The user service is not running
>
> On a server, confirm lingering is enabled with `loginctl show-user "$(id -un)"`. Set `XDG_RUNTIME_DIR="/run/user/$(id -u)"` and read failures with `journalctl --user -u formal.service`. Then run `systemctl --user enable --now formal.service`.

> [accordion] Login fails with no token store available
>
> **Error:** `No token store available.`
>
> The desktop package stores your login in the system keyring. Install and unlock GNOME Keyring or KWallet, then run `formal auth login` again. On a host without a keyring, use the [server install](#install-on-a-server) instead.

> [accordion] CLI cannot connect to the Formal app
>
> **Error:** `WARNING: CLI cannot connect to the Formal app.`
>
> The CLI talks to the user service over a local socket. Confirm `formal.service` is active, then retry `formal auth whoami`.

> [accordion] The local CA directory is not writable
>
> The Endpoint must write `/var/lib/formal/ca`. On the desktop package, add your user to the `sudo` group, or re-run:
>
> ```bash theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
> sudo chgrp "$(id -gn)" /var/lib/formal/ca
> sudo chmod 0775 /var/lib/formal/ca
> ```
>
> Then restart the service.

> [accordion] Transparent Mode does not intercept traffic
>
> Confirm `~/.formal/config.toml` sets `transparent_proxy.enable = true`. Confirm `formal transparent-proxy status` is enabled. Confirm a [network rule](https://docs.formal.ai/docs/guides/network-rules.md) matches the destination. Without a matching rule, the Endpoint forwards the connection without inspecting it.

## Next Steps

> [card] [Formal Endpoint](https://docs.formal.ai/docs/guides/client-apps/desktop-app.md)
>
> Review authentication and connection options

> [card] [Configuration](https://docs.formal.ai/docs/guides/client-apps/configuration.md)
>
> Set config.toml keys for the Endpoint

> [card] [Network Rules](https://docs.formal.ai/docs/guides/network-rules.md)
>
> Select which traffic Transparent Mode intercepts

> [card] [Cloud Agents](https://docs.formal.ai/docs/guides/example-use-cases/formal-endpoint-cloud-agents.md)
>
> Run the Endpoint inside Cursor and Devin agents

> [card] [Grok Bot](https://docs.formal.ai/docs/guides/example-use-cases/formal-endpoint-grok-bot.md)
>
> Install the Endpoint on Grok Bot computers


## Related topics

- [Quickstarts](https://docs.formal.ai/docs/guides/getting-started/quickstarts.md)
- [MCP](https://docs.formal.ai/docs/guides/core-concepts/resources/mcp.md)
- [Intercept Traffic with Transparent Mode](https://docs.formal.ai/docs/guides/client-apps/transparent-mode.md)
- [Install Formal Endpoint on Grok Bot](https://docs.formal.ai/docs/guides/example-use-cases/formal-endpoint-grok-bot.md)
- [Install Formal Endpoint on Windows](https://docs.formal.ai/docs/guides/client-apps/windows.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.