Creating custom ISO images

DIY Imager

© Photo by Raj Rana on Unsplash

© Photo by Raj Rana on Unsplash

Article from Issue 272/2023
Author(s):

If you are looking to customize your Linux distribution, we show you three graphical front ends for creating bootable ISO images.

Specialized Linux distributions exist for virtually any imaginable use case. However, much like the typical all-rounders for daily use, these distributions often come with many superfluous applications. These apps consume disk space and – if they happen to run in the background – CPU resources as well. Some users want a lean basic system without additional software, which they can customize with the programs they actually need. This article looks at graphical front ends that give users a DIY Linux image quickly without too much overhead.

Strategies

Customizable Linux distributions are usually based on a conventional ISO image. Ideally, the image will already contain a graphical user interface or offer a simple approach to installing a graphical desktop at the prompt. You also need an integrated package manager. A customizable system image often comes with a choice of multiple kernel versions. Standard applications like LibreOffice, Firefox, Gimp, or VLC may be missing, but they can be installed via the package manager if necessary. To be able to use a system like this on several computers later, you need the ability to create ISO images of the system by deploying a handy tool, one that is easy to use and not just for Linux gurus.

Approach

There are two approaches to generating a custom ISO image of a distribution. The first approach involves working with a live system. You first install and run the desired distribution on your computer and remove all unwanted applications. To this trunk system, you then add all the applications you actually need for your individual Linux system. Then, using a tool for generating ISO images gleaned from the running system, you create an image into which you bundle the entire running system, including the newly installed additional applications.

The second approach uses an existing ISO image obtained from the Internet (without prior installation) as the basis for a custom system. The tool generates the individual system from the standard image by loading it and temporarily unpacking it for editing. It then creates the custom image from the image you modified.

Depending on whether you want your custom Linux derivative to boot from optical media or a removable USB, you may need different tools to generate the ISO image. If possible, chose a tool that lets you generate hybrid images (i.e., ones that can boot from optical or flash media as needed).

Cubic

The Custom Ubuntu ISO Creator, or Cubic [1] for short, can be used on Ubuntu, Debian, and their derivatives to create individual ISO images. You can pick up the software from a separate repository. To add the archive to your package management system, first open a terminal and update your system. Then include the Cubic repo in your running system and install the software (Listing 1). After that, you can launch the tool from the system menu to open a virtually empty window (Figure 1).

Listing 1

Cubic Setup

$ sudo apt-add-repository ppa:cubic-wizard/release
$ sudo apt update
$ sudo apt install --no-install-recommends cubic
Figure 1: Cubic's startup screen only requires you to specify a working directory.

When you get there, start by selecting a project directory where the data for the ISO image to be generated will be stored. To do this, click on the folder icon bottom right next to the empty path display, and then select the desired directory in the file manager. You can apply the path by clicking the green Select button top right in the file manager. Then, in the main window, click Next top right.

In the next dialog box, you define the source and the target images. Cubic does not generate the new image from a running system, but from an existing ISO image. You can use any image file. Ideally, you will want to use an image that is as lightweight as possible.

After selecting the source image, Cubic fills out most of the fields in the dialog automatically. It checks the boxes to the left of each completely and correctly filled out field. If problems occur, or Cubic cannot determine certain data from the source image, it places a question mark after the respective field. You can ignore optional information such as the release URL and leave the related fields empty.

After clicking Next, Cubic analyzes the source image. If problems occur (e.g., the image is not an Ubuntu or Debian derivative), the program displays an error message. For successfully identified images, Cubic opens and extracts the data. You then click Customize at the top right of the window to enter a virtual terminal, with Cubic executing a chroot.

You can now work with the extracted ISO image at the prompt (Figure 2). Because you are working as the admin in the virtual terminal, you can enter commands directly without prefixing sudo. As a first step, you should update the ISO image by typing:

apt update && apt upgrade
Figure 2: You need to unpack the source image before editing it.

Depending on the image's age, this can generate a considerable download volume.

After updating the system, use

apt purge APPLICATION

to remove any unwanted applications included in the standardized ISO image. Vice versa, use

apt install APPLICATION

to add any desired applications to the custom ISO image.

If you do not know exactly which applications the source ISO includes, you can also install the new applications first after completing the update and then press Next in the top right corner of the terminal. Cubic then analyzes the updated image and directs you to a window with a list of available applications (Figure 3). In the window, check the boxes of the listed applications that you want to delete. Typical candidates include, for example, the many additional packages for localizing LibreOffice.

Figure 3: Cubic lists all applications present in an image.

Now, switch to the next dialog where you can choose between different kernels for the new image. In the following and final dialog, you need to specify the compression for the new filesystem. You have a choice of several methods here, with Cubic displaying their compression efficiency and the relative size of the resulting image in a graph (Figure 4). Choose the desired compression method by pressing the radio button to the left of the option.

Figure 4: Cubic shows you which compression method is the most efficient.

Then click Generate to start creating the new ISO image. Cubic goes through several steps, which it displays individually and documents with progress bars. Depending on the size of the image to be created and your computer's resources, this can take some time. After successfully completing each step, Cubic will show you some data about the new image in an overview window.

For an initial test, open a Qemu virtual machine (VM) by clicking the green Test button at top left; Cubic will start the new live system in the VM. After closing the VM, you are taken back to the last dialog in Cubic and can exit the application by pressing Close. This completes the process of generating the new image.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Cubic

    With a little planning, Cubic makes customizing Ubuntu ISOs simple and intuitive, saving you time on your post-install modifications.

  • Gimp and Photos

    Gimp will help you dial up the quality on your less-than-perfect digital

    images.

  • Snapshot Tools

    Experts agree that you should keep a copy of your data, but restoring from incremental backups takes time and sometimes doesn't work as expected. Alternatively, you can capture your data in a snapshot. Read on for a review of some leading Linux snapshot tools.

  • Partition Backup

    A partition backup offers several advantages over legacy, file-based backup alternatives, and using a backup server adds even more convenience. We’ll show you some free tools for partition backup over the network.

  • KVM Storage

    KVM has many ways to map virtual disks on the host system. The appropriate choice of disk format has an effect not only on the speed of I/O operations but also on snapshots and backups.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News