作者:速度向前迈进 | 来源:互联网 | 2014-05-27 21:13
首先编译Kernel如果你用选择相应你CPU的选项LinuxKernelConfiguration:EnableKVM[*]Virtualization------Virtualization*]Kernel-basedVirtualMachine(KVM)supportKVMforIntelprocessorssup
首先编译Kernel 如果你用选择相应你CPU的选项
Linux Kernel Configuration:Enable KVM
[*] Virtualization --->
--- Virtualization
<*]> Kernel-based Virtual Machine (KVM) support
< > KVM for Intel processors support
< > KVM for AMD processors support
Linux Kernel Configuration:Enable bridging, TUN and VLAN
Device Drivers --->
[*] Network device support --->
<*> Universal TUN/TAP device driver support
Networking support --->
Networking options --->
<*> 802.1d Ethernet Bridging
<*> 802.1Q VLAN Support
好了可以安装了。我的Gentoo用的是VMware图形支持不错。Qemu-KVM在Archlinux下。不管是Arch还是Gentoo,基本操作都是一样的。
安装
sudo pacman -S qemu-kvm
加入KVM组
sudo gpasswd -a yourname kvm
首先建立磁盘文件(安装Winxp 3-4G足够了,如果不够,你自己设定你想要的值)
qemu-img create -f raw winxp.img 3G
现在安装WinXP
传统安装方式(安装比较慢):
qemu-kvm -hda winxp.img -cdrom
../tmp/winxp/en_winxp_pro_with_sp3_vl.iso -m 2G -boot d
使用cache和virtio安装方式(安装比较快):
qemu-kvm -enable-kvm -drive
file=winxp.img,cache=writeback,if=virtio,boot=on -m 2G -cdrom
../tmp/winxp/en_winxp_pro_with_sp3_vl.iso -fda
drivers/virtio-win-1.1.11-0.vfd -boot d
安装过程中按F6,点击这里看安装virtio的驱动.
http://www.linux-kvm.org/page/WindowsGuestDrivers/viostor/installation
这里引用这里的教程:http://subting.blogspot.com/2010/04/qemu-kvm.html,
不过文中有个错误就是最后应该是soundhw
qemu-kvm -enable-kvm -m 2G -drive file=winxp.img,cache=writeback
-usbdevice tablet -net nic -net user -localtime -vnc
127.0.0.1:0 -daemonize -nographic -redir tcp:3389::3389 -soundhw
all
-net nic -net user 使用简单网络访问,也就是nat方式,
-localtime 时间同步,
-vnc 127.0.0.1:0 打开远程桌面支持(不是windows的远程桌面),
-daemonize 后台运行,
-nographic 不显示图形界面,
-redir tcp:3389::3389 把虚拟机的远程桌面服务器端口映射到宿主机的端口,
-soundhw all启用声卡。
安装tightvnc
sudo pacman -S tightvnc
然后用
vncviewer 127.0.0.1:0
可以看到桌面
rdesktop远程登录(在虚拟机中打开windows自己的远程桌面,然后给用户设定密码)
rdesktop localhost:3389 -u 用户名 -p 密码 -g 分辨率 -r sound:local
开启远程登录24bit颜色 (原文地址:http://liggyman.com/?p=34)
To change this setting on the local machine you can follow these
steps:
Open up the Group Policy editor, by going Start -> Run… and
type in MMC.
Add the Group Policy snap-in by going to File -> Add/Remove
Snap-in -> Add -> Group Policy Object Editor -> Add ->
Finish (Local Machine) -> Close -> Ok.
Now navigate in the Group Policy Object Editor to Local Computer
Policy\Computer Configuration\Administrative Templates\Windows
Components\Terminal Services and double-click on the ‘Limit maximum
Color Depth’ object.
Click on ‘Enable’ and choose either ‘Client Compatible’ or
24-bit
载入raw格式镜像文件
sudo mount winxp.img /mnt/windows -o loop,offset=32256