This article is to show mainly how to work with aptly by mirroring an official Ubuntu mirror. If you want to know how to install and a brief description of what is aptly you may want to read our previous article – Install aptly under Ubuntu 18 LTS with Nginx serving the packages and the first steps
What we are going to do – this is what you need to have a mirror of an external application repository:
- Install aptly in Ubuntu 18 LTS
- Create a mirror in aptly
- Create a snapshot of the mirror created before
- Publish the snapshot to be used in other servers.
and at the last step there is an example how to use the mirror in your local machines.
STEP 1) Install aptly in Ubuntu 18.04 LTS.
As mentioned already you may follow our article on the subject – Install aptly under Ubuntu 18 LTS with Nginx serving the packages and the first steps. The following steps are based on this installation!
The aptly home directory is in “/srv/aptly”. We use the “aptly” user and change to it to manipulate the aptly installation.
STEP 2) Create a mirror in aptly.
Prepare the keys (aptly needs to have the Ubuntu keys in its trustedkeys keyring):
aptly@srv:~$ gpg --no-default-keyring --keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg --export | gpg --no-default-keyring --keyring trustedkeys.gpg --import gpg: key 3B4FE6ACC0B21F32: 3 signatures not checked due to missing keys gpg: key 3B4FE6ACC0B21F32: public key "Ubuntu Archive Automatic Signing Key (2012) <firstname.lastname@example.org>" imported gpg: key D94AA3F0EFE21092: 3 signatures not checked due to missing keys gpg: key D94AA3F0EFE21092: public key "Ubuntu CD Image Automatic Signing Key (2012) <email@example.com>" imported gpg: key 871920D1991BC93C: 1 signature not checked due to a missing key gpg: key 871920D1991BC93C: public key "Ubuntu Archive Automatic Signing Key (2018) <firstname.lastname@example.org>" imported gpg: Total number processed: 3 gpg: imported: 3 gpg: public key of ultimately trusted key 212A3D20E4D3351D not found gpg: marginals needed: 3 completes needed: 1 trust model: pgp gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
Probably you would like to have “main” and “universe” for the three bionic, bionic updates and bionic security.
First, main and universe for bionic repository. main is ~16G and universe is ~136, these numbers will vary in future when more packages are added.
Two commands are need for the aptly mirror:
- create – create the mirror.
- update – download the repository contents locally.