Skip to content

Pull Linux packages with apt

An apt proxy puts a Debian or Ubuntu archive behind your organization’s CloudRepo host. apt reads it as a source. The token stays in a file only root can read, never in a URL.

In the admin portal, create a repository with apt as the Format and Proxy as the Kind. Then pick the archive it reads from:

  • deb.debian.org/debian: Debian
  • security.debian.org/debian-security: Debian security updates
  • archive.ubuntu.com/ubuntu: Ubuntu (amd64 and i386)
  • security.ubuntu.com/ubuntu: Ubuntu security updates (amd64 and i386)
  • ports.ubuntu.com/ubuntu-ports: Ubuntu for arm64 and other architectures
  • download.docker.com/linux/ubuntu: Docker for Ubuntu
  • download.docker.com/linux/debian: Docker for Debian

One apt proxy reads one archive.

You also need a repository token that covers the proxy. Repository Tokens shows how to make one. apt’s login is the email address of the account that made the token, and its password is the token.

Used on this page only, never saved. Never enter a token or password here.

Start with CA certificates:

Terminal
sudo apt-get update && sudo apt-get install -y ca-certificates

apt needs CA certificates to open an https source. Many container images, ubuntu:24.04 among them, ship without them.

Save the credentials as root, in /etc/apt/auth.conf.d/cloudrepo-your-repo.conf. Each repository gets its own file, so a host with several CloudRepo repositories keeps every token:

cloudrepo-your-repo.conf
machine your-org.mycloudrepo.io/repositories/your-repo/
login you@example.com
password YOUR_REPOSITORY_TOKEN

Now add the source. Save one line as root in /etc/apt/sources.list.d/cloudrepo-your-repo.list. Pick the line for the archive your proxy reads.

For archive.ubuntu.com/ubuntu and ports.ubuntu.com/ubuntu-ports:

cloudrepo-your-repo.list
deb [signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] https://your-org.mycloudrepo.io/repositories/your-repo noble main

For security.ubuntu.com/ubuntu:

cloudrepo-your-repo.list
deb [signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] https://your-org.mycloudrepo.io/repositories/your-repo noble-security main

For deb.debian.org/debian:

cloudrepo-your-repo.list
deb [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] https://your-org.mycloudrepo.io/repositories/your-repo trixie main

For security.debian.org/debian-security:

cloudrepo-your-repo.list
deb [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] https://your-org.mycloudrepo.io/repositories/your-repo trixie-security main

For download.docker.com/linux/ubuntu:

cloudrepo-your-repo.list
deb [signed-by=/etc/apt/keyrings/docker.asc] https://your-org.mycloudrepo.io/repositories/your-repo noble stable

For download.docker.com/linux/debian:

cloudrepo-your-repo.list
deb [signed-by=/etc/apt/keyrings/docker.asc] https://your-org.mycloudrepo.io/repositories/your-repo trixie stable

apt checks the archive’s signature with Docker’s own key, at /etc/apt/keyrings/docker.asc on a host that installed Docker from Docker’s archive. On a new host, Docker’s install guide saves the key there. CloudRepo serves Docker’s signed files unchanged.

noble is Ubuntu 24.04 and trixie is Debian 13. If you use another release, replace noble or trixie with its name. apt checks the archive’s signature with the key your host already has.

Make the credentials file readable by root alone, then refresh apt:

Terminal
sudo chmod 600 /etc/apt/auth.conf.d/cloudrepo-your-repo.conf
sudo apt-get update

Now install a package. This line installs jq:

Terminal
sudo apt-get install -y jq

Put the package you need in its place. The -y flag answers apt’s prompt for you, so the line also runs in a script.

From a proxy of Docker’s archive, put docker-ce-cli in its place to install Docker’s command-line client.

Leave signature checks at apt’s defaults. Do not set trusted=yes or pass --allow-unauthenticated.

View as Markdown