KVM+qemuCentOS6: Difference between revisions
Jump to navigation
Jump to search
(Created page with "KVM Centos6 http://www.howtoforge.com/how-to-install-kvm-and-libvirt-on-centos-6.2-with-bridged-networking http://centos.digitalcompass.net/centos/6.2/os/x86_64/ ---Grub -> vm...") |
No edit summary |
||
Line 3: | Line 3: | ||
http://centos.digitalcompass.net/centos/6.2/os/x86_64/ ---Grub -> vmlinuz initrd=initrd.img console=ttyS0,115200 text | http://centos.digitalcompass.net/centos/6.2/os/x86_64/ ---Grub -> vmlinuz initrd=initrd.img console=ttyS0,115200 text | ||
< | <syntaxhighlight lang=bash> | ||
# yum install qemu-kvm | |||
# chkconfig libvirtd on | # chkconfig libvirtd on | ||
# groupadd libvirt; usermod -a -G drew | # groupadd libvirt; usermod -a -G drew | ||
-> fix policykit permissions on /dev/kvm | -> fix policykit permissions on /dev/kvm | ||
# groupadd tun; chown root:tun /dev/net/tun; usermod -a -G tun drew</ | # groupadd tun; chown root:tun /dev/net/tun; usermod -a -G tun drew | ||
</syntaxhighlight> | |||
< | <syntaxhighlight lang=bash> | ||
# cat /etc/sysconfig/network-scripts/ifcfg-eth0; | |||
DEVICE="eth0" | DEVICE="eth0" | ||
HWADDR="BC:30:5B:DF:E7:59" | HWADDR="BC:30:5B:DF:E7:59" | ||
ONBOOT="yes" | ONBOOT="yes" | ||
BRIDGE=br0</ | BRIDGE=br0 | ||
</syntaxhighlight> | |||
< | <syntaxhighlight lang=bash> | ||
# cat /etc/sysconfig/network-scripts/ifcfg-br0; | |||
DEVICE="br0" | DEVICE="br0" | ||
TYPE=Bridge | TYPE=Bridge | ||
Line 22: | Line 27: | ||
BOOTPROTO=static | BOOTPROTO=static | ||
IPADDR=96.31.87.178 | IPADDR=96.31.87.178 | ||
NETMASK=255.255.255.192</ | NETMASK=255.255.255.192 | ||
</syntaxhighlight> | |||
< | <syntaxhighlight lang=bash> | ||
$ virt-install --name drew01 --ram 512 --vcpus=1 --arch=x86_64 --hvm --os-type=linux --nographics --disk path=/home/aholt/drew.img,size=5,sparse=true --cdrom CentOS-6.2-x86_64-netinstall.iso | |||
$ virt-install --name drew01 --ram 512 --vcpus=1 --arch=x86_64 --hvm --os-type=linux --nographics --import --disk path=/home/aholt/drew.img | $ virt-install --name drew01 --ram 512 --vcpus=1 --arch=x86_64 --hvm --os-type=linux --nographics --import --disk path=/home/aholt/drew.img | ||
$ virsh --connect=qemu:///system start drew01 | $ virsh --connect=qemu:///system start drew01 | ||
$ virsh autostart drew01</ | $ virsh autostart drew01 | ||
</syntaxhighlight> | |||
< | <syntaxhighlight lang=bash> | ||
$ virt-install --name connor01 --ram 512 --vcpus=1 --arch=x86_64 --hvm --os-type=linux --disk path=/home/cpenhale/cpenhale.img,size=5,sparse=true --cdrom pfSense-2.0.1-RELEASE-amd64.iso --hvm --vnc --noautoconsole | |||
</syntaxhighlight> | |||
< | <syntaxhighlight lang=bash> | ||
$ virsh -c qemu+ssh://[email protected]/system sysinfo | |||
$ virsh -c qemu:///system console drew01 | $ virsh -c qemu:///system console drew01 | ||
$ virsh -c qemu:///system sysinfo | $ virsh -c qemu:///system sysinfo | ||
Line 39: | Line 50: | ||
$ virsh destroy <vm> # hard shutdown, essentially pulling the power cord | $ virsh destroy <vm> # hard shutdown, essentially pulling the power cord | ||
$ virsh suspend <vm> | $ virsh suspend <vm> | ||
$ virsh resume <vm></ | $ virsh resume <vm> | ||
</syntaxhighlight> | |||
Instead of allowing virt-manager to create a new drive image, simply direct it to use the image you created in the previous step. | Instead of allowing virt-manager to create a new drive image, simply direct it to use the image you created in the previous step. | ||
3. Create the overlay: | 3. Create the overlay: | ||
< | <syntaxhighlight lang=bash> | ||
$ qemu-img create -f qcow2 -b <image name>.qcow2 <image name>.ovl | |||
</syntaxhighlight> |
Revision as of 00:58, 25 January 2018
KVM Centos6 http://www.howtoforge.com/how-to-install-kvm-and-libvirt-on-centos-6.2-with-bridged-networking http://centos.digitalcompass.net/centos/6.2/os/x86_64/ ---Grub -> vmlinuz initrd=initrd.img console=ttyS0,115200 text
# yum install qemu-kvm
# chkconfig libvirtd on
# groupadd libvirt; usermod -a -G drew
-> fix policykit permissions on /dev/kvm
# groupadd tun; chown root:tun /dev/net/tun; usermod -a -G tun drew
# cat /etc/sysconfig/network-scripts/ifcfg-eth0;
DEVICE="eth0"
HWADDR="BC:30:5B:DF:E7:59"
ONBOOT="yes"
BRIDGE=br0
# cat /etc/sysconfig/network-scripts/ifcfg-br0;
DEVICE="br0"
TYPE=Bridge
DELAY=0
ONBOOT="yes"
BOOTPROTO=static
IPADDR=96.31.87.178
NETMASK=255.255.255.192
$ virt-install --name drew01 --ram 512 --vcpus=1 --arch=x86_64 --hvm --os-type=linux --nographics --disk path=/home/aholt/drew.img,size=5,sparse=true --cdrom CentOS-6.2-x86_64-netinstall.iso
$ virt-install --name drew01 --ram 512 --vcpus=1 --arch=x86_64 --hvm --os-type=linux --nographics --import --disk path=/home/aholt/drew.img
$ virsh --connect=qemu:///system start drew01
$ virsh autostart drew01
$ virt-install --name connor01 --ram 512 --vcpus=1 --arch=x86_64 --hvm --os-type=linux --disk path=/home/cpenhale/cpenhale.img,size=5,sparse=true --cdrom pfSense-2.0.1-RELEASE-amd64.iso --hvm --vnc --noautoconsole
$ virsh -c qemu+ssh://[email protected]/system sysinfo
$ virsh -c qemu:///system console drew01
$ virsh -c qemu:///system sysinfo
$ virsh undefine <vm>
$ virsh start <vm>
$ virsh shutdown <vm> # graceful shutdown
$ virsh destroy <vm> # hard shutdown, essentially pulling the power cord
$ virsh suspend <vm>
$ virsh resume <vm>
Instead of allowing virt-manager to create a new drive image, simply direct it to use the image you created in the previous step.
3. Create the overlay:
$ qemu-img create -f qcow2 -b <image name>.qcow2 <image name>.ovl