How to mirror images locally

Streamline image delivery with MAAS and SimpleStreams

Errors or typos? Topics missing? Hard to read? Let us know!

Struggling with a slow or unreliable internet connection? Use MAAS with SimpleStreams to have images ready on-demand. You can choose between two image streams—‘candidate’ and ‘stable’—both loaded with Ubuntu, CentOS images, bootloaders, and release alerts.

Switch streams (UI)

By default, MAAS uses the ‘stable’ stream. To switch to the ‘candidate’ stream:

  1. Go to Images.
  2. Choose Change source.
  3. Select Custom.
  4. Input http://images.maas.io/ephemeral-v3/candidate as the URL.
  5. Click Connect.

To revert to the ‘stable’ stream, follow the same steps, using maas.io as the URL.

Change streams (CLI)

Execute these commands to change streams:

BOOT_SOURCE_ID=$(maas $PROFILE boot-sources read | jq '.[] | select(.url | contains("images.maas.io/ephemeral-v3")) | .id')
maas $PROFILE boot-source update $BOOT_SOURCE_ID url=$STREAM_URL

Set up local mirror

Start by installing SimpleStreams:

sudo apt install simplestreams

Define these variables for cleaner CLI commands:

KEYRING_FILE=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg
IMAGE_SRC=https://images.maas.io/ephemeral-v3/stable
IMAGE_DIR=/var/www/html/maas/images/ephemeral-v3/stable

Mirror your kernels with these commands:

sudo sstream-mirror --keyring=$KEYRING_FILE $IMAGE_SRC $IMAGE_DIR 'arch=amd64' 'release~(bionic|focal)' --max=1 --progress
sudo sstream-mirror --keyring=$KEYRING_FILE $IMAGE_SRC $IMAGE_DIR 'os~(grub*|pxelinux)' --max=1 --progress

Use --dry-run to preview your selection. Remove it to begin the download.

MAAS saves images to the directory defined by ‘IMAGE_DIR’. The new boot source URL will be http://<myserver>/maas/images/ephemeral-v3/stable/.

Verify image availability at the URL above.

Regularly update your mirror with cron to fetch the latest images.


Last updated a month ago.