---
title: "Remove a server"
description: "Safely remove servers from Alpacon. Uninstall the Alpamon agent with alpamon unregister or manually, then delete the server from your workspace if needed."
---

> Full documentation index: https://docs.alpacax.com/llms.txt

# Remove a server

Remove servers that you no longer want to manage in Alpacon.

This page covers removing individual servers while keeping the workspace. Deleting an entire workspace removes Alpacon from every connected server it can reach, with exceptions for a server that's offline or on an unsupported host—see [What happens to your servers](/use/workspace/delete/#what-happens-to-your-servers).

## Removal process

There are two ways to remove a server:

- **`alpamon unregister`** (v2.3.0+) removes the agent from the host and makes a best-effort attempt to delete the workspace record, in one step.
- **Manual**: (1) uninstall the Alpamon agent from the server, then (2) delete the server from the Alpacon workspace.

Both are covered below.

## 1. Uninstall Alpamon agent

First, remove the agent from your server.

The quickest path is `alpamon unregister`, which stops and removes the service, deletes the local configuration, and makes a best-effort attempt to delete the workspace server record—all in one step. Run it on the server itself (not over Websh), on alpamon v2.3.0 or later:

```bash

# Linux / macOS
sudo alpamon unregister --yes
```

```powershell

# Windows (elevated PowerShell, on the server)
& "$env:ProgramFiles\alpamon\alpamon.exe" unregister --yes
```

The command leaves the agent binary and data and log directories in place. Remove those with the steps below if you also need them gone.

To recover a host whose registration is stuck, use `alpamon register --force`. See [Re-registration and recovery](/use/servers/troubleshooting/#re-registration-and-recovery).

The per-OS steps below remove the agent and its files manually, and also apply to agents older than v2.3.0.

### Debian-based systems (Ubuntu, Debian)

**Basic removal:**
```bash
sudo apt remove alpamon -y && sudo rm -rf /etc/alpamon/alpamon.conf
```

**Complete removal (including all files):**
```bash
sudo apt remove alpamon --purge -y
```

Complete removal also deletes:
- `/etc/alpamon/alpamon.conf`
- `/usr/lib/tmpfiles.d/alpamon.conf`
- `/lib/systemd/system/alpamon.service`
- `/lib/systemd/system/alpamon-restart.service`
- `/lib/systemd/system/alpamon-restart.timer`
- `/var/log/alpamon/alpamon.log`
- `/var/lib/alpamon/alpamon.db`

### Red Hat-based systems (RHEL, Rocky Linux)

**Basic removal:**
```bash
sudo yum remove alpamon
```

**Complete removal (including all files):**
```bash
sudo yum remove alpamon && \
sudo rm -f /etc/alpamon/alpamon.conf \
&& sudo rm -f /usr/lib/tmpfiles.d/alpamon.conf \
&& sudo rm -f /lib/systemd/system/alpamon.service \
&& sudo rm -f /lib/systemd/system/alpamon-restart.service \
&& sudo rm -f /lib/systemd/system/alpamon-restart.timer \
&& sudo rm -f /var/log/alpamon/alpamon.log \
&& sudo rm -f /var/lib/alpamon/alpamon.db
```

### SUSE-based systems (openSUSE, SLES)

**Basic removal:**
```bash
sudo zypper --non-interactive remove alpamon
```

**Complete removal (including configuration, data and logs):**
```bash
sudo zypper --non-interactive remove alpamon
rpm -q alpamon >/dev/null || sudo rm -rf /etc/alpamon /var/lib/alpamon /var/log/alpamon  # only once the package is gone
```

### macOS

Unload the launchd service and remove its plist, then uninstall the Homebrew package to remove the binary. The configuration file is `/etc/alpamon/alpamon.conf`; remove the configuration, data, and logs if you no longer need them:

```bash
sudo launchctl unload /Library/LaunchDaemons/com.alpacax.alpamon.plist
sudo rm -f /Library/LaunchDaemons/com.alpacax.alpamon.plist
brew uninstall alpamon
sudo rm -rf /etc/alpamon /var/lib/alpamon /var/log/alpamon
```

### Windows

From an elevated PowerShell. Stop and delete the service before removing the folder, or the removal fails with a sharing violation:

```powershell
sc.exe stop alpamon
sc.exe delete alpamon
Remove-Item -Recurse -Force "$env:ProgramFiles\alpamon"
Remove-Item -Recurse -Force "$env:ProgramData\alpamon"
```

Verify that the Windows service and files are gone:

```powershell
sc.exe query alpamon
Test-Path "C:\Program Files\alpamon"
Test-Path "$env:ProgramData\alpamon"
```

`sc.exe query` reports 1060 when the service is gone, and both paths return `False`.

See [Windows servers](/reference/platforms/windows/) for the full removal and recovery details.

## 2. Delete from workspace

If you removed the agent with the manual per-OS steps above (not `alpamon unregister`), the workspace still has the server record—delete it here. `alpamon unregister` attempts to delete the record automatically, but if it can't reach the workspace (network or token issue) the server may still appear in the list; delete it here in that case.

**Requirements:**
- Server status must be **Disconnected**
- Permission: owner or manager of an assigned group, a [maintainer of the server](/use/workspace/settings/roles/#permission-inheritance), or a user with the Staff or Superuser role

**Deletion steps:**

1. Go to **Servers** page
2. Select server(s) to delete (checkbox)
3. Click **Delete (bin)** icon at top
4. Click **Unregister** in confirmation modal
5. Server is removed from list

## Bulk deletion

Delete multiple servers simultaneously.

1. Select multiple servers
2. Click bin icon
3. Confirm
4. All selected servers deleted

## Important notes

**What remains and what disappears:**

| Data | After the server is removed |
| --- | --- |
| Server settings | The server leaves the managed list. Its group and access-rule assignments are removed; configure a new registration again. |
| Monitoring history | The removed server has no monitoring page, so its earlier charts are no longer available there. Removal does not itself erase every stored metric immediately. |
| Command execution history | Earlier commands, their details, and output remain available in the [Commands audit](/use/audit/events/commands/) for authorized viewers within the applicable audit viewing window. |
| Access logs | Earlier Websh and WebFTP activity remains in the audit history within the applicable viewing window. |
| Comments | Server notes are deleted with the server. Save anything you need before removal. |

**Re-registration does not restore the removed server:** Registering the host again creates a new managed server. Its former settings, monitoring page, and comments do not return. The retained audit records remain separate from the new server registration.

**Remove agent first:**
- If you only delete from Alpacon without removing agent
- Server will continue attempting connections
- May cause unnecessary resource usage

## Re-registration

To re-register a removed server:

1. Follow [Register a server](/use/servers/register/) process again
2. New installation script will be generated
3. Configure the new server's settings again. Earlier audit history is not attached to the new registration

## Troubleshooting

**Server not changing to Disconnected:**
1. Verify agent is completely removed from server:
```bash
systemctl status alpamon
```
2. If agent still running, manually stop:
```bash
sudo systemctl stop alpamon
sudo systemctl disable alpamon
```
On Windows, check and stop the service with PowerShell instead:
```powershell
sc.exe query alpamon
Stop-Service alpamon
```

**Delete button disabled:**
- Check server status (cannot delete Connected servers)
- Verify you can manage this server (its maintainer, an owner or manager of an assigned group, or Staff/Superuser)

## Related docs

- [Register a server](/use/servers/register/)
- [Manage servers](/use/servers/manage/)

Source: https://docs.alpacax.com/use/servers/remove/
