This is a continuation from Installing Linux Kernal-Based Virtual Machine (KVM) on CentOS 5.4 Server (Part I)
Step 8: Prepare the Virtual Machine
Prepare a Installation Script for easier management.
a. For CentOS Virtual Machine
# vim kvm_centos5.4.sh
virt-install \ --connect qemu:///system \ --name centos5.4_n01 \ --vcpus=2 \ --ram 1024 \ --disk path=/nfs_shared/vms/centos5.4_n01.img,size=40, \ --cdrom=/nfs_shared/ISO/CentOS-5.4-x86_64-bin-DVD.iso \ --network=bridge:br0 \ --accelerate \ --vnc \ --noautoconsole \ --os-type=linux \ --os-variant=rhel5.4 \ --hvm
b. For Windows XP Machine
# vim kvm_winXp.sh
virt-install \ --connect qemu:///system \ --name winxp_n01 \ --vcpus=1 \ --ram 1024 \ --disk path=/nfs_shared/vms/winxp_n01.img,size=25, \ --cdrom=/nfs_shared/ISO/Windows_XP2.iso \ --network=bridge:br0 \ --accelerate \ --vnc \ --noautoconsole \ --os-type=windows \ --os-variant=winxp \ --hvm
Some notes:
- Do note that the disk path should be on a shared drive if you are planning to use “migration” from physical nodes to another physical node.
- noautoconsole -> No connection to it is started by default although you can make a connection to it via virt-manager.
- accelerate -> The VM will runin using kernel acceleration if available.
- os-type and os-variant -> Please check the man virt-install for more information on the exact paramters.
Step 9: Run the script
You should see something like this
Starting install... Creating storage file... | 40 GB 00:00 Creating domain... | 0 B 00:01 Domain installation still in progress. You can reconnect to the console to complete the installation process.
Step 10: Continue the installation through Virt-Manager Console.
Remember to start the libvert daemon first
# service libvertd start
If you are on the graphical console, just type
# virt-manager
you should be able to see the node name. double-clicked the node icon, you should be able to continue the rest of the installation