Formatting code for LinuxKVM
{{parent page="HomePage"}}
===Running vm on KVM===
First I convert my virtualbox disk image to qcow2.
%%
VBoxManage clonehd --format RAW w7.vdi w7.raw
qemu-img convert -f raw w7.raw -O qcow2 w7.qcow2
%%
Then follow the official doc to install kvm and create my first kvmvm
https://help.ubuntu.com/community/KVM
====Create disk image in qed format====
qed is supposed to be faster. To create, run the following
%%
qemu-img create -fqed cent6.qed 12G
%%
===Bridge Networking===
%%
aptitude install qemu libcap2-bin bridge-utils
setcap cap_net_admin=ei /usr/bin/qemu-system-x86_64
%%
/etc/security/capability.conf
%%
cap_net_admin MY-USER-NAME
%%
Stop networking
%%
invoke-rc.d networking stop
%%
Edit /etc/network/interfaces
Replace the name of primary interface with br0, then create it back with the following (assuming it's eth0)
%%
auto br0
iface br0 inet static
address 192.168.x.1
network 192.168.x.0
netmask 255.255.255.0
broadcast 192.168.x.255
gateway 192.168.x.254
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
auto eth0
iface eth0 inet manual
%%
And then restart networking
%%
/etc/init.d/networking restart
%%
===Running vm on KVM===
First I convert my virtualbox disk image to qcow2.
%%
VBoxManage clonehd --format RAW w7.vdi w7.raw
qemu-img convert -f raw w7.raw -O qcow2 w7.qcow2
%%
Then follow the official doc to install kvm and create my first kvmvm
https://help.ubuntu.com/community/KVM
====Create disk image in qed format====
qed is supposed to be faster. To create, run the following
%%
qemu-img create -fqed cent6.qed 12G
%%
===Bridge Networking===
%%
aptitude install qemu libcap2-bin bridge-utils
setcap cap_net_admin=ei /usr/bin/qemu-system-x86_64
%%
/etc/security/capability.conf
%%
cap_net_admin MY-USER-NAME
%%
Stop networking
%%
invoke-rc.d networking stop
%%
Edit /etc/network/interfaces
Replace the name of primary interface with br0, then create it back with the following (assuming it's eth0)
%%
auto br0
iface br0 inet static
address 192.168.x.1
network 192.168.x.0
netmask 255.255.255.0
broadcast 192.168.x.255
gateway 192.168.x.254
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
auto eth0
iface eth0 inet manual
%%
And then restart networking
%%
/etc/init.d/networking restart
%%