Step-by-Step Guide: Creating an Ubuntu Autoinstall ISO with Cloud-init

watch 2m, 52s
views 2

11:13, 09.04.2026

Article Content
arrow

  • Overview
  • Steps to Create an Autoinstall ISO
  • Step 0 - Requirements and Preparing the “user-data” YAML File(s)
  • Step 1 - Set Up a Working Directory and Obtain a Clean Base ISO Image
  • Step 2 - Extract the Contents of the Install ISO
  • Step 3 - Modify the GRUB and ISOLINUX Configuration Files
  • Step 4 - Integrate Your Custom “user-data” YAML File(s) into the ISO
  • Step 5 - Rebuild the Autoinstall ISO
  • Example of a “user-data” YAML File
  • Closing Remarks

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:

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.

Share

Was this article helpful to you?

VPS popular offers

sale

-21%

CPU
CPU
6 Xeon Cores
RAM
RAM
8 GB
Space
Space
100 GB SSD
Bandwidth
Bandwidth
8 TB
wKVM-SSD 8192 Metered Windows

65 /mo

/mo

Billed annually

sale

-20%

CPU
CPU
4 Xeon Cores
RAM
RAM
2 GB
Space
Space
75 GB SSD
Bandwidth
Bandwidth
Unlimited
10Ge-wKVM-SSD 2048 Windows

37.4 /mo

/mo

Billed monthly

-10%

CPU
CPU
6 Epyc Cores
RAM
RAM
16 GB
Space
Space
150 GB NVMe
Bandwidth
Bandwidth
Unlimited
Keitaro KVM 16384
OS
CentOS
Software
Software
Keitaro

55.54 /mo

/mo

Billed annually

sale

-20%

CPU
CPU
6 Epyc Cores
RAM
RAM
8 GB
Space
Space
100 GB NVMe
Bandwidth
Bandwidth
Unlimited
KVM-NVMe 8192 Linux

26.35 /mo

/mo

Billed monthly

sale

-20%

CPU
CPU
4 Xeon Cores
RAM
RAM
4 GB
Space
Space
100 GB HDD
Bandwidth
Bandwidth
300 Gb
KVM-HDD HK 4096 Linux

12 /mo

/mo

Billed monthly

sale

-20%

CPU
CPU
6 Xeon Cores
RAM
RAM
8 GB
Space
Space
100 GB SSD
Bandwidth
Bandwidth
Unlimited
wKVM-SSD 8192 Windows

28.44 /mo

/mo

Billed monthly

sale

-24.7%

CPU
CPU
4 Xeon Cores
RAM
RAM
4 GB
Space
Space
50 GB SSD
Bandwidth
Bandwidth
4 TB
KVM-SSD 4096 Metered Linux

31 /mo

/mo

Billed annually

sale

-20%

CPU
CPU
4 Xeon Cores
RAM
RAM
2 GB
Space
Space
60 GB HDD
Bandwidth
Bandwidth
300 Gb
wKVM-HDD HK 2048 Windows

11.56 /mo

/mo

Billed semiannually

sale

-20%

CPU
CPU
4 Epyc Cores
RAM
RAM
4 GB
Space
Space
50 GB NVMe
Bandwidth
Bandwidth
Unlimited
wKVM-NVMe 4096 Windows

18.1 /mo

/mo

Billed semiannually

sale

-20%

CPU
CPU
8 Xeon Cores
RAM
RAM
32 GB
Space
Space
200 GB SSD
Bandwidth
Bandwidth
Unlimited
wKVM-SSD 32768 Windows

73.99 /mo

/mo

Billed monthly

Other articles on this topic

cookie

Accept cookies & privacy policy?

We use cookies to ensure that we give you the best experience on our website. If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the HostZealot website.