zhouln 发表于 2015-10-10 10:34:58

how to tell if you can use kvm


kvm


Check out https://help.ubuntu.com/community/KVM for more updated and complete information
on installing KVM on Ubuntu.
kvm is qemu plus some great kernel level stuff for VT enabled CPUs.
Some rough notes:-



How to tell if you can use kvm




Intel CPU




grep vmx /proc/cpuinfo

However, if you have an Intel CPU it's possible that your computer manufacturer may have turned off VT in the BIOS. See below for more info.


AMD CPU




grep svm /proc/cpuinfo

On some Gigabyte motherboards it is turned off in the BIOS if you use "Load safe defaults" (GiBy M61SME-S2
nF405 RLVSM bios < F7)
If you see something you have it, if you don't you don't.



Install it




sudo apt-get install kvm qemu




Load the modules




sudo modprobe kvm




Load Intel module


If you have an Intel CPU


sudo modprobe kvm-intel

Note if you get this when you load the module then it may mean VT is switched off in the BIOS.


$ sudo modprobe kvm-intel
FATAL: Error inserting kvm_intel (/lib/modules/2.6.20-15-generic/kernel/drivers/kvm/kvm-intel.ko): Operation not supported

Typing dmesg you may find the following at the end:-


kvm: disabled by bios


[*]

http://onexin.iyunv.com/source/plugin/onexin_bigdata/https://wiki.ubuntu.com/IconsPage?action=AttachFile&do=get&target=IconTip.png You might need
to enable the virtualization setting in the BIOS. Each BIOS is different and it can be difficult to find (it may be in the &quot;Advanced&quot; section or under &quot;CPU&quot; or &quot;Security&quot;). You may also need to power shutdown for the changes to take effect (some bios will
do this automatically).






Load AMD module


If you have an AMD CPU


sudo modprobe kvm-amd




Add yourself to the group




sudo addgroup `whoami` kvm




Create a KVM disk image


This example makes a virtual disk that grows on the fly:

qemu-img create -f qcow2 virtualdisk.img 10G




Start the emulator


For example:-


kvm -hda virtualdisk.img -cdrom cdrom.iso -m 256 -net nic -net user -soundhw all




Load the modules more permanently


Once you know it all works, edit /etc/modules and add the following two lines


kvm
kvm-intel

or

kvm
kvm-amd
页: [1]
查看完整版本: how to tell if you can use kvm