View source for KVM
Jump to:
navigation
,
search
== Introduction == [Needed: disambiguation page for KVM See: [http://en.wikipedia.org/wiki/KVM Wikipedia: KVM] ] Kernel Virtual Machine - KVM is an Open-Source Virtualization package for Linux. See: [http://www.linux-kvm.org www.linux-kvm.org] Related page(s): [[OpenVZ]] === To Do === This page needs: * Intro section with pointers to useful docs * Installation Instructions as needed * Cookbook section == Documentation == * IBM Quick Start / Guide http://pic.dhe.ibm.com/infocenter/lnxinfo/v3r0m0/topic/liaai/kvminstall/liaaikvminstallstart.htm * Documents http://www.linux-kvm.org/page/Documents * KVM How-To's http://www.linux-kvm.org/page/HOWTO == Creating New KVM CentOS VMs == 1. create logical volume for new VM's base filesystem (/boot, 1G swap, /) <pre> lvcreate -L 10G -n vm.$name.root main </pre> 2. clone base VM into the new logical volume <pre> virt-clone -o centos_base -n $name -f /dev/mapper/main-vm.$name.root </pre> 3. create cdn logical volume <pre> lvcreate -L 500G -n vm.$name.cdn main </pre> 4. create additional swap volume if needed (base VM has 1G swap, an additional 4G is recommended for memory intensive applications) <pre> lvcreate -L 4G -n vm.$name.swap main </pre> 5. edit VM config. adjust memory, processors, etc. as necessary. add cdn (as vdb) and swap (as vdc) drives. <b>NOTE:</b> there's not a lot of memory to go around, be conservative. VMs support memory 'ballooning' which is a way to give additional memory on-demand and then reclaim it when it's freed. <memory> specifies the maximum amount of memory that the VM can use. <currentMemory> specifies the amount of memory that the VM boots with. If the two are the same, then memory ballooning is disabled. If $memory is greater than $currentMemory, the VM will start off with $currentMemory and be able to balloon on demand up to $memory. If the application is memory intensive, configure it with a small-ish $currentMemory and a larger $memory so that memory can float between VMs as needed. Try to keep VM applications memory efficient. <b>ALSO:</b> there are also so many processors, so be conservative there as well. Don't configure more than 2 processors for a VM. <pre> virsh edit $name </pre> 6. boot VM <pre> virsh start $name </pre> 7. log into VNC console as root 8. create cdn partition and filesystem, mount <pre> printf "n\np\n1\n\n\nt\n83\nw\n" | fdisk /dev/vdb mkfs.ext4 -L /cdn /dev/vdb1 printf "LABEL=/cdn /cdn ext4 nosuid,nodev,noatime 1 1\n" >> /etc/fstab mount /cdn </pre> 9. create swap partition and initialize <pre> printf "n\np\n1\n\n\nt\n82\nw\n" | fdisk /dev/vdc mkswap -L SWAP-vdc1 /dev/vdc1 printf "LABEL=SWAP-vdc1 swap swap defaults 0 0\n" >> /mnt/etc/fstab </pre> 10. fix eth1 configuration <pre> # on VM host, get eth1 mac address from output of: virsh dumpxml $name mv /etc/sysconfig/network-scripts/ifcfg-eth1.bak /etc/sysconfig/network-scripts/ifcfg-eth1 # replace mac address with that obtained from virsh dumpxml, replace IP with correct IP for the VM vi /etc/sysconfig/network-scripts/ifcfg-eth1 </pre> 11. remove unneeded eth0 backed up config <pre> rm /etc/sysconfig/network-scripts/ifcfg-eth0.bak </pre> 12. correct the VM IP in the BGP config <pre> # correct route-id IP, should be the VM's IP vi /etc/quagga/bgpd.conf </pre> 13. set the VM's host name <pre> # change the HOSTNAME value vi /etc/sysconfig/network </pre> 14. fix home directory location <pre> mv /home /cdn/users ln -s /cdn/users /home </pre> 15. reboot 16. log in as root via ssh 17. application-specific configuration (e.g. users, application packages, etc.)
Return to
KVM
.
Navigation menu
Personal tools
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
Actions
Search
Navigation
Main page
Community portal
Current events
Recent changes
Random page
Help
Toolbox
What links here
Related changes
Special pages
Page information