Skip to content

Instantly share code, notes, and snippets.

@LiamPerson
Created April 7, 2025 13:30
Show Gist options
  • Save LiamPerson/045e20a94d7af79ef9986722f05d47e2 to your computer and use it in GitHub Desktop.
Save LiamPerson/045e20a94d7af79ef9986722f05d47e2 to your computer and use it in GitHub Desktop.
How I got a local Debian mirror running on Arch Linux

How I got a local Debian mirror running on Arch Linux

I want to have a local Debian mirror so my systems can run entirely off of my local network instead of needing a constant internet connection.

To get this working, I found two main packages that should support this apt-mirror and aptly.

I found apt-mirror had poor configuration and I was having extreme difficulty getting the script to run from source, so instead I opted for aptly.

How to get Aptly running on Arch Linux:

The trick is you don't. I found endless issues trying to get the gpg keys working. Just get it running on a Debian distrobox like so:

  1. Install distrobox: sudo pacman -S distrobox podman. If asked, go with crun over runc for the podman installation.
  2. Set up your distrobox for your target installation. For me that's Debian 11: distrobox create --image debian:11 --name debian11
  3. Enter the distrobox: distrobox enter debian11
  4. Now install aptly: sudo apt install aptly
  5. Now make the config file for it: nano ~/.aptly.conf with the contents:
{
  "rootDir": "/the/location/you/want-to-install-to/aptly-data/",
  "downloadConcurrency": 10,
  "downloadSpeedLimit": 0,
  "architectures": ["amd64"],
  "dependencyFollowSuggests": false,
  "dependencyFollowRecommends": false,
  "dependencyFollowAllVariants": false,
  "dependencyFollowSource": false,
  "dependencyVerboseResolve": false,
  "gpgDisableSign": false,
  "gpgDisableVerify": false,
  "gpgProvider": "gpg",
  "downloadSourcePackages": false,
  "skipLegacyPool": true,
  "ppaDistributorID": "ubuntu",
  "ppaCodename": "",
  "skipContentsPublishing": false,
  "FileSystemPublishEndpoints": {},
  "S3PublishEndpoints": {},
  "SwiftPublishEndpoints": {}
}
  1. Set up GPG: gpg --gen-key
  2. Set up the database: aptly db create
  3. Create the mirror: aptly mirror create debian11-main http://deb.debian.org/debian bullseye main
  4. Update your mirror with the remote server: aptly mirror update debian11-main
  5. Publish your mirror: aptly publish repo debian11-main

That should be it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment