Step-by-Step Guide: Creating an Ubuntu Autoinstall ISO with Cloud-init
11:13, 09.04.2026
Automating the installation process is essential for streamlining system deployment, especially in environments that require consistent setups across multiple machines.
Ubuntu’s Autoinstall feature, combined with Cloud-init, provides a powerful way to preconfigure installations with minimal effort. Whether you’re setting up servers for a data center or configuring multiple workstations, a custom Autoinstall ISO can save hours of repetitive work.
This guide will help you create a bootable ISO tailored to your specific needs, ensuring a smooth and efficient installation process every time.
Overview
Creating a custom Ubuntu autoinstall ISO simplifies and automates OS deployment, saving time and ensuring consistency. This guide walks you through building an Ubuntu autoinstall ISO using Cloud-init for automatic configuration. The result is a bootable ISO that requires minimal manual intervention during installation.
Steps to Create an Autoinstall ISO
Creating a custom Ubuntu Autoinstall ISO involves several steps.
Follow this structured process to ensure a smooth setup:
Step 0 - Requirements and Preparing the “user-data” YAML File(s)
Before starting, ensure you have:
- A system running Ubuntu or any Linux distribution.
- A clean Ubuntu ISO image (20.04 or later).
- Packages like xorriso, mkisofs, and cloud-init.
Create a user-data YAML file, which contains the automation script for your installation. This file will define users, partitions, packages, and other configurations.
Step 1 - Set Up a Working Directory and Obtain a Clean Base ISO Image
Start by setting up a working directory:
mkdir ~/autoinstall-iso && cd ~/autoinstall-iso
Download the official Ubuntu ISO:
wget https://releases.ubuntu.com/22.04/ubuntu-22.04-live-server-amd64.iso
Step 2 - Extract the Contents of the Install ISO
Extract the ISO contents to your working directory:
7z x ubuntu-22.04-live-server-amd64.iso -oiso_extracted/
Ensure the contents are correctly extracted by navigating into the iso_extracted directory.
Step 3 - Modify the GRUB and ISOLINUX Configuration Files
Edit the bootloader to enable automated installation.
- Modify GRUB: Open iso_extracted/boot/grub/grub.cfg and append the following to the linux line under the default menu entry:
autoinstall ds=nocloud\;s=/cdrom/
- Modify ISOLINUX: Edit iso_extracted/isolinux/txt.cfg similary way by adding:
autoinstall ds=nocloud\;s=/cdrom/
Step 4 - Integrate Your Custom “user-data” YAML File(s) into the ISO
Create a nocloud directory inside iso_extracted:
mkdir -p iso_extracted/nocloud/
Place your user-data and meta-data files into this directory. For basic usage, meta-data can be an empty file:
touch iso_extracted/nocloud/meta-data
mv user-data iso_extracted/nocloud/
Step 5 - Rebuild the Autoinstall ISO
Repack the modified ISO using the following command:
xorriso -as mkisofs -r -V "Autoinstall Ubuntu" \
-o ~/autoinstall-ubuntu-22.04.iso \
-J -l -cache-inodes -b isolinux/isolinux.bin \
-c isolinux/boot.cat -no-emul-boot -boot-load-size 4 \
-boot-info-table iso_extracted/
This command generates a bootable ISO with all your custom configurations.
Example of a “user-data” YAML File
Here’s a simple example of a user-data file:
#cloud-config
autoinstall:
version: 1
identity:
hostname: ubuntu-server
username: admin
password: $6$hashed_password
ssh:
install-server: true
storage:
layout:
name: lvm
packages:
- vim
- curl
Closing Remarks
With this guide, you’ve created a custom Ubuntu autoinstall ISO using Cloud-init. This approach simplifies repetitive installations and ensures consistency across deployments. Test your ISO in a virtual machine to verify its behavior before large-scale use.