Providing an APT repo with aptly and Apache
To see an working example of this setup:
Install aptly
apt-get install aptly
Create an extra user
adduser dhl
Full Name []: User for APT repo using aptly
Make sure there is enough disk space for all the files
Eventually put the home of this user on a separate mount
Create a GPG Key
Creating a GPG key which signs the files in the APT repo
so apt clients do not complainUsing ed25519 as SSH Key type here, but other types (RSA), work as well
-
Switch to your new user
-
Create the key
dhl@host: gpg --expert --full-generate-key(9) ECC and ECC (1) Curve 25519 0 = key does not expire Real name: APT REPO Email address: dhl@your-domain.com skip password -
Check the new GPG key
gpg --list-secret-keys --keyid-format=long -
Export the new GPG key
gpg --armor --export dhl@your-domain.com > dhl-repo-keyring.asc gpg --export dhl@your-domain.com > dhl-repo-keyring.gpg
Prepare aptly
Example for Ubuntu 20.04 (Focal)
Remember: Do everything as your new aptly user (here dhl)
-
Create repo
aptly repo create -distribution=focal -component=main focal-main -
Import some example package
Can be a .deb (binary package) or .dsc (source package)
aptly repo add focal-main example_1.14.1_amd64.deb aptly repo add focal-main example_1.14.1.dsc -
Publish your packages
Importing a package does not make it available for apt yet.
It is available only after the repo was published.
The following step is only done once to initialize the repo.For
originandlabeluse some unique string which identifiers your repoaptly publish repo \ -architectures=amd64,i386,source \ -origin=some-string-which-identifies-your-repo \ -label=some-string-which-identifies-your-repo focal-mainIf you import more packages, you do:
aptly publish update focal