Tips On OZ

TurnToJPG -->


Reference

The reference URL is located at:
http://www.chenshake.com/oz-making-centos-mirror/

Installation

On CentOS 7, install oz via:

# yum install -y oz
# rpm -qa | grep oz-
oz-0.14.0-1.el7.noarch

Configuration

The configuration file for oz should be configured as:

# vim /etc/oz/oz.cfg 
[paths]
output_dir = /var/lib/libvirt/images
data_dir = /var/lib/oz
screenshot_dir = /var/lib/oz/screenshots
# sshprivkey = /etc/oz/id_rsa-icicle-gen

[libvirt]
uri = qemu:///system
#image_type = raw
image_type = qcow2
# type = kvm
bridge_name = virbr0
cpus = 1
memory = 1024

The configuration file for the oz should have one tdl file and one kickstart file:

# cat centos66.tdl 
<template>
   <name>centos_66_x86_64</name>
   <description>CentOS 6.6 x86_64 template</description>
   <os>
      <name>CentOS-6</name>
      <version>6</version>
      <arch>x86_64</arch>
      <install type='url'>
         <url>http://192.168.0.79/ks_mirror/CentOS-6.6-x86_64</url>
      </install>
   </os>
</template>

Be sure the kickstart file should have the same url installtion location:

# cat centos6-oz.cfg 
text
skipx
install
url --url http://192.168.0.79/ks_mirror/CentOS-6.6-x86_64
repo --name=updates --baseurl=http://192.168.0.79/ks_mirror/CentOS-6.6-x86_64
lang en_US.UTF-8

Build Image

Build your own images via:

# oz-install -p -u -d1 -a centos6-oz.cfg centos66.tdl

Get the images via:

[root@pc134 images]# pwd
/var/lib/libvirt/images
[root@pc134 images]# ls -l -h centos_66_x86_64.qcow2
-rw-rw-rw- 1 root root 1015M Oct 12 14:48 centos_66_x86_64.qcow2