# Debian mirror (pkg.shecan.ir)

> Mirror of deb.debian.org and security.debian.org for apt (Debian 12 and 13), of archive.debian.org for Debian 11 and older (/debian-archive/, /debian-archive-security/) and of the unofficial ports (/debian-ports/: riscv64, loong64, ...).

- Upstream: deb.debian.org
- Mirror URLs: <https://mirror-debian.pkg.shecan.ir/debian/>, <https://mirror-debian.pkg.shecan.ir/debian-security/>, <https://mirror-debian.pkg.shecan.ir/debian-archive/>, <https://mirror-debian.pkg.shecan.ir/debian-ports/>
- Clients: apt
- Service status: <https://pkg.shecan.ir/status.json> (key `debian`; up/down, refreshed every minute)
- Guide (Persian, HTML): <https://pkg.shecan.ir/mirrors/debian/>
- JSON: <https://pkg.shecan.ir/api/v1/mirrors/debian.json>
- Integrity comparison with the official source (audit.shecan.ir, also run by Shecan, open source; group `debian`, mirror `shecan`): <https://audit.shecan.ir/#debian>

## Limitations

- apt still verifies the official Debian signatures.
- Plain HTTP is enabled so minimal images without ca-certificates can bootstrap; switch to https after installing ca-certificates.

## Setup

Every block below is the exact text of the Persian guide. Unless marked otherwise it is run against the live mirror in a disposable container on every catalog change; "checked by hand" blocks cannot run in a container. Change a machine only with its owner's permission: back up existing configuration first, merge into existing files instead of overwriting them, and keep the "Undo" step at hand.

### apt: persistent (user- or system-wide configuration)

Back up first, Debian 12 and 13 (linux)

```sh
sudo cp /etc/apt/sources.list.d/debian.sources /etc/apt/sources.list.d/debian.sources.bak
```

Run, Debian 12 and 13 (linux)

```sh
sudo sed -i -E 's#http://(deb|security)\.debian\.org/#http://mirror-debian.pkg.shecan.ir/#' /etc/apt/sources.list.d/debian.sources
```

Run, Debian 12 and 13 (linux)

```sh
sudo apt update
```

Undo / restore the default, Debian 12 and 13 (linux)

```sh
sudo mv /etc/apt/sources.list.d/debian.sources.bak /etc/apt/sources.list.d/debian.sources
```

Configuration file, Debian 12 full file (alternative; write trixie instead of bookworm for Debian 13) (linux): `/etc/apt/sources.list.d/debian.sources`

```
Types: deb
URIs: https://mirror-debian.pkg.shecan.ir/debian
Suites: bookworm bookworm-updates
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb
URIs: https://mirror-debian.pkg.shecan.ir/debian-security
Suites: bookworm-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
```

Run, Debian 11 (archive.debian.org) (linux)

```sh
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo "deb http://mirror-debian.pkg.shecan.ir/debian-archive bullseye main contrib non-free
deb http://mirror-debian.pkg.shecan.ir/debian-archive bullseye-updates main contrib non-free
deb http://mirror-debian.pkg.shecan.ir/debian-archive-security bullseye-security main contrib non-free" | sudo tee /etc/apt/sources.list
sudo apt update
```

Configuration file, Debian Ports (linux): `/etc/apt/sources.list` (checked by hand)

```
deb http://mirror-debian.pkg.shecan.ir/debian-ports sid main
deb http://mirror-debian.pkg.shecan.ir/debian-ports unreleased main
```

### apt: project (files inside the project)

Configuration file, Dockerfile based on Debian 12: `Dockerfile`

```dockerfile
FROM mirror-docker.pkg.shecan.ir/debian:12
RUN sed -i -E 's#http://(deb|security)\.debian\.org/#http://mirror-debian.pkg.shecan.ir/#' /etc/apt/sources.list.d/debian.sources \
    && apt-get update && apt-get install -y --no-install-recommends curl \
    && rm -rf /var/lib/apt/lists/*
```
