# Ubuntu mirror (pkg.shecan.ir)

> Mirror of archive.ubuntu.com (amd64, i386) and ports.ubuntu.com (arm64 and other architectures) for apt, and of old-releases.ubuntu.com for end-of-life releases (/ubuntu-old-releases/).

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

## Limitations

- Security updates (-security) are served from the same /ubuntu/ path.
- Plain HTTP is enabled for bootstrapping; apt verifies the official Ubuntu signatures.

## 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, Ubuntu 24.04 and newer (linux)

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

Run, Ubuntu 24.04 and newer (linux)

```sh
sudo sed -i -E 's#https?://([a-z]{2}\.)?(archive|security)\.ubuntu\.com/ubuntu#http://mirror-ubuntu.pkg.shecan.ir/ubuntu#; s#https?://ports\.ubuntu\.com/ubuntu-ports#http://mirror-ubuntu.pkg.shecan.ir/ubuntu-ports#' /etc/apt/sources.list.d/ubuntu.sources
```

Run, Ubuntu 24.04 and newer (linux)

```sh
sudo apt update
```

Run, Ubuntu 22.04 (linux)

```sh
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo sed -i -E 's#https?://([a-z]{2}\.)?(archive|security)\.ubuntu\.com/ubuntu#http://mirror-ubuntu.pkg.shecan.ir/ubuntu#; s#https?://ports\.ubuntu\.com/ubuntu-ports#http://mirror-ubuntu.pkg.shecan.ir/ubuntu-ports#' /etc/apt/sources.list
sudo apt update
```

Verify, Ubuntu Ports (arm64, ppc64el, s390x, riscv64) (linux)

```sh
curl -fsSI https://mirror-ubuntu.pkg.shecan.ir/ubuntu-ports/dists/noble/InRelease
```

Run, End-of-life Ubuntu releases (old-releases.ubuntu.com) (linux)

```sh
for f in /etc/apt/sources.list /etc/apt/sources.list.d/ubuntu.sources; do
  if [ -f "$f" ]; then
    sudo cp "$f" "$f.bak"
    sudo sed -i -E 's#https?://([a-z]{2}\.)?(archive|security|old-releases)\.ubuntu\.com/ubuntu/?#http://mirror-ubuntu.pkg.shecan.ir/ubuntu-old-releases/#' "$f"
  fi
done
sudo apt update
```

Undo / restore the default, Ubuntu 24.04 and newer (linux)

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