Mirror the official Ubuntu repositories using aptly

Author:

List and show all mirrors

Here is the listing and show command of each mirror:

aptly@srv:~$ aptly mirror list
List of mirrors:
 * [bionic-main]: http://nl.archive.ubuntu.com/ubuntu/ bionic [src] [udeb]
 * [bionic-security-main]: http://nl.archive.ubuntu.com/ubuntu/ bionic-security [src] [udeb]
 * [bionic-security-universe]: http://nl.archive.ubuntu.com/ubuntu/ bionic-security [src] [udeb]
 * [bionic-universe]: http://nl.archive.ubuntu.com/ubuntu/ bionic [src] [udeb]
 * [bionic-updates-main]: http://nl.archive.ubuntu.com/ubuntu/ bionic-updates [src] [udeb]
 * [bionic-updates-universe]: http://nl.archive.ubuntu.com/ubuntu/ bionic-updates [src] [udeb]

To get more information about mirror, run `aptly mirror show <name>`.
aptly@srv:~$ aptly mirror show bionic-main
Name: bionic-main
Archive Root URL: http://nl.archive.ubuntu.com/ubuntu/
Distribution: bionic
Components: main
Architectures: i386, amd64
Download Sources: yes
Download .udebs: yes
Last update: 2020-01-06 13:22:17 UTC
Number of packages: 12925

Information from release file:
Acquire-By-Hash: yes
Architectures: amd64 arm64 armhf i386 ppc64el s390x
Codename: bionic
Components: main restricted universe multiverse
Date: Thu, 26 Apr 2018 23:37:48 UTC
Description:  Ubuntu Bionic 18.04

Label: Ubuntu
Origin: Ubuntu
Suite: bionic
Version: 18.04
aptly@srv:~$ aptly mirror show bionic-universe
Name: bionic-universe
Archive Root URL: http://nl.archive.ubuntu.com/ubuntu/
Distribution: bionic
Components: universe
Architectures: i386, amd64
Download Sources: yes
Download .udebs: yes
Last update: 2020-01-06 23:02:45 UTC
Number of packages: 105573

Information from release file:
Acquire-By-Hash: yes
Architectures: amd64 arm64 armhf i386 ppc64el s390x
Codename: bionic
Components: main restricted universe multiverse
Date: Thu, 26 Apr 2018 23:37:48 UTC
Description:  Ubuntu Bionic 18.04

Label: Ubuntu
Origin: Ubuntu
Suite: bionic
Version: 18.04
aptly@srv:~$ aptly mirror show bionic-updates-main
Name: bionic-updates-main
Archive Root URL: http://nl.archive.ubuntu.com/ubuntu/
Distribution: bionic-updates
Components: main
Architectures: i386, amd64
Download Sources: yes
Download .udebs: yes
Last update: 2020-01-07 09:28:39 UTC
Number of packages: 15316

Information from release file:
Acquire-By-Hash: yes
Architectures: amd64 arm64 armhf i386 ppc64el s390x
Codename: bionic
Components: main restricted universe multiverse
Date: Tue, 07 Jan 2020  3:11:20 UTC
Description:  Ubuntu Bionic Updates

Label: Ubuntu
Origin: Ubuntu
Suite: bionic-updates
Version: 18.04
aptly@srv:~$ aptly mirror show bionic-updates-universe
Name: bionic-updates-universe
Archive Root URL: http://nl.archive.ubuntu.com/ubuntu/
Distribution: bionic-updates
Components: universe
Architectures: i386, amd64
Download Sources: yes
Download .udebs: yes
Last update: 2020-01-07 11:05:19 UTC
Number of packages: 11280

Information from release file:
Acquire-By-Hash: yes
Architectures: amd64 arm64 armhf i386 ppc64el s390x
Codename: bionic
Components: main restricted universe multiverse
Date: Tue, 07 Jan 2020  7:27:17 UTC
Description:  Ubuntu Bionic Updates

Label: Ubuntu
Origin: Ubuntu
Suite: bionic-updates
Version: 18.04
aptly@srv:~$ aptly mirror show bionic-security-main
Name: bionic-security-main
Archive Root URL: http://nl.archive.ubuntu.com/ubuntu/
Distribution: bionic-security
Components: main
Architectures: i386, amd64
Download Sources: yes
Download .udebs: yes
Last update: 2020-01-07 11:18:17 UTC
Number of packages: 12002

Information from release file:
Acquire-By-Hash: yes
Architectures: amd64 arm64 armhf i386 ppc64el s390x
Codename: bionic
Components: main restricted universe multiverse
Date: Tue, 07 Jan 2020  7:05:26 UTC
Description:  Ubuntu Bionic Security

Label: Ubuntu
Origin: Ubuntu
Suite: bionic-security
Version: 18.04
aptly@srv:~$ aptly mirror show bionic-security-universe
Name: bionic-security-universe
Archive Root URL: http://nl.archive.ubuntu.com/ubuntu/
Distribution: bionic-security
Components: universe
Architectures: i386, amd64
Download Sources: yes
Download .udebs: yes
Last update: 2020-01-08 08:42:13 UTC
Number of packages: 6977

Information from release file:
Acquire-By-Hash: yes
Architectures: amd64 arm64 armhf i386 ppc64el s390x
Codename: bionic
Components: main restricted universe multiverse
Date: Wed, 08 Jan 2020  3:11:52 UTC
Description:  Ubuntu Bionic Security

Label: Ubuntu
Origin: Ubuntu
Suite: bionic-security
Version: 18.04

List and show all snapshots

aptly@srv:~$ aptly snapshot list
List of snapshots:
 * [bionic-main]: Snapshot from mirror [bionic-main]: http://nl.archive.ubuntu.com/ubuntu/ bionic [src] [udeb]
 * [bionic-security-main]: Snapshot from mirror [bionic-security-main]: http://nl.archive.ubuntu.com/ubuntu/ bionic-security [src] [udeb]
 * [bionic-security-universe]: Snapshot from mirror [bionic-security-universe]: http://nl.archive.ubuntu.com/ubuntu/ bionic-security [src] [udeb]
 * [bionic-universe]: Snapshot from mirror [bionic-universe]: http://nl.archive.ubuntu.com/ubuntu/ bionic [src] [udeb]
 * [bionic-updates-main]: Snapshot from mirror [bionic-updates-main]: http://nl.archive.ubuntu.com/ubuntu/ bionic-updates [src] [udeb]
 * [bionic-updates-universe]: Snapshot from mirror [bionic-updates-universe]: http://nl.archive.ubuntu.com/ubuntu/ bionic-updates [src] [udeb]

To get more information about snapshot, run `aptly snapshot show <name>`.
aptly@srv:~$ aptly snapshot show bionic-main
Name: bionic-main
Created At: 2020-01-08 10:44:21 UTC
Description: Snapshot from mirror [bionic-main]: http://nl.archive.ubuntu.com/ubuntu/ bionic [src] [udeb]
Number of packages: 12925
Sources:
  bionic-main [repo]
aptly@srv:~$ aptly snapshot show bionic-universe
Name: bionic-universe
Created At: 2020-01-08 10:44:37 UTC
Description: Snapshot from mirror [bionic-universe]: http://nl.archive.ubuntu.com/ubuntu/ bionic [src] [udeb]
Number of packages: 105573
Sources:
  bionic-universe [repo]
aptly@srv:~$ aptly snapshot show bionic-updates-main
Name: bionic-updates-main
Created At: 2020-01-08 10:44:47 UTC
Description: Snapshot from mirror [bionic-updates-main]: http://nl.archive.ubuntu.com/ubuntu/ bionic-updates [src] [udeb]
Number of packages: 15316
Sources:
  bionic-updates-main [repo]
aptly@srv:~$ aptly snapshot show bionic-updates-universe
Name: bionic-updates-universe
Created At: 2020-01-08 10:44:56 UTC
Description: Snapshot from mirror [bionic-updates-universe]: http://nl.archive.ubuntu.com/ubuntu/ bionic-updates [src] [udeb]
Number of packages: 11280
Sources:
  bionic-updates-universe [repo]
aptly@srv:~$ aptly snapshot show bionic-security-main
Name: bionic-security-main
Created At: 2020-01-08 10:45:14 UTC
Description: Snapshot from mirror [bionic-security-main]: http://nl.archive.ubuntu.com/ubuntu/ bionic-security [src] [udeb]
Number of packages: 12002
Sources:
  bionic-security-main [repo]
aptly@srv:~$ aptly snapshot show bionic-security-universe
Name: bionic-security-universe
Created At: 2020-01-08 10:45:22 UTC
Description: Snapshot from mirror [bionic-security-universe]: http://nl.archive.ubuntu.com/ubuntu/ bionic-security [src] [udeb]
Number of packages: 6977
Sources:
  bionic-security-universe [repo]

List and show all published repositories.

These are the repositories you could use in other machines.

aptly@srv:~$ aptly publish list
Published repositories:
  * ubuntu/bionic (origin: Ubuntu) [amd64, i386, source] publishes {main: [bionic-main]: Snapshot from mirror [bionic-main]: http://nl.archive.ubuntu.com/ubuntu/ bionic [src] [udeb]}, {universe: [bionic-universe]: Snapshot from mirror [bionic-universe]: http://nl.archive.ubuntu.com/ubuntu/ bionic [src] [udeb]}
  * ubuntu/bionic-security (origin: Ubuntu) [amd64, i386, source] publishes {main: [bionic-security-main]: Snapshot from mirror [bionic-security-main]: http://nl.archive.ubuntu.com/ubuntu/ bionic-security [src] [udeb]}, {universe: [bionic-security-universe]: Snapshot from mirror [bionic-security-universe]: http://nl.archive.ubuntu.com/ubuntu/ bionic-security [src] [udeb]}
  * ubuntu/bionic-updates (origin: Ubuntu) [amd64, i386, source] publishes {main: [bionic-updates-main]: Snapshot from mirror [bionic-updates-main]: http://nl.archive.ubuntu.com/ubuntu/ bionic-updates [src] [udeb]}, {universe: [bionic-updates-universe]: Snapshot from mirror [bionic-updates-universe]: http://nl.archive.ubuntu.com/ubuntu/ bionic-updates [src] [udeb]}
aptly@srv:~$ aptly publish show bionic ubuntu
Prefix: ubuntu
Distribution: bionic
Architectures: amd64 i386 source
Sources:
  main: bionic-main [snapshot]
  universe: bionic-universe [snapshot]
aptly@srv:~$ aptly publish show bionic-updates ubuntu
Prefix: ubuntu
Distribution: bionic-updates
Architectures: amd64 i386 source
Sources:
  main: bionic-updates-main [snapshot]
  universe: bionic-updates-universe [snapshot]
aptly@srv:~$ aptly publish show bionic-security ubuntu
Prefix: ubuntu
Distribution: bionic-security
Architectures: amd64 i386 source
Sources:
  main: bionic-security-main [snapshot]
  universe: bionic-security-universe [snapshot]

2 thoughts on “Mirror the official Ubuntu repositories using aptly”

  1. Hi,

    In company I’m working we have many VM-s. To reduce traffic to public repo I create mirror (currently using apt-mirror).
    In DNS server (dnsmasq) used by VM-s I replace IP address of repos.influxdata.com to point to our mirror.
    So there is no need to change /etc/apt/sources.list (to replace entry: deb https://repos.influxdata.com/debian buster stable)
    However I have problem with apt-mirror and decide to replace it with aptly – it does not download i18n/Translation-en.bz2
    and other files that cause that ‘apt update’ failes.
    But if I download missing files by hand this solution – with apt-mirror – is working.

    So my steps to create mirror (for this example I use repos.influxdata.com, however I also mirror other like deb.debian.org and security.debian.org)

    # curl -sL https://repos.influxdata.com/influxdb.key | gpg –import
    gpg: key 684A14CF2582E0C5: “InfluxDB Packaging Service ” not changed
    gpg: Total number processed: 1
    gpg: unchanged: 1

    # gpg –no-default-keyring –list-keys –keyring pubring.gpg
    /root/.gnupg/pubring.gpg
    ————————
    pub rsa4096 2015-09-28 [SC]
    05CE15085FC09D18E99EFB22684A14CF2582E0C5
    uid [ unknown] InfluxDB Packaging Service
    sub rsa4096 2015-09-28 [E]

    # gpg –no-default-keyring –list-keys –keyring trustedkeys.gpg
    /root/.gnupg/trustedkeys.gpg
    —————————-
    [part removed]
    pub rsa4096 2015-09-28 [SC]
    05CE15085FC09D18E99EFB22684A14CF2582E0C5
    uid [ unknown] InfluxDB Packaging Service
    sub rsa4096 2015-09-28 [E]

    # gpg –no-default-keyring –list-keys –keyring secring.gpg
    [empty – secring.pgp size is 0 ]

    # aptly mirror create -architectures=amd64 influxdata https://repos.influxdata.com/debian buster stable
    # aptly mirror update influxdata
    # aptly snapshot create influxdata-2020-04-08 from mirror influxdata
    # aptly publish snapshot influxdata-2020-04-08
    Loading packages…
    Generating metadata files and linking package files…
    Finalizing metadata files…
    Signing file ‘Release’ with gpg, please enter your passphrase when prompted:
    gpg: no default secret key: secret key not available
    gpg: signing failed: secret key not available
    ERROR: unable to publish: unable to detached sign file: exit status 2

    So I try
    # curl -sL https://repos.influxdata.com/influxdb.key | gpg –import –no-default-keyring –keyring secring.gpg
    gpg: key 684A14CF2582E0C5: public key “InfluxDB Packaging Service ” imported
    gpg: Total number processed: 1
    gpg: imported: 1

    and then again:
    # aptly publish snapshot influxdata-2020-04-08
    Loading packages…
    Generating metadata files and linking package files…
    Finalizing metadata files…
    Signing file ‘Release’ with gpg, please enter your passphrase when prompted:

    gpg: Ohhhh jeeee: … this is a bug (../../g10/getkey.c:2757:lookup)
    secmem usage: 1408/1408 bytes in 2/2 blocks of pool 1408/65536
    ERROR: unable to publish: unable to detached sign file: signal: aborted

    # dpkg -l | egrep ‘aptly|gpg’
    ii aptly 1.3.0-5~bpo9+1 amd64 Swiss army knife for Debian repository management – main package
    ii gpgv 2.1.18-8~deb9u4 amd64 GNU privacy guard – signature verification tool
    ii gpgv1 1.4.21-4+deb9u1 amd64 GNU privacy guard – signature verification tool (deprecated “classic” version)
    ii libgpg-error0:amd64 1.26-2 amd64 library for common error values and messages in GnuPG components
    ii libgpgme11:amd64 1.8.0-3+b2 amd64 GPGME – GnuPG Made Easy (library)

    How could I fix it ?
    Thank You very much for any help.


    Best regards
    Lukasz Czyzewski

  2. Fixed.

    Unfortunately I don’t know what was the reason.
    Just delete and create new VM. Install aptly, gnupg and gpg and ‘aptly publish …’ work then.
    I look that in working VM a have more packages:
    # dpkg -l | egrep ‘aptly|gpg’
    ii gpg 2.2.12-1+deb10u1 amd64 GNU Privacy Guard — minimalist public key operations
    ii gpg-agent 2.2.12-1+deb10u1 amd64 GNU privacy guard – cryptographic agent
    ii gpg-wks-client 2.2.12-1+deb10u1 amd64 GNU privacy guard – Web Key Service client
    ii gpg-wks-server 2.2.12-1+deb10u1 amd64 GNU privacy guard – Web Key Service server
    ii gpgconf 2.2.12-1+deb10u1 amd64 GNU privacy guard – core configuration utilities
    ii gpgsm 2.2.12-1+deb10u1 amd64 GNU privacy guard – S/MIME version
    ii gpgv 2.2.12-1+deb10u1 amd64 GNU privacy guard – signature verification tool
    ii libgpg-error0:amd64 1.35-1 amd64 GnuPG development runtime library


    Best regards
    Lukasz Czyzewski

Leave a Reply

Your email address will not be published. Required fields are marked *