Skip to content

Generate an ISO image for automated Ubuntu 20.04 desktop installations.

License

Notifications You must be signed in to change notification settings

covertsh/ubuntu-preseed-iso-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ubuntu Preseed ISO Generator

Generate an ISO image for automated Ubuntu 20.04 desktop installations. This script uses the traditional preseed method.

Behavior

Check out the usage information below for arguments. The basic idea is to take an unmodified Ubuntu ISO image, extract it, add some kernel command line parameters and a preseed file, then repack the data into a new ISO. Creating the preseed file itself is outside the scope of this tool.

There is an example preseed file example.seed in this repository which will install Ubuntu using US English settings and UTC time zone with a user named "User" and password "ubuntu". You could modify that file to create your own custom configuration. Unlike the server version of this script, there is currently no way to provide the preseed configuration on a separate volume during the installation - it must be baked into the ISO image.

This script can use an existing ISO image or download the latest daily 64-bit image from the Ubuntu project. Using a fresh ISO speeds things up because there won't be as many packages to update during the installation.

By default, the source ISO image is checked for integrity and authenticity using GPG. This can be disabled with -k.

Requirements

Tested on a host running Ubuntu 20.04.1.

  • Utilities required:
    • p7zip-full
    • mkisofs or genisoimage

Usage

Usage: ubuntu-preseed-iso-generator.sh [-h] [-k] [-v] [-p preseed-configuration-file] [-s source-iso-file] [-d destination-iso-file]

💁 This script will create fully-automated Ubuntu 20.04 Focal Fossa installation media.

Available options:

-h, --help          Print this help and exit
-v, --verbose       Print script debug info
-p, --preseed       Path to preseed configuration file.
-k, --no-verify     Disable GPG verification of the source ISO file. By default SHA256SUMS-<current date> and
                    SHA256SUMS-<current date>.gpg in <script directory> will be used to verify the authenticity and integrity
                    of the source ISO file. If they are not present the latest daily SHA256SUMS will be
                    downloaded and saved in <script directory>. The Ubuntu signing key will be downloaded and
                    saved in a new keyring in <script directory>
-s, --source        Source ISO file. By default the latest daily ISO for Ubuntu 20.04 will be downloaded
                    and saved as <script directory>/ubuntu-original-<current date>.iso
                    That file will be used by default if it already exists.
-d, --destination   Destination ISO file. By default <script directory>/ubuntu-preseed-<current date>.iso will be
                    created, overwriting any existing file.

Example

user@testbox:~$ bash ubuntu-preseed-iso-generator.sh -p example.seed -d ubuntu-preseed-example.iso
[2021-03-13 10:05:10] 👶 Starting up...
[2021-03-13 10:05:10] 📁 Created temporary working directory /tmp/tmp.rrehvj78Bk
[2021-03-13 10:05:10] 🔎 Checking for required utilities...
[2021-03-13 10:05:10] 👍 All required utilities are installed.
[2020-12-23 14:06:07] 🌎 Downloading current daily ISO image for Ubuntu 20.04 Focal Fossa...
[2020-12-23 14:08:01] 👍 Downloaded and saved to /home/user/ubuntu-original-2021-03-13.iso
[2020-12-23 14:08:01] 🌎 Downloading SHA256SUMS & SHA256SUMS.gpg files...
[2020-12-23 14:08:02] 🌎 Downloading and saving Ubuntu signing key...
[2020-12-23 14:08:02] 👍 Downloaded and saved to /home/user/843938DF228D22F7B3742BC0D94AA3F0EFE21092.keyring
[2020-12-23 14:08:02] 🔐 Verifying /home/user/ubuntu-original-2021-03-13.iso integrity and authenticity...
[2020-12-23 14:08:09] 👍 Verification succeeded.
[2020-12-23 14:08:09] 🔧 Extracting ISO image...
[2021-03-13 10:05:23] 👍 Extracted to /tmp/tmp.rrehvj78Bk
[2021-03-13 10:05:23] 🧩 Adding preseed parameters to kernel command line...
[2021-03-13 10:05:23] 👍 Added parameters to UEFI and BIOS kernel command lines.
[2021-03-13 10:05:23] 🧩 Adding preseed configuration file...
[2021-03-13 10:05:23] 👍 Added preseed file
[2021-03-13 10:05:23] 👷 Updating /tmp/tmp.rrehvj78Bk/md5sum.txt with hashes of modified files...
[2021-03-13 10:05:23] 👍 Updated hashes.
[2021-03-13 10:05:23] 📦 Repackaging extracted files into an ISO image...
[2021-03-13 10:05:35] 👍 Repackaged into /home/user/ubuntu-preseed-example.iso
[2021-03-13 10:05:35] ✅ Completed.
[2021-03-13 10:05:35] 🚽 Deleted temporary working directory /tmp/tmp.rrehvj78Bk

Now you can boot your target machine using ubuntu-preseed-example.iso and it will automatically install Ubuntu using the configuration from example.seed.

Thanks

This script is based on this minimal safe bash template, and steps found in this Ask Ubuntu answer.

License

MIT license.

About

Generate an ISO image for automated Ubuntu 20.04 desktop installations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages