分类: LINUX
2016-11-04 18:06:31
oz是一个方便制作qcow2镜像的工具,利用oz可以很方便的生成可以upload到openstack的镜像!
ks.cfg
===================================
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard ‘us’# Reboot after installation
reboot
# Root password
rootpw –iscrypted $1$jcIF8/Hh$hHIaOjg4owNnuO6Iq4D8h/
# System timezone
timezone Asia/Shanghai
# System language
lang en_US
# Firewall configuration
firewall –disabled
# Network information
network –bootproto=dhcp –device=eth0 –onboot=on
# System authorization information
auth –useshadow –passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# SELinux configuration
selinux –disabled
# Do not configure the X Window System
skipx
# System bootloader configuration
bootloader –append=”rhgb crashkernel=auto quiet” –location=mbr
#bootloader –append=”console=ttyS0,115200n8 console=tty0″ –location=mbr –driveorder=”sda” –timeout=1
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart –all –initlabel
# Disk partitioning information
part /boot –fstype=”ext4″ –size=200
part / –fstype=”ext4″ –size=512 –grow
%packages –nobase
%end
%post
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF DEVICE="eth0" BOOTPROTO="dhcp" ONBOOT="yes" TYPE="Ethernet" USERCTL="yes" PEERDNS="yes" IPV6INIT="no" PERSISTENT_DHCLIENT="1" EOF echo -e 'cloud-user\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
rm -f /etc/udev/rules.d/70-persistent-net.rules
%end
===================================
centos62.tdl
+++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++
确保libvirtd.service和libvirt-guests.service启动!不然会出错,如果出现user,group xxxxx uid 107等错误!修改/etc/nsswitch.conf,把一下三行注释掉:
======================
passwd: files sss
shadow: files sss
group: files sss
======================
制作过程中,如果出现,guest.py,redhat.py timeout….等错误,添加参数-t 2400调大oz生成镜像的时间!
制作镜像命令:
=========================
oz-install -p -u -d3 -t 2400 -a ks.cfg centos62.tdl
=========================
如果出现虚拟机不能获取ip,删除虚拟机的/etc/udev/rules.d/70-persistent-net.rules文件!