lost and found ( for me ? )

KVM : install CentOS 5.6 as a guest with kicksart


KVM host
# tail -1 /etc/lsb-release
DISTRIB_DESCRIPTION="Ubuntu 11.04"

# uname -r
2.6.38-10-server

[ preparation ]

- kickstart file
- ISO image
- httpd

I used the following kickstart file.
# cat centos5-6-kvm-ks.cfg
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth  --useshadow  --enablemd5
# System bootloader configuration
bootloader --append="console=ttyS0,115200n8 console=tty0" --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard jp106
# System language
lang ja_JP
# Installation logging level
logging --level=info
# Use network installation
url --url=http://192.168.10.15/centos
# Network information
network --bootproto=static --device=eth0 --gateway=192.168.10.254 --ip=192.168.10.161 --nameserver=192.168.10.15 --netmask=255.255.255.0 --onboot=on
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $1$o4BvPEzq$CmfSLIJLfURGbGrLlTnOc1

# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone --isUtc Asia/Tokyo
# Install OS instead of upgrade
install
# Disk partitioning information
part / --bytes-per-inode=4096 --fstype="ext3" --size=5000
part swap --bytes-per-inode=4096 --fstype="swap" --size=512

%packages
@development-libs
@development-tools
@editors


When specifying kickstart file with virt-install , you need to specify http://xxx.
So you need to prepare httpd.
I prepared both CentOS ISO and httpd on the KVM host.

mount ISO image
# mkdir /var/www/centos
# mount -t iso9660 -o loop /var/disk1/ISOs/CentOS-5.6-x86_64-bin-DVD-1of2.iso /var/www/centos


start httpd and copy ks file under http document root. ( in my case , /var/www )
# apache2ctl start
# cp centos5-6-kvm-ks.cfg /var/www/


confirm you can get ks file.
# wget http://192.168.10.15/centos5-6-kvm-ks.cfg


[ install CentOS 5.6 as a guest VM with virt-install ]

install kvm-pxe if you have not installed.
# apt-get install kvm-pxe

# dpkg -L kvm-pxe
/.
/usr
/usr/share
/usr/share/qemu
/usr/share/qemu/pxe-rtl8139.bin
/usr/share/qemu/pxe-pcnet.bin
/usr/share/qemu/pxe-virtio.bin
/usr/share/qemu/pxe-ne2k_pci.bin
/usr/share/qemu/pxe-e1000.bin
/usr/share/doc
/usr/share/doc/kvm-pxe
/usr/share/doc/kvm-pxe/copyright
/usr/share/doc/kvm-pxe/changelog.Debian.gz


build a VM
# virt-install --connect qemu:///system -n centos5-1 -r 512 –dis
k path=/var/disk1/centos5.5-1.img,size=6 --vcpus=1 --os-type linux --os-variant
rhel5.4 --nographics --location http://192.168.10.15/centos --extra-args='ks=htt
p://192.168.10.15/centos5-6-kvm-ks.cfg ksdevice=eth0 console=tty0 console=ttyS0,
115200n8' --keymap ja --network bridge=br0 –nographics


the installation has been processed automatically.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.