It took me a little while today to figure out how to do a text only install of a CentOS guest on KVM. Previously I had started the install using virt-install and then connected to the VNC console over SSH. This is a bit of a hassle though when all you want is a quick, text based install.
So here’s how.
Firstly all of my VMs live on LVM so create a virtual disk to hold the VM. I’m creating a 20G ‘partition’ in a volume group called kvm-storage. The logical volume is called host.demo.com.
Now download the CentOS install ISO. Either CD1 or the netinstall ISO should be fine –
Now we mount the ISO –
mount -o loop CentOS-5.5-x86_64-bin-1of8.iso /mnt/centos55/
Now we run the virt-install command. I suggest putting this command in a file and running it from there to make editing easier!
-n host.demo.com \
-r 512 \
-l /mnt/centos55/ \
-w bridge:br1 \
--disk path=/dev/kvm-storage/host.demo.com \
Here are the parts of the command above that allow for a text based install –
–nographics – tells KVM not to allocate a graphics console to the VM
-v – means we’re doing full virtualization
-l – sets the boot location to be the ISO we mounted earlier
–disk – sets the install destination disk to be the disk we created earlier
-x “console=ttyS0” – sets a kernel boot parameter telling CentOS to use ttyS0 as the console
Once this is done you should see the text based installation screens. This worked pretty well in putty, you are able to tell what menu options you are selecting. You won’t be able to use the mounted ISO for the actual installation media so I did a HTTP install, selecting one of the CentOS mirrors to do the install from (like – http://mirrors.manchester.icecolo.com/centos/5.5/os/x86_64/)
Once the install is complete and the VM rebooted you can access the console again by running –