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
.
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:
- Install distrobox:
sudo pacman -S distrobox podman
. If asked, go withcrun
overrunc
for thepodman
installation. - Set up your distrobox for your target installation. For me that's Debian 11:
distrobox create --image debian:11 --name debian11
- Enter the distrobox:
distrobox enter debian11
- Now install aptly:
sudo apt install aptly
- 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": {}
}
- Set up GPG:
gpg --gen-key
- Set up the database:
aptly db create
- Create the mirror:
aptly mirror create debian11-main http://deb.debian.org/debian bullseye main
- Update your mirror with the remote server:
aptly mirror update debian11-main
- Publish your mirror:
aptly publish repo debian11-main
That should be it.