# Uninstalling

URL: https://docs.vaultpanel.net/getting-started/uninstalling

> Remove VaultPanel and its agent from a server, keep or delete the panel's data, and decide what happens to the websites it created.

Removing VaultPanel stops the panel and its services. By default the panel's data is kept, and websites, apps and databases it created on the server are left as they are.

> **Warning:**
Take a [panel backup](https://docs.vaultpanel.net/getting-started/backing-up-the-panel) and copy it off the server first if you might want the panel back.

## Before you start

If you installed the free AI model on this server, remove it first under **System > Assistant Settings** with **Remove Ollama and all models**.

## Remove the panel

```bash
sudo docker compose -p vaultpanel --env-file /opt/vaultpanel/.env -f /opt/vaultpanel/docker/compose.prod.yml down
sudo apt remove vaultpanel
sudo systemctl disable --now vaultpanel-agent vaultpanel-agent-helper
sudo rm -f /etc/systemd/system/vaultpanel-agent.service /etc/systemd/system/vaultpanel-agent.service.root \
  /etc/systemd/system/vaultpanel-agent-helper.service \
  /etc/apt/sources.list.d/vaultpanel.list /etc/apt/keyrings/vaultpanel.asc
sudo systemctl daemon-reload
sudo rm -f /usr/local/bin/vaultpanel-agent /usr/local/bin/vaultpanel-agent.previous \
  /etc/cron.d/vaultpanel /usr/local/lib/vaultpanel/acme-dns-hook
```

| Line | What it does |
| --- | --- |
| `docker compose … down` | Stops the panel's own MariaDB and Redis containers. |
| `apt remove vaultpanel` | Stops the panel and worker, and removes their services, the backup timer, the `vaultpanel` command and the login banner. |
| `systemctl disable --now …` and the first `rm -f …` | Stops this server's agent and its root helper, and removes their services and VaultPanel's package repository. `vaultpanel-agent.service.root` is the agent's original root service, kept while the agent runs as its own user. |
| The last `rm -f …` | Removes the agent's program and the copy kept from its last update, the cron jobs the panel set up, and Certbot's hook for wildcard certificates. |

A panel installed from a copy of the repository has no package. Stop and remove `vaultpanel`, `vaultpanel-worker` and `vaultpanel-backup.timer` the same way as the agent.

## Delete the panel's data too

The steps above keep the panel's data. To delete it as well (the database volume, settings and secrets):

1. Add `-v` to the first line: `docker compose … down -v`.
2. Remove VaultPanel's folders, the website, app and database backups, the panel's own backups, and the panel's user:

```bash
sudo rm -rf /opt/vaultpanel /etc/vaultpanel /etc/vaultpanel-agent \
  /var/lib/vaultpanel /var/cache/vaultpanel /var/backups/vaultpanel /var/backups/vaultpanel-panel
sudo userdel vaultpanel
sudo userdel vaultpanel-agent
```

`/etc/vaultpanel-agent` holds the agent's registration, key and settings, and `vaultpanel-agent` is the user the agent runs as. A server that still ran the old Node.js agent also has `/opt/vaultpanel-agent`; remove it too.

## What stays on the server

Websites, apps and databases the panel created are left as they are, and so is the MariaDB for websites and apps. To remove that MariaDB as well, which deletes its databases:

```bash
sudo apt purge mariadb-server mariadb-client
sudo rm -f /etc/apt/sources.list.d/vaultpanel-mariadb.list /etc/apt/keyrings/vaultpanel-mariadb.asc
```

## Disconnect another server

To stop managing a server without uninstalling the panel, remove it from the panel: on its page, open **Settings** and click **Remove server**. Removing a server revokes its agent, which then stops.

To also take the agent off that server, run there:

```bash
sudo systemctl disable --now vaultpanel-agent vaultpanel-agent-helper
sudo rm -f /etc/systemd/system/vaultpanel-agent.service /etc/systemd/system/vaultpanel-agent.service.root \
  /etc/systemd/system/vaultpanel-agent-helper.service
sudo systemctl daemon-reload
sudo rm -f /usr/local/bin/vaultpanel-agent /usr/local/bin/vaultpanel-agent.previous \
  /etc/cron.d/vaultpanel /usr/local/lib/vaultpanel/acme-dns-hook
sudo rm -rf /etc/vaultpanel-agent /var/lib/vaultpanel /var/cache/vaultpanel
sudo userdel vaultpanel-agent
```

This removes the agent's program and services, its registration and settings (`/etc/vaultpanel-agent`), the cron jobs the panel set up, and the agent's state and cache. Websites, apps and databases stay, and so do their backups in `/var/backups/vaultpanel`: delete that folder too if you no longer need them. If the server still ran the old Node.js agent, also remove `/opt/vaultpanel-agent`.
