# Install via APT

The easiest way to install socktop on Debian and Ubuntu systems is through the official APT repository.

## Supported Systems

The APT repository supports:

- **Debian** 10+ (Buster and newer)
- **Ubuntu** 20.04+ (Focal and newer)
- **Raspberry Pi OS** (Debian-based)
- **Other Debian derivatives**

### Supported Architectures

- **amd64** (x86_64)
- **arm64** (aarch64)
- **armhf** (ARMv7)
- **riscv64** (experimental)

## Installation

### Step 1: Add GPG Signing Key

First, add the repository's GPG signing key to verify package authenticity:

```bash
curl -fsSL https://jasonwitty.github.io/socktop/KEY.gpg | \
    sudo gpg --dearmor -o /usr/share/keyrings/socktop-archive-keyring.gpg
```

This ensures that packages are cryptographically verified before installation.

### Step 2: Add APT Repository

Add the socktop repository to your system's sources list:

```bash
echo "deb [signed-by=/usr/share/keyrings/socktop-archive-keyring.gpg] https://jasonwitty.github.io/socktop stable main" | \
    sudo tee /etc/apt/sources.list.d/socktop.list
```

### Step 3: Update Package Lists

Refresh your package cache to include the new repository:

```bash
sudo apt update
```

### Step 4: Install Packages

Install socktop and the agent:

```bash
# Install both client and agent
sudo apt install socktop socktop-agent

# Or install individually
sudo apt install socktop        # TUI client only
sudo apt install socktop-agent  # Agent only
```

## Automatic Service Setup

The APT package automatically configures the agent as a systemd service, but it's **not enabled by default**.

### Enable and Start the Agent

```bash
# Enable the service to start at boot
sudo systemctl enable socktop-agent

# Start the service now
sudo systemctl start socktop-agent

# Or do both in one command
sudo systemctl enable --now socktop-agent
```

### Check Service Status

```bash
# View service status
sudo systemctl status socktop-agent

# View service logs
sudo journalctl -u socktop-agent -f

# View recent logs
sudo journalctl -u socktop-agent -n 50
```

### Control the Service

```bash
# Stop the service
sudo systemctl stop socktop-agent

# Restart the service
sudo systemctl restart socktop-agent

# Disable auto-start
sudo systemctl disable socktop-agent
```
