The final big feature of libguestfs 1.26 has arrived. Virt-customize is the customization bits from virt-builder, in a separate program. This lets you take any virtual machine and install packages, edit configuration files, run scripts, set passwords and so on.
One of the most requested features for virt-builder is the ability to customize templates while keeping a shared backing file, and virt-customize lets you do this.
Here’s how to use virt-customize:
$ virt-customize -a fedora-20.img \ --update --install gcc [ 0.0] Examining the guest ... [ 37.0] Setting a random seed [ 37.0] Updating core packages [ 238.0] Installing packages: gcc
virt-inspector has a way to list out the packages installed in a virtual machine disk image, and we can use it to show that gcc was installed:
$ virt-inspector -a fedora-20.img | xmlstarlet sel -t -c '//application[name="gcc"]' <application> <name>gcc</name> <version>4.8.2</version> <release>7.fc20</release> <arch>x86_64</arch> </application>