本来最先是在 Gentoo 上实现 KVM 的,后来又在 Debian 上玩了玩:http://blog.csdn.net/cenziboy/article/details/6957890
后来觉得还是有必要再总结总结,只当是复习罢了,于是乎出现了此文。
一 安装前准备
1. KVM需要硬件支持,并在BIOS中开启CPU虚拟化功能
2. 配置 kernel
kvm 模块
[*] Virtualization --->
--- Virtualization
<M> Kernel-based Virtual Machine (KVM) support
<M> KVM for Intel processors support #我是 intel CPU
< > KVM for AMD processors support
3. TUN/TAP 模块,桥接网络要用到
Device Drivers --->
[*] Network device support --->
<M> Universal TUN/TAP device driver support
Networking support --->
Networking options --->
<*> 802.1d Ethernet Bridging
<*> 802.1Q VLAN Support
4. 半虚拟化(可选,根据自己需求)
Processor type and features --->
[*] Paravirtualized guest support --->
[*] KVM paravirtualized clock
[*] KVM Guest support
-*- Enable paravirtualization code
[*] Paravirtualization layer for spinlocks
编译并安装内核(模块)
# make
# make install
# make modules_install
二 安装qemu
kvm是内核模块,用户无法直接使用。这里就要借助 qemu ( 也叫 kvm 的前段工具)来使用 kvm
1. 先看看 qemu-kvm :
# emerge -pv qemu-kvm
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild R ] app-emulation/qemu-kvm-0.15.1-r1 USE="aio alsa jpeg ncurses png pulseaudio sdl ssl vhost-net -bluetooth -brltty -curl -debug (-esd) -fdt -hardened -nss -q