# Quickstart (self-host)

Install opendesk on your own server with one command, then create the first account and set up email.

Self-hosted opendesk is free forever and runs the same code as the hosted service. One command installs it with Docker, generates every secret and serves it over HTTPS. When it is done, your server runs this:

*Diagram: A self-hosted install on one server and one domain. Browsers reach Caddy over HTTPS on port 443. Caddy sends /socket to the realtime gateway and everything else to opendesk. opendesk, which runs the API, the workers, the web app and an embedded NATS, publishes events over NATS to the realtime gateway and keeps its data in Postgres. Realtime, opendesk and Postgres sit on an internal network; only Caddy is published.*

*Four containers behind one domain. Only Caddy is published; the rest talk on an internal network.*

**1. Get a server**

Any Linux machine on amd64 or arm64 with Docker works; 2 vCPUs and 4 GB of RAM is a good start for a small team. The installer offers to install Docker if it is missing. See [Requirements](/self-hosting/requirements/).

```sh
docker compose version     # Docker with the Compose plugin
```

**2. Point a domain at it**

Create a DNS `A` record (and `AAAA` for IPv6), such as `desk.example.com`, with the server's address, and open ports 80 and 443. Caddy needs both to get and renew the certificate.

```sh
dig +short desk.example.com      # should print the server's address
```

**3. Run the installer**

```sh
curl -fsSL https://opendesk.sh/install.sh | sh
```

It asks for your domain and an email address for the TLS certificate. To answer up front:

```sh
curl -fsSL https://opendesk.sh/install.sh | sh -s -- --domain desk.example.com --email you@example.com
```

To read the script before running it, see [Verify before running](/self-hosting/install-script/#verify-before-running).

**4. Check that it is up**

The installer waits for opendesk to answer, then prints its address. `opendesk-ctl` shows the containers and their health:

```sh
/opt/opendesk/opendesk-ctl status
```

**5. Create the first account**

Open `https://desk.example.com` and sign up. The first account becomes the workspace owner. Then name your workspace and [connect a mailbox](/guides/mailboxes/), as in the [Cloud quickstart](/getting-started/quickstart-cloud/), which shows each screen.

**6. Set up email**

Until you configure it, verification, password reset and invitation emails are printed to the log instead of sent:

```sh
/opt/opendesk/opendesk-ctl logs opendesk
```

Set `MAIL_DRIVER` and your SMTP server in `/opt/opendesk/.env`, then apply it with `opendesk-ctl start`. See [Email setup](/self-hosting/email/).

> **Back up your .env**
>
> The installer writes `/opt/opendesk/.env` with fresh secrets. It holds the only copy of `CREDENTIALS_KEY`, which encrypts mailbox credentials. Losing it makes every stored mailbox credential unreadable. `opendesk-ctl backup` saves it with the database.

> **Close sign-ups**
>
> Once your account exists, set `SIGNUP_ENABLED=false` in `.env` so only people you invite can create an account.

## Next steps

- Read the [install script](/self-hosting/install-script/) reference for every flag, including `--wizard`.
- Configure [Google and Microsoft OAuth](/self-hosting/oauth-apps/) for one-click mailbox connections and sign-in.
- Plan [backups and upgrades](/self-hosting/backups-and-upgrades/).
