cd /mnt/lv_public/kvm/images
cat >cslave.sh<<EOT
kvm \
-hda cslave.img \
-cdrom /mnt/lv_public/isos/centos_5u4_boot.iso \
-boot d \
-m 512 \
-k de \
-name cslave \
-net nic,macaddr=de:ad:be:ef:00:7 \
-net vde,vlan=0,port=0
EOT
chmod +x cslave.sh
kvm-img create cslave.img 24G # create diskfile
sudo ./cslave.sh
# now do a basic installation.
# make sure network-interface is set up statically:
cat >/etc/sysconfig/network-scripts/ifcfg-eth0<<EOT
DEVICE=eth0
HWADDR=DE:AD:BE:EF:00:07
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.0.22.7
NETMASK=255.255.255.0
EOT
# I will use the http-export from the host also for the client-installs:
host$ echo '/mnt/centos 10.0.22.0/24(async,rw,no_subtree_check,no_root_squash)' >>/etc/exports
host$ /etc/init.d/nfs-kernel-server reload
# from now on at the cslave vm:
mkdir /mnt/centos
mount 10.0.22.1:/mnt/centos /mnt/centos
# lets setup epel-repos additionally:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
yum install -y cobbler dhcp xinetd
chkconfig tftp on
service iptables stop; chkconfig iptables off
sed -i 's,enforcing,disabled,' /etc/sysconfig/selinux
setenforce 0
cd /etc/cobbler
vi settings
# manage_dhcp: 1
# server: 10.0.22.7 # ip of the cobbler-vm
# next_server: 10.0.22.7 # ip serving the tftp, here the host-linux
vi dhcp.template
# edit the subnet-section to look like this:
------------
subnet 10.0.22.0 netmask 255.255.255.0 {
option routers 10.0.22.1;
option domain-name-servers 217.0.43.161;
option subnet-mask 255.255.255.0;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
------------
# i also had to remove these 3 lines (dhcpd didnt like the resulting output):
------------
#if $iface.hostname:
hostname $iface.hostname;
#end if
------------
service cobblerd start
cobbler sync
service dhcpd start
service httpd start
service xinetd start
for i in cobblerd dhcpd httpd xinetd; do chkconfig $i on; done
# now import the first distro
cobbler import --path=/mnt/centos --name=centos --available-as=http://10.0.22.1/centos
# and lets set the sample kickstart template
cobbler profile edit --name=centos-i386 --kickstart=/var/lib/cobbler/kickstarts/sample.ks
# now we are ready to cobbler-boot a client.