Playing with oz-install

oz-install (see also: Oz) is a command line program for building operating system instances. It can automatically install a fairly wide variety of OSes, including Windows.

Using it is pretty effortless. You first need to write a small template file, which just describes the name and version of the OS you want to install and where to get the ISO from. Here is one for Fedora 14:

<template>
  <name>fedora14_x86_64</name>
  <os>
    <name>Fedora</name>
    <version>14</version>
    <arch>x86_64</arch>
    <install type='iso'>
      <iso>file:///mnt/media/installers/Fedora-14-x86_64-DVD/Fedora-14-x86_64-DVD.iso</iso>
    </install>
  </os>
  <description>Fedora 14 x86_64 template</description>
</template>

By default oz-install will write the destination VM to /var/lib/libvirt/images, so you either need to check you’ve got enough free disk space under there, or else change the output path in /etc/oz/oz.cfg.

Using oz-install is simple, just do:

# oz-install fedora.xml
Libvirt XML was written to fedora14_x86_64Aug_30_2011-13:53:07

(oz-install requires root, but there is a feature request to remove this limitation)

oz-install writes a disk image and a libvirt XML file that you can use to immediately boot the guest:

# virsh define fedora14_x86_64Aug_30_2011-13:53:07
Domain fedora14_x86_64 defined from fedora14_x86_64Aug_30_2011-13:53:07

# virsh start fedora14_x86_64
Domain fedora14_x86_64 started

# virt-viewer fedora14_x86_64

I don’t know what root password is given to new Oz guests, but I was easily able to edit it out using guestfish.

Note that serious Oz users will want to further customize the guest using oz-customize, rather than booting it like I did. The workflow is that you use oz-install once to create the operating system template. Then you can duplicate the template, customize it (oz-customize) and deploy it. The copy-and-customize step is much quicker than installing a whole new guest from scratch each time.

Update: Chris tells me that the default root password is ozrootpw. You can also set it in the template description file by adding a <rootpw> element.

About these ads

1 Comment

Filed under Uncategorized

One response to “Playing with oz-install

  1. foo

    Having a default root password is a bad idea.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s