The host server (running CentOS 6.0) only has one public IP address and will be hosting many KVM guests so it needs to use a virtual network switch configuration in NAT mode.
I have previously used pxelinux for automated installation of physical machines and would like to continue to use pxelinux for installation of KVM-guests. The reason for this is that I already have written some scripts that generate pxelinux configuration files and I would like to reuse them.
Could someone provide a step-by-step instruction of how to install a CentOS 6.0 KVM guest on a CentOS 6.0 host server?
I would like to use the command line as much as possible so I prefer virt-install to virt-manager.
The host server has only one LVM volume group: vg0
[root@server ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg0 1 3 0 wz--n- 8.18t 97.90g
First install some requirements. (This might be more than actually needed)
As stated in the question we already have an LVM volume group
First we create and define a libvirt storage pool from that LVM volume group
Per default libvirt already has a virtual network configured. It is named default. In this example we will redefine that virtual network so that we can use it for PXE install.
The MAC addresses, 02:54:00:13:be:e4 and 02:52:2c:a3:11:42 seen above are just some random MAC addresses. (see the serverfault question: how to generate a random MAC address from the Linux command line)
The MAC address 02:54:00:13:be:e4 used above needs the configuration filename 01-02-54-00-13-be-e4. In other words prepend
01-
and convert:
into-
.Here we assumed that the kickstart file for virt1.example.com can be downloaded from http://www.example.com/kickstart-files/virt1.example.com.txt
Now we run
service libvirtd reload
. This seems to be required for the dnsmasq tftpserver to run properly.Now run virt-install to create the KVM guest virt1.example.com with 20 Gb disk space.
Now the graphical program
virt-viewer
will pop up an X-window. When you see "boot: " during the boot sequence, typeinstall
.A note about the virt-install command line options: Using
model=virtio
didn't work for me, but luckilymodel=e1000
worked just fine.