# Add a Linux server

A Linux server with no screen of its own becomes a Compute with the `uremot` binary: Linux on x86_64 or aarch64, with
[Docker Engine](https://docs.docker.com/engine/install/) installed. For a computer you sit at, use the desktop app
instead: [Install and add a Compute](/docs/add-a-compute).

In the Console, open **Computes**, press **Add a Compute** and choose **Headless Linux server**. Under **Install as**,
choose **System service** (needs `sudo`; recommended) or **For the current user**. The page prints the install and
enroll commands for your choice, with your workspace filled in.

## 1. Install

As a system service, installed with a systemd unit:

```sh output="install-daemon"
curl -fsSL https://get.uremot.com | sudo sh -s -- --daemon
```

On a first install, if no container engine answers, the installer stops and says how to install one. Run it again
once Docker Engine is in, or add `--no-containers` to install without containers.

For the current user, without `sudo`:

```sh
curl -fsSL https://get.uremot.com | sh
```

The binary installs to `~/.uremot/bin`, and the machine is a Compute only while `uremot compute run` runs (step 3).

## 2. Enroll

**For a machine that's yours,** sign in from the terminal and approve the code it prints in your browser. Run the
command the Console's page prints: it names your workspace.

```sh
sudo uremot compute enroll --sign-in --workspace <workspace-id>
```

Installed for the current user? Drop `sudo`. Without `--workspace`, the command works when your account sees one
workspace; when it sees more, it stops and lists them.

**To share it with the workspace,** choose **Shared with** your workspace on the Console's page instead. Members and
their agents can then launch on it. Give it a **Compute name** and a **Grant expiry**, press
**Create enrollment grant**, and run the command the page prints. It reads the grant from stdin, so the grant never
appears in a process list or your shell history. From a script, pipe it in:

```sh
printf '%s' "$GRANT" | sudo uremot compute enroll --grant-stdin
```

Installed for the current user? Drop `sudo` here too.

## 3. Check it

A system-service install starts the service when you enroll. For the current user, run `uremot compute run` and
keep it running. The Console's page ticks off **Joined**, **Online** and **Can run apps** as the machine connects. On
the machine:

```sh output="compute-status"
uremot compute status
```

It shows the machine's identity, whether a container engine answers, and whether the service runs.

<a id="without-systemd"></a>

## Without systemd

Install as root without `--daemon`, which puts the binary in `/usr/local/bin`:

```sh
curl -fsSL https://get.uremot.com | sudo sh
```

Then enroll as root, as above, and keep `uremot compute run` running under your init system. For OpenRC,
`/etc/init.d/uremot-compute`:

```sh title="/etc/init.d/uremot-compute"
#!/sbin/openrc-run
command=/usr/local/bin/uremot
command_args="compute run"
command_background=true
pidfile=/run/uremot-compute.pid
export HOME=/root
depend() { need net; after docker; }
```

Then `rc-update add uremot-compute default` and `rc-service uremot-compute start`. With runit, the same
`exec /usr/local/bin/uremot compute run` goes in `/etc/sv/uremot-compute/run`.

## Everyday commands

| Command | What it does |
| --- | --- |
| `uremot compute status` | The machine's identity, whether a container engine answers, and whether the service runs |
| `uremot update` | Installs the latest release after checking its signature; restart the service to run it |
| `uremot uninstall` | Removes the binary and the service, keeping the identity unless `--purge` |

Every command and flag: [The uremot CLI](/docs/cli).

If a machine's identity breaks, stop the service (`sudo systemctl stop uremot-compute`), then run
`sudo uremot compute reset` and `sudo uremot compute enroll --sign-in`. To keep its Compute record instead, create a
recovery grant on its page in the Console and run `sudo uremot compute recover --grant-stdin`.

Next: [Connect a harness](/docs/connect-a-harness).
