下载安装:

wget http://wiki.qemu-project.org/download/qemu-2.0.0.tar.bz2
tar xjvf qemu-2.0..tar.bz2                                  //git clone git://git.qemu-project.org/qemu.git
cd qemu-2.0.
./configure --enable-kvm --enable-debug --enable-vnc --enable-werror --target-list="x86_64-softmmu"
make -j8
make install
说明:

--enable-kvm:编译KVM模块,使QEMU可以利用KVM来访问硬件提供的虚拟化服务。
--enable-vnc:启用VNC。
--enalbe-werror:编译时,将所有的警告当作错误处理。
--target-list:选择目标机器的架构。默认是将所有的架构都编译,但为了更快的完成编译,指定需要的架构即可。
[root@server-mysql qemu-2.0.]# ./configure --help

Usage: configure [options]
Options: [defaults in brackets after descriptions] Standard options:
--help print this message
--prefix=PREFIX install in PREFIX [/usr/local]
--interp-prefix=PREFIX where to find shared libraries, etc.
use %M for cpu name [/usr/gnemul/qemu-%M]
--target-list=LIST set target list (default: build everything)
Available targets: aarch64-softmmu alpha-softmmu
arm-softmmu cris-softmmu i386-softmmu lm32-softmmu
m68k-softmmu microblazeel-softmmu microblaze-softmmu
mips64el-softmmu mips64-softmmu mipsel-softmmu
mips-softmmu moxie-softmmu or32-softmmu
ppc64-softmmu ppcemb-softmmu ppc-softmmu
s390x-softmmu sh4eb-softmmu sh4-softmmu
sparc64-softmmu sparc-softmmu unicore32-softmmu
x86_64-softmmu xtensaeb-softmmu xtensa-softmmu
aarch64-linux-user alpha-linux-user armeb-linux-user
arm-linux-user cris-linux-user i386-linux-user
m68k-linux-user microblazeel-linux-user
microblaze-linux-user mips64el-linux-user
mips64-linux-user mipsel-linux-user mips-linux-user
mipsn32el-linux-user mipsn32-linux-user
or32-linux-user ppc64abi32-linux-user
ppc64-linux-user ppc-linux-user s390x-linux-user
sh4eb-linux-user sh4-linux-user
sparc32plus-linux-user sparc64-linux-user
sparc-linux-user unicore32-linux-user
x86_64-linux-user Advanced options (experts only):
--source-path=PATH path of source code [/root/qemu-2.0.]
--cross-prefix=PREFIX use PREFIX for compile tools []
--cc=CC use C compiler CC [cc]
--iasl=IASL use ACPI compiler IASL [iasl]
--host-cc=CC use C compiler CC [cc] for code run at
build time
--cxx=CXX use C++ compiler CXX [c++]
--objcc=OBJCC use Objective-C compiler OBJCC [cc]
--extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
--extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
--make=MAKE use specified make [make]
--install=INSTALL use specified install [install]
--python=PYTHON use specified python [python -B]
--smbd=SMBD use specified smbd [/usr/sbin/smbd]
--static enable static build [no]
--mandir=PATH install man pages in PATH
--datadir=PATH install firmware in PATH/qemu
--docdir=PATH install documentation in PATH/qemu
--bindir=PATH install binaries in PATH
--libdir=PATH install libraries in PATH
--sysconfdir=PATH install config in PATH/qemu
--localstatedir=PATH install local state in PATH (set at runtime on win32)
--with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [/qemu]
--enable-modules enable modules support
--enable-debug-tcg enable TCG debugging
--disable-debug-tcg disable TCG debugging (default)
--enable-debug-info enable debugging information (default)
--disable-debug-info disable debugging information
--enable-debug enable common debug build options
--enable-sparse enable sparse checker
--disable-sparse disable sparse checker (default)
--disable-strip disable stripping binaries
--disable-werror disable compilation abort on warning
--disable-stack-protector disable compiler-provided stack protection
--disable-sdl disable SDL
--enable-sdl enable SDL
--with-sdlabi select preferred SDL ABI 1.2 or 2.0
--disable-gtk disable gtk UI
--enable-gtk enable gtk UI
--disable-virtfs disable VirtFS
--enable-virtfs enable VirtFS
--disable-vnc disable VNC
--enable-vnc enable VNC
--disable-cocoa disable Cocoa (Mac OS X only)
--enable-cocoa enable Cocoa (default on Mac OS X)
--audio-drv-list=LIST set audio drivers list:
Available drivers: oss alsa sdl esd pa fmod
--block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
--block-drv-rw-whitelist=L
set block driver read-write whitelist
(affects only QEMU, not qemu-img)
--block-drv-ro-whitelist=L
set block driver read-only whitelist
(affects only QEMU, not qemu-img)
--disable-xen disable xen backend driver support
--enable-xen enable xen backend driver support
--disable-xen-pci-passthrough
--enable-xen-pci-passthrough
--disable-brlapi disable BrlAPI
--enable-brlapi enable BrlAPI
--disable-vnc-tls disable TLS encryption for VNC server
--enable-vnc-tls enable TLS encryption for VNC server
--disable-vnc-sasl disable SASL encryption for VNC server
--enable-vnc-sasl enable SASL encryption for VNC server
--disable-vnc-jpeg disable JPEG lossy compression for VNC server
--enable-vnc-jpeg enable JPEG lossy compression for VNC server
--disable-vnc-png disable PNG compression for VNC server (default)
--enable-vnc-png enable PNG compression for VNC server
--disable-vnc-ws disable Websockets support for VNC server
--enable-vnc-ws enable Websockets support for VNC server
--disable-curses disable curses output
--enable-curses enable curses output
--disable-curl disable curl connectivity
--enable-curl enable curl connectivity
--disable-fdt disable fdt device tree
--enable-fdt enable fdt device tree
--disable-bluez disable bluez stack connectivity
--enable-bluez enable bluez stack connectivity
--disable-slirp disable SLIRP userspace network connectivity
--disable-kvm disable KVM acceleration support
--enable-kvm enable KVM acceleration support
--disable-rdma disable RDMA-based migration support
--enable-rdma enable RDMA-based migration support
--enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
--enable-system enable all system emulation targets
--disable-system disable all system emulation targets
--enable-user enable supported user emulation targets
--disable-user disable all user emulation targets
--enable-linux-user enable all linux usermode emulation targets
--disable-linux-user disable all linux usermode emulation targets
--enable-bsd-user enable all BSD usermode emulation targets
--disable-bsd-user disable all BSD usermode emulation targets
--enable-guest-base enable GUEST_BASE support for usermode
emulation targets
--disable-guest-base disable GUEST_BASE support
--enable-pie build Position Independent Executables
--disable-pie do not build Position Independent Executables
--fmod-lib path to FMOD library
--fmod-inc path to FMOD includes
--oss-lib path to OSS library
--enable-uname-release=R Return R for uname -r in usermode emulation
--cpu=CPU Build for host CPU [x86_64]
--disable-uuid disable uuid support
--enable-uuid enable uuid support
--disable-vde disable support for vde network
--enable-vde enable support for vde network
--disable-netmap disable support for netmap network
--enable-netmap enable support for netmap network
--disable-linux-aio disable Linux AIO support
--enable-linux-aio enable Linux AIO support
--disable-cap-ng disable libcap-ng support
--enable-cap-ng enable libcap-ng support
--disable-attr disables attr and xattr support
--enable-attr enable attr and xattr support
--disable-blobs disable installing provided firmware blobs
--enable-docs enable documentation build
--disable-docs disable documentation build
--disable-vhost-net disable vhost-net acceleration support
--enable-vhost-net enable vhost-net acceleration support
--enable-trace-backend=B Set trace backend
Available backends: nop, stderr, dtrace, simple, ust, ftrace
--with-trace-file=NAME Full PATH,NAME of file to store traces
Default:trace-<pid>
--disable-spice disable spice
--enable-spice enable spice
--enable-rbd enable building the rados block device (rbd)
--disable-libiscsi disable iscsi support
--enable-libiscsi enable iscsi support
--disable-libnfs disable nfs support
--enable-libnfs enable nfs support
--disable-smartcard-nss disable smartcard nss support
--enable-smartcard-nss enable smartcard nss support
--disable-libusb disable libusb (for usb passthrough)
--enable-libusb enable libusb (for usb passthrough)
--disable-usb-redir disable usb network redirection support
--enable-usb-redir enable usb network redirection support
--enable-lzo enable the support of lzo compression library
--enable-snappy enable the support of snappy compression library
--disable-guest-agent disable building of the QEMU Guest Agent
--enable-guest-agent enable building of the QEMU Guest Agent
--with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
--with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
--disable-seccomp disable seccomp support
--enable-seccomp enables seccomp support
--with-coroutine=BACKEND coroutine backend. Supported options:
gthread, ucontext, sigaltstack, windows
--disable-coroutine-pool disable coroutine freelist (worse performance)
--enable-coroutine-pool enable coroutine freelist (better performance)
--enable-glusterfs enable GlusterFS backend
--disable-glusterfs disable GlusterFS backend
--enable-gcov enable test coverage analysis with gcov
--gcov=GCOV use specified gcov [gcov]
--enable-tpm enable TPM support
--disable-libssh2 disable ssh block device support
--enable-libssh2 enable ssh block device support
--disable-vhdx disables support for the Microsoft VHDX image format
--enable-vhdx enable support for the Microsoft VHDX image format
--disable-quorum disable quorum block filter support
--enable-quorum enable quorum block filter support

命令行创建及启动虚拟机

1.使用qemu-img创建虚拟机镜像。虚拟机镜像用来模拟虚拟机的硬盘,在启动虚拟机之前需要创建镜像文件。

qemu-img create -f qcow2 fedora.img 1G
fedora.img
-f选项用于指定镜像的格式,qcow2格式是QEMU最常用的镜像格式,采用来写时复制技术来优化性能。fedora.img是镜像文件的名字,10G是镜像文件大小。镜像文件创建完成后,可使用qemu-system-x86来启动x86架构的虚拟机

安装KVM模块.加速虚拟机

检查KVM是否可用:

QEMU使用KVM来提升虚拟机性能,如果不启用KVM会导致性能损失。要使用KVM,首先要检查硬件是否有虚拟化支持:

grep -E 'vmx|svm' /proc/cpuinfo

如果有输出则表示硬件有虚拟化支持。其次要检查kvm模块是否已经加载:

[root@server]lsmod | grep kvm
kvm_intel
kvm kvm_intel
如果kvm_intel/kvm_amd、kvm模块被显示出来,则kvm模块已经加载。
最好要确保qemu在编译的时候使能了KVM,即在执行configure脚本的时候加入了–enable-kvm选项。
启动虚拟机安装操作系统
执行下面的命令启动带有cdrom的虚拟机:

[root@server-mysql ~]# qemu-system-x86_64 -m 50 fedora.img -cdrom ./ReactOS-LiveCD.iso
-m 指定虚拟机内存大小,默认单位是MB,
-enable-kvm使用KVM进行加速,
-cdrom添加fedora的安装镜像。可在弹出的窗口中操作虚拟机,安装操作系统,安装完成后重起虚拟机便会从硬盘(fedora.img)启动。
之后再启动虚拟机只需要执行:
[root@server-mysql ~]#qemu-system-x86_64 -m 50m fedora.img

图形官理界面:virt-manager

Minimum version requirements of major components:

  python >= 2.7
gtk3 >= 3.14
libvirt-python >= 0.6.
pygobject3 >= 3.14
libosinfo >= 0.2.10 安装:
python setup.py install http://blog.csdn.net/reblue520/article/details/51456848

使用QEMU创建虚拟机的更多相关文章

  1. Qemu创建KVM虚拟机内存初始化流程

    转载请注明:[转载自博客xelatex KVM],并附本文链接.谢谢. [注]文章中采用的版本: Linux-3.11,https://www.kernel.org/pub/linux/kernel/ ...

  2. openstack学习(三)创建虚拟机

    1 , 用图形管理界面创建虚拟机 #virt-manager    //打开图形管理界面 配置文件一般存放于/etc/libvirt/qemu 然后按照提示一步步安装即可,网络连接方式改为桥接 导出创 ...

  3. QEMU-KVM自己主动创建虚拟机,以指定IP构造

    正在使用qemu不能指定创建虚拟机的过程IP住址,然而,在实际应用中,我们需要有一台虚拟机IP住址,不是人为的虚拟机操作系统配置. 于qemu虚拟机技术文档(http://qemu.weilnetz. ...

  4. 用OpenStack界面轻松创建虚拟机的你,看得懂虚拟机启动的这24个参数么?

    看这篇文章之前,保证看过以下文章: 我是虚拟机内核我困惑?! Qemu,KVM,Virsh傻傻的分不清 裸用KVM创建虚拟机,体验virtualbox为你做的10件事情 大家从OpenStack页面上 ...

  5. virsh命令来创建虚拟机

    virsh命令来创建虚拟机步骤 (1)生成硬盘镜像文件: 格式:raw或qcow2 # qemu-img create -f raw fdisk.img 10G qemu-img convert re ...

  6. qemu创建vm和vcpu进入kvm的流程

    kvm是一个内核模块,它实现了一个/dev/kvm的字符设备来与用户进行交互,通过调用一系列ioctl函数可以实现qemu和kvm之间的切换. 1.qemu发起KVM_CREATE_VM的ioctl创 ...

  7. KVM初探之一--存储池与存储卷,使用virt-install创建虚拟机

    在机器上装了一个Centos6.2用来测试KVM,对比Windows下的VMware worstation,KVM功能强大,定制性高,只要入了门,绝对是功能强大.用来作云计算不错.不过就是操作性差了点 ...

  8. 创建虚拟机流程nova

    这篇博文借鉴于http://www.cnblogs.com/yjbjingcha/p/6977741.html,感谢博友提供. 本文试图具体地描写叙述openstack创建虚拟机的完整过程.从用户发起 ...

  9. kvm介绍、安装及创建虚拟机

    kvm虚拟化介绍 一.虚拟化分类 1.虚拟化,是指通过虚拟化技术将一台计算机虚拟为多台逻辑计算机.在一台计算机上同时运行多个逻辑计算机,每个逻辑计算机可运行不同的操作系统,并且应用程序都可以在相互独立 ...

随机推荐

  1. python 重载 __hash__ __eq__

    __author__ = 'root' from urlparse import urlparse class host_news(): def __init__(self, id, url): se ...

  2. [刷机教程] 三星Note8 N5100不卡屏的唯一解决办法--落雨刷机教程

    首先我自己写了一个word,在附件里.大概23页,图文并茂.附带三星NOTE8 N5100 MD2下载包 刷机要谨慎啊,小伙伴们. 刷机教程已经上传到我本人的网站:点击进入去看吧.和word一样. h ...

  3. Maven安装与更新

    Maven是Apache组织中的一个颇为成功的开源项目,主要服务于基于Java平 台的项目构建.依赖管理和项目信息管理: 1) Maven是跨平台的,在Windows.Linux和Mac上都可以使用: ...

  4. Gartner 如何看 RASP 和 WAF?

    在这个计算机网络飞速发展的网络时代里,新兴的网络威胁正在不断「侵蚀」着的应用程序和核心数据的安全,各种繁杂的防护手段也随之接踵而来.众所周知,Gartner 是全球最具权威的 IT 研究与顾问咨询公司 ...

  5. asp.net 163邮件发送

    <table id="> <tr> <td style="width: 393px"> 收信:<asp:TextBox ID=. ...

  6. 四种必须知道的Android屏幕自适应解决方案

    一.细说layout_weight     目前最为推荐的Android多屏幕自适应解决方案.     该属性的作用是决定控件在其父布局中的显示权重,一般用于线性布局中.其值越小,则对应的layout ...

  7. CCS3.3之DM642开发环境建立

    使用的仿真器是SEED-XDSUSB2.0/5V. 之前用的是CCS2.2,换成了CCS3.3的. 1.安装CCS3.3.38.在我安装完后,并没有急着升级,升级的程序是SR12_CCS_v3.3_S ...

  8. DELL笔记本拆机添加内存条

    在笔记本后面拧开7个螺丝 然后打开后盖 掰开卡口,内存条会弹出,此时按住内存条两侧的缺口往外用力就可以拔出内存条. 装入内存条时,先插入内存条,按下即可.

  9. FileZilla 425 Can't open data connection

    FileZilla 425 Can't open data connection WIN 2008 SERVER+FileZilla FTP Server,FTP端口:2013 防火墙中已允许FTP ...

  10. Devexpress之DateEdit学习,可选择日期时 zt

    DateEdit默认是是值只可以选择日期的,下面就来看看怎么设置可以选择时间. 代码如下. 设置以下属性 dateEdit1.Properties.VistaDisplayMode = DevExpr ...