个人笔记本配置kvm的记录

重装了自己的本子,本子上装了双系统,安装虚拟化是为了能同时使用本子上的两个系统,安装了virtio。这里记录为windows XP安装virtio的方法。最重要的是两个部分,一个是磁盘的驱动,一个是网卡的驱动。需要去下载对应的安装包。http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/这个地址下载,步骤如下:

1. 下载win-virtio驱动包.
可以到下载iso格式的光盘镜像,之后挂载到操作系统,或者解压目录到xp系统

2. 关闭windows系统

3. 创建一个临时磁盘镜像,我们之后会将它作为virtio磁盘添加到windows(为的是让windows能检查到新硬件,然后安装驱动)这个镜像用完后可以删掉。

qemu-img create -f qcow2 tmp.qcow2 100M

4.使用如下命令启动(配置磁盘的驱动)

sudo kvm -drive file=/dev/sda  -localtime   -m 1500 \
-boot d -vga std -drive file=/home/skyer/kvm/tmp.img,if=virtio
启动后,windows会提示安装新硬件,通过向导找到指定的visostor下的对应操作系统版本
的驱动。安装完即可。

4.使用如下命令启动(配置网卡的驱动)
sudo kvm -drive file=/dev/sda,if=virtio -net nic,model=virtio \
-localtime -cpu host -smp 2 -m 1024 -boot d -vga std
注意指定网络和磁盘的模式。

5.通过以上安装,已经可以使用virtio方式启动本机双系统了。

6.配置kvm的显卡驱动
下载vbempg.zip并解压,启动kvm虚拟机后,在设备管理器中有标准VGA显卡处于未知驱动
更新驱动程序即可。
将vbempg.zip copy到usb盘时,需要使用usb设备,如果要让虚拟机启动使用usb
则使用以下命令找到对应的usb设备即可
lsusb |awk '$NF !~ /[Hh]ub$/ {idx = index($0, "ID"); printf " -usbdevice host:%s", substr($0, idx + 3, 9);}'
附录:
挂载usb设备的启动方式
sudo kvm -drive file=/dev/sda,if=virtio -net nic,model=virtio -localtime -cpu host -smp 2 -m  1024 -boot d -vga std  -usbdevice host:0930:6545

6.配置双系统的网络互相访问。(使用了如下代码)
该部分是为了解决双系统下文件的共享,这是使用双系统最主要的问题。
(windows最烦人的就是大量的文档都是doc或者docx)
sudo kvm -drive file=/dev/sda,if=virtio -net nic,model=virtio \
-localtime -cpu host -smp 2 -m 1024 -boot d -vga std -net user,hostfwd=tcp::3389-:3389
结果是虚拟机里自动获取到了10.0.2.15的ip,和主操作系统共享了网卡使用,如果能上网,则共享上网。

sudo qemu-system-x86_64 -enable-kvm -drive file=/dev/sda,if=virtio 、
-net nic,model=virtio -localtime -smp 2 -m 2048 -boot d -vga std -net user,hostfwd=tcp::3389-:3389

7.解决文件共享的问题
可以从虚拟机中访问外面主操作系统,可用ssh 10.0.2.2 即可将文件copy到虚拟机中。

8.kvm全屏的快捷键
ctl+alt+F 全屏



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/759027/viewspace-753892/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/759027/viewspace-753892/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Qemu 1.0.1 Windows QEMU emulator version 1.0.1, Copyright (c) 2003-2008 Fabrice Bellard usage: qemu [options] [disk_image] 'disk_image' is a raw hard disk image for IDE hard disk 0 Standard options: -h or -help display this help and exit -version display version information and exit -machine [type=]name[,prop[=value][,...]] selects emulated machine (-machine ? for list) property accel=accel1[:accel2[:...]] selects accelerator supported accelerators are kvm, xen, tcg (default: tcg) -cpu cpu select CPU (-cpu ? for list) -smp n[,maxcpus=cpus][,cores=cores][,threads=threads][,sockets=sockets] set the number of CPUs to 'n' [default=1] maxcpus= maximum number of total cpus, including offline CPUs for hotplug, etc cores= number of CPU cores on one socket threads= number of threads on one CPU core sockets= number of discrete sockets in the system -numa node[,mem=size][,cpus=cpu[-cpu]][,nodeid=node] -fda/-fdb file use 'file' as floppy disk 0/1 image -hda/-hdb file use 'file' as IDE hard disk 0/1 image -hdc/-hdd file use 'file' as IDE hard disk 2/3 image -cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master) -drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i] [,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off] [,cache=writethrough|writeback|none|directsync|unsafe][,format=f] [,serial=s][,addr=A][,id=name][,aio=threads|native] [,readonly=on|off] use 'file' as a drive image -set group.id.arg=value set parameter for item of type i.e. -set drive.$id.file=/path/to/image -global driver.property=value set a global default for a driver property -mtdblock file use 'file' as on-board Flash memory image -sd file use 'file' as SecureDigital card image -pflash file use 'file'

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值