openstack oz commands

Procedure 7.1. Building Images using Oz

  1. Use the yum command to install the oz and libguestfs-tools packages.
    #yum install -y oz libguestfs-tools
  2. Download the Red Hat Enterprise Linux 6 Server installation DVD ISO file from https://rhn.redhat.com/rhn/software/channel/downloads/Download.do?cid=10486.
    Although Oz supports the use of network-based installation media, in this procedure a Red Hat Enterprise Linux 6 ISO will be used.
    Use a text editor to create a TDL file for use with Oz. The following example displays the syntax for a basic TDL file.

    Example 7.1. TDL File

    The template below can be used to create a Red Hat Enterprise Linux 6 disk image. In particular, note the use of the rootpw element to set the password for the root user and the iso element to set the path to the DVD ISO.
    <template>
    <name>rhel64_x86_64</name>
    <description>Red Hat 6.4 x86_64 template</description>
    <os>
    <name>RHEL-6</name>
    <version>4</version>
    <arch>x86_64</arch>
    <rootpw>PASSWORD</rootpw>
    <install type='iso'>
    <iso>file:///home/user/rhel-server-6.4-x86_64-dvd.iso</iso>
    </install>
    </os>
    <commands>
    <command name='console'>
    sed -i 's/ rhgb//g' /boot/grub/grub.conf
    sed -i 's/ quiet//g' /boot/grub/grub.conf
    sed -i 's/ console=tty0 / serial=tty0 console=ttyS0,115200n8 /g'
    /boot/grub/grub.conf
    </command>
    </commands>
    </template>

    sed -i 's/ quiet//g' /boot/grub/grub.conf
    sed -i 's/ console=tty0 / serial=tty0 console=ttyS0,115200n8 /g' /boot/grub/grub.conf
       </command></commands></template>

  3. Run the oz-install command to build an image:
    #oz-install -u -d3 TDL_FILE
    Syntax:
    • -u ensures any required customization changes to the image are applied after guest operating installation.
    • -d3 enables the display of errors, warnings, and informational messages.
    • TDL_FILE provides the path to your TDL file.
    By default, Oz stores the resultant image in the /var/lib/libvirt/images/ directory. This location is configurable by editing the /etc/oz/oz.cfg configuration file.
  4. Run the virt-sysprep command on the image to re-initialize it in preparation for upload to the Image service. Replace FILE with the path to the disk image.
    #virt-sysprep --add FILE
    Refer to the virt-sysprep manual page by running the man virt-sysprep command for information on enabling and disabling specific operations.
You have successfully created a Red Hat Enterprise Linux based image that is ready to be added to the Image service.


你可能感兴趣的:(oz-install,virt-sysprep,oz)