How to build an Oracle Linux 9 image

This page explains how to create an Oracle Linux 9 image with packer.

Verify requirements

To create a OL9 image to upload to MAAS, you must have a machine running Ubuntu 22.04+ with the ability to run KVM virtual machines. You must also acquire the following items:

  • qemu-utils, libnbd-bin, nbdkit and fuse2fs
  • Packer, v1.8.0 or newer

To deploy the image to MAAS, you must also have:

Install packer

Packer is easily installed from its Debian package, please follow the instructions bellow:

curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install packer

This should install with no additional prompts.

Install dependencies

sudo apt install libnbd-bin nbdkit fuse2fs qemu-utils

Customizing the Image

The deployment image may be customized by modifying http/ol9.ks. See the OL9 kickstart documentation for more information.

Building the image using a proxy

The Packer template downloads the OL net installer from the Internet. To
tell Packer to use a proxy set the HTTP_PROXY environment variable to your proxy
server. Alternatively you may redefine iso_url to a local file, set
iso_checksum_type to none to disable checksuming, and remove iso_checksum_url.

To use a proxy during the installation define the KS_PROXY variable in the
environment, as bellow:

export KS_PROXY=$HTTP_PROXY

Building an image

You can easily build the image using the Makefile:

make

Alternatively you can manually run packer. Your current working directory must
be in packer-maas/ol8, where this file is located. Once in packer-maas/ol8
you can generate an image with:

packer init .
PACKER_LOG=1 packer build .

Note: ol9.pkr.hcl is configured to run Packer in headless mode. Only Packer
output will be seen. If you wish to see the installation output connect to the
VNC port given in the Packer output or change the value of headless to false in
ol9.pkr.hcl.

Installation is non-interactive.

Makefile Parameters

TIMEOUT

The timeout to apply when building the image. The default value is set to 1h.

Uploading an image to MAAS

maas $PROFILE boot-resources create \
    name='ol/9.2' title='Oracle Linux 9.2' \
    architecture='amd64/generic' filetype='tgz' \
    content@=ol9.tar.gz

Default Username

The default username is cloud-user


Last updated 7 months ago.