下载安装:

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. VPS用LNMP安装WordPress

    前言 前几天,朋友手头上有一个空闲的vps,256M内存,我决定拿来玩一下.经过一番思考,还是用来挂站吧.然后看是CentOS6系统,果断决定用从来没玩过的LNMP.于是,百度.谷歌找教程,好多教程都 ...

  2. PADS故障解决

    1. 点击PADS后就会出现以下: "The directory pointed by the FileDir INI file entry cannot be found.Aborting ...

  3. Aircrack-ng官方文档翻译[中英对照]---Airmon-ng

    Aircrack-ng官方文档翻译---Airmon-ng Description[简介] This script can be used to enable monitor mode on wire ...

  4. MAVEN:::::: maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported

    zhuan:http://elan1986.iteye.com/blog/1537967 <!--add by wangquanjun 20140529-->            < ...

  5. BZOJ 1624: [Usaco2008 Open] Clear And Present Danger 寻宝之路

    Description 农夫约翰正驾驶一条小艇在牛勒比海上航行. 海上有N(1≤N≤100)个岛屿,用1到N编号.约翰从1号小岛出发,最后到达N号小岛.一 张藏宝图上说,如果他的路程上经过的小岛依次出 ...

  6. 【转】Spring 注解学习手札(超好的springmvc注解教程)

    Spring 注解学习手札(一) 构建简单Web应用 Spring 注解学习手札(二) 控制层梳理 Spring 注解学习手札(三) 表单页面处理 Spring 注解学习手札(四) 持久层浅析 Spr ...

  7. Security 可视化

    http://web.cs.ucdavis.edu/~ma/SecVis/ http://research.dbvis.de/security/tools/clockview/ http://raff ...

  8. DJANGO,获取当前用户名,用户组名,用户组权限

    样例,为下一步自定义用户权限作一下代码准备: def get_context_data(self, **kwargs): if self.request.user.is_authenticated() ...

  9. 【BZOJ 1319】 Sgu261Discrete Rootsv (原根+BSGS+EXGCD)

    1319: Sgu261Discrete Roots Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 389  Solved: 172 Descriptio ...

  10. C51 的编程规范

    编程首要是要考虑程序的可行性,然后是可读性.可移植性.健壮性以及可测试性.这是总则.但是很多人忽略了可读性.可移植性和健壮性(可调试的方法可能歌不相同),这是不对的. 1.当项目比较大时,最好分模块编 ...