Aptly configuration

The aptly configuration:

{
  "rootDir": "/var/aptly",
  "downloadConcurrency": 4,
  "downloadSpeedLimit": 0,
  "architectures": [],
  "dependencyFollowSuggests": false,
  "dependencyFollowRecommends": false,
  "dependencyFollowAllVariants": false,
  "dependencyFollowSource": false,
  "dependencyVerboseResolve": false,
  "gpgDisableSign": false,
  "gpgDisableVerify": false,
  "gpgProvider": "gpg",
  "downloadSourcePackages": false,
  "skipLegacyPool": true,
  "ppaDistributorID": "ubuntu",
  "ppaCodename": "",
  "enableMetricsEndpoint": false
}

defines some standard parameters and the root directory to /var/aptly.

Aptly needs a GnuPG key to sign the repository, which can be generated with:

gpg1 --gen-key
The aptly version shipped with Ubuntu 20.04 required GnuPG 1, but later versions can use GnuPG 2.

Then the command

aptly repo create -distribution={{ repository_name }} -component=main {{ repository_name }}

creates the repository and to publish it to `/var/aptly/public':

aptly -architectures='amd64,i386' publish repo {{ repository_name }} :ubuntu

In order to serve the aptly publish aptly repository over HTTP, the following code can be added in the default nginx website /etc/nginx/sites-available/default:

location /ubuntu {
    autoindex on;
    alias /var/aptly/public/ubuntu;
}
Next