cd /mnt/lv_public/kvm/images cat >cslave.sh<<EOT #!/bin/bash set -x export VMNAME='cslave' export VMNUMBER='45' /usr/libexec/qemu-kvm \ -hda /mnt/lv_public/kvm/images/${VMNAME}_image \ -boot d \ -m 512 \ -k de \ -smp 1 \ -net nic,macaddr=00:de:ad:be:ef:7 \ -net vde,vlan=0 -no-reboot \ -vnc :$VMNUMBER # -net nic,vlan=1,macaddr=00:de:ad:be:ef:$VMNUMBER,model=e1000 \ # -net tap,vlan=1,script=/mnt/lv_public/kvm/images/qemu_add_tap_to_kvm0,downscript=no \ EOT chmod +x cslave.sh kvm-img create cslave_image 42G # 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=00:DE:AD:BE:EF: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.