Repackaging an Ubuntu ISO image for automated installation (autoinstall) can significantly streamline the process of setting up multiple systems, especially for environments that require consistent configurations. By creating an autoinstall.yaml file, you can define parameters such as partitions, users, and preinstalled packages, enabling you to deploy Ubuntu efficiently with minimal manual intervention. This guide will walk you through the process of repackaging an Ubuntu ISO image for an autoinstall setup using YAML.
Software Requirements and Linux Command Line Conventions
Category
Requirements, Conventions or Software Version Used
System
Ubuntu 24.04 or later, Linux command line
Software
rsync, xorriso, nano
Other
ISO image of Ubuntu 24.04 or higher
Conventions
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ – requires given linux commands to be executed as a regular non-privileged user
Step-by-Step Guide to Repackage Ubuntu ISO for Autoinstall
To automate the installation of Ubuntu with a custom configuration, you need to repackage an existing ISO file to include an autoinstall YAML file. Follow these steps to create your customized Ubuntu ISO.
Download the ISO Image and Set Up Working Directory: Begin by downloading the latest Ubuntu ISO and setting up a directory to work in.
In this step, you create a directory named myiso and copy the downloaded ISO image to it for modification.
Mount the ISO Image: Mount the Ubuntu ISO image to a directory to access its contents.
$ cd myiso/
$ mkdir isomount
$ sudo mount -o loop ubuntu-24.04.1-desktop-amd64.iso isomount
Here, you create a directory called isomount and mount the ISO image to this directory using the mount command.
Extract the ISO Contents: Use rsync to extract the contents of the mounted ISO image to a new directory.
$ rsync -a isomount/ extracted
This step copies all the files from the mounted ISO to a directory named extracted, which will be used to make modifications.
Create and Edit the Autoinstall YAML File: Create an autoinstall YAML file to define the installation parameters.
Starting from Ubuntu 24.04 (Noble), a top-level autoinstall: keyword is required. You can create or edit the autoinstall.yaml file as shown below:
In this basic YAML file, you specify the version, packages to install, and user identity settings (such as username, password, and hostname). Feel free to add more configuration settings to fit your needs. Make sure the file is placed in the extracted directory, which will be included in the repackaged ISO.
This command uses xorriso to create a new ISO named custom-ubuntu24.iso that includes the modifications you made, such as the autoinstall.yaml file. The various flags ensure that the new ISO is bootable.
Boot the Modified ISO: As a last step simply boot from your new custom Ubuntu autoinstall image.
👁 Boot the Modified ISO Boot the Modified ISO. You should see your autoinstall configuration options when proceeding with the Ubuntu installation.
Conclusion
By following the steps outlined in this guide, you can create a customized Ubuntu ISO image for automated installation, which can save time and effort, especially when setting up multiple systems. The process involves mounting, extracting, modifying, and repackaging an existing Ubuntu ISO to include an autoinstall.yaml configuration file. With these steps, you can deploy Ubuntu consistently across your environment, avoiding repetitive manual setup tasks.