# Installation

You can install Cedana on a SLURM node in 3 ways:

1. \[Option 1] [Using web installer (sane defaults)](#using-web-installer)
2. \[Option 2] [Using Cedana](#using-cedana)
3. \[Option 3] [Building from source](#building-from-source)

{% hint style="warning" %}
These steps must be performed on **all SLURM controller and compute nodes** in your cluster!
{% endhint %}

{% hint style="success" %}
To use Cedana in Kubernetes, you need to be registered with us! Reach out to [founders@cedana.ai](mailto:foundes@cedana.ai) to get set up with an organization.
{% endhint %}

{% hint style="info" %}
You can also deploy fully self-hosted, with zero limitations on where you can store your checkpoints! Check out [configuration](https://docs.cedana.ai/daemon/get-started/configuration). If you have any questions, please reach out to us at <founders@cedana.ai>.
{% endhint %}

## Using web installer

The web installer will automatically install the latest stable version of Cedana and all plugins required for SLURM support with sane defaults.

### Install

{% hint style="success" %}
Check [Authentication](https://docs.cedana.ai/get-started/authentication) for more details on how to get an authentication token.
{% endhint %}

```sh
export CEDANA_URL=https://myorg.cedana.ai/v1
export CEDANA_AUTH_TOKEN=your_auth_token

curl -fsSL ${CEDANA_URL}/install/slurm -H "Authorization: Bearer ${CEDANA_AUTH_TOKEN}" | sudo -E bash
```

* Use `?version=x.y.z` query parameter to install a specific version.
* Use `?build=alpha&version=feat/my-branch` to install an alpha build from a branch.

### Configure

For configuration, follow instructions on [Cedana Daemon configuration](https://docs.cedana.ai/daemon/get-started/configuration). Use the environment variable corresponding to a configuration item to override it when calling the installer script.

```sh
export CEDANA_CHECKPOINT_DIR=s3://my-checkpoints-bucket
export CEDANA_CHECKPOINT_STREAMS=4
export CEDANA_CHECKPOINT_COMPRESSION=gzip

curl -fsSL ${CEDANA_URL}/install/slurm -H "Authorization: Bearer ${CEDANA_AUTH_TOKEN}" | sudo -E bash
```

## Using Cedana

You can also install SLURM support directly from Cedana.

### Install

First, install Cedana by following instructions on [Cedana Daemon installation](https://docs.cedana.ai/daemon/get-started/installation).

Then, install the `slurm` plugin:

```sh
sudo cedana plugin install slurm
sudo cedana slurm setup
```

### Configure

For configuration, follow instructions on [Cedana Daemon configuration](https://docs.cedana.ai/daemon/get-started/configuration).

## Building from source

Check `make help` for available build targets.

Build all binaries:

```sh
make all
```

By default, the binaries will be built using the `cedana/cedana-slurm:build` docker image.

These binaries are useless on their own. You need to install Cedana to use them.

First, install Cedana by following instructions on [Cedana Daemon installation](https://docs.cedana.ai/daemon/get-started/installation). Then, install the `slurm` plugin and set up SLURM support:

```sh
sudo cedana plugin install slurm
cd build && sudo cedana slurm setup
```

{% hint style="info" %}
You need to be in the `build` directory for the `cedana slurm setup` command to work, as it needs to find the binaries you just built.
{% endhint %}

You're all set up! Let's checkpoint some workloads. Continue to [Checkpoint/restore](https://docs.cedana.ai/cedana-slurm/cr) to get started.

## Uninstall

To remove Cedana SLURM completely, run:

```sh
sudo cedana slurm destroy
```
