xen/ovz利用QEMU虚拟windwos教程

不指定
2014-1-2 22:53 by:果面 PC应用 » 系统&软件 本站原创 | |
首先,vps要ovz或者xen

以下例子为centos 5.X  32/64系统,其它系统需要对应修改。

1.清理不必要的文件和关闭不必要的服务提升效率

yum -y remove httpd

yum -y remove Deployment_Guide-en-US finger cups-libs cups bluez-libs desktop-file-utils ppp rp-pppoe wireless-tools irda-utils nfs-utils nfs-utils-lib rdate fetchmail eject ksh mkbootdisk mtools syslinux tcsh startup-notification talk apmd rmt dump setserial portmap yp-tools rdate fetchmail eject ksh mkbootdisk mtools syslinux tcsh startup-notification talk apmd rmt dump setserial portmap yp-tools

service   acpid  off
service   atd    stop
service   auditd stop
service   avahi-daemon stop
service   avahi-dnsconfd stop
service   bluetooth  stop
service   conman stop
service   cpuspeed  stop
service   cups stop
service   dnsmasq stop
service   dund stop
service   firstboot  stop
service   hidd stop
service   httpd  stop
service   ibmasm stop
service   ip6tables stop
service   iptables stop
service   irda stop
service   kdump stop
service   lm_sensors stop
service   mcstrans stop
service   messagebus stop
service   microcode_ctl  stop
service   netconsole stop
service   netfs  stop
service   netplugd stop
service   nfs stop
service   nfslock stop
service   nscd stop
service   ntpd  stop
service   oddjobd stop
service   pand stop
service   pcscd stop
service   portmap stop
service   psacct stop
service   rdisc stop
service   restorecond stop
service   rpcgssd  stop
service   rpcidmapd stop
service   rpcsvcgssd stop
service   saslauthd stop
service   sendmail  stop
service   setroubleshoot  stop
service   smb stop
service   vncserver stop
service   winbind  stop
service   wpa_supplicant stop
service   xfs stop
service   ypbind stop
service   yum-updatesd stop
chkconfig   acpid  off
chkconfig   atd    off
chkconfig   auditd off
chkconfig   avahi-daemon off
chkconfig   avahi-dnsconfd off
chkconfig   bluetooth  off
chkconfig   conman off
chkconfig   cpuspeed  off
chkconfig   cups off
chkconfig   dnsmasq off
chkconfig   dund off
chkconfig   firstboot  off
chkconfig   hidd off
chkconfig   httpd  off
chkconfig   ibmasm off
chkconfig   ip6tables off
chkconfig   iptables off
chkconfig   irda off
chkconfig   kdump off
chkconfig   lm_sensors off
chkconfig   mcstrans off
chkconfig   messagebus off
chkconfig   microcode_ctl  off
chkconfig   netconsole off
chkconfig   netfs  off
chkconfig   netplugd off
chkconfig   nfs off
chkconfig   nfslock off
chkconfig   nscd off
chkconfig   ntpd  off
chkconfig   oddjobd off
chkconfig   pand off
chkconfig   pcscd off
chkconfig   portmap off
chkconfig   psacct off
chkconfig   rdisc off
chkconfig   restorecond off
chkconfig   rpcgssd  off
chkconfig   rpcidmapd off
chkconfig   rpcsvcgssd off
chkconfig   saslauthd off
chkconfig   sendmail  off
chkconfig   setroubleshoot  off
chkconfig   smb off
chkconfig   vncserver off
chkconfig   winbind  off
chkconfig   wpa_supplicant off
chkconfig   xfs off
chkconfig   ypbind off
chkconfig   yum-updatesd off
yum clean all


2.安装Linux GUI图形界面(这里以GNOME为例,也可以装KDE等等)

yum -y groupremove "GNOME Desktop Environment"
yum -y update
yum clean all


3.安装VNCSERVER,让Linux可以远程连接图形界面

这里省略,详情参考 CentOS安装轻量级桌面Fluxbox+VNC


4.安装QEMU虚拟机(CentOS5.X以外的系统建议直接下载所需的rpm,再根据提示补完组件。)

#安装所需的组件
yum install libICE.so.6 libImlib.so.1 libORBit-2.so.0 libSM.so.6 libX11.so.6 libXext.so.6 libXft.so.2 libXinerama.so.1 libXrandr.so.2 libXrender.so.1 libart_lgpl_2.so.2 libatk-1.0.so.0 libbonobo-2.so.0 libbonobo-activation.so.4 libbonoboui-2.so.0 libcairo.so.2 libfontconfig.so.1 libfreetype.so.6 libgconf-2.so.4 libgdk-x11-2.0.so.0 libgdk_pixbuf-2.0.so.0 libgnome-2.so.0 libgnome-desktop-2.so.2 libgnome-keyring.so.0 libgnomecanvas-2.so.0 libgnomeui-2.so.0 libgnomevfs-2.so.0 libgtk-x11-2.0.so.0 libpango-1.0.so.0 libpangocairo-1.0.so.0 libpangoft2-1.0.so.0 libstartup-notification-1.so.0 libungif.so.4 gtk+ libgdk-1.2.so.0 libglib-1.2.so.0 libgmodule-1.2.so.0 libgtk-1.2.so.0 libSDL-1.2.so.0 libX11.so.6 libasound.so.2 libbluetooth.so.2 libesd.so.0 curl ncurses -y

#安装QEMU所需RPM包
wget http://pkgs.repoforge.org/qemu/qemu-0.14.1-2.el5.rfx.i386.rpm
wget  http://pkgs.repoforge.org/qemu/qemu-img-0.14.1-2.el5.rfx.i386.rpm
wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/imlib-1.9.13-1.el5.rf.i386.rpm

rpm -i imlib-1.9.13-1.el5.rf.i386.rpm
rpm -i qemu-img-0.14.1-2.el5.rfx.i386.rpm
rpm -i qemu-0.14.1-2.el5.rfx.i386.rpm


5.创建虚拟机镜像文件

#2k3.img为镜像文件名称,10G为镜像文件大小
qemu-img create -f qcow 2k3.img 10G


6.启动VNC(已启动可以跳过此步)

vncserver


7.连接VNC

8.加载ISO文件到虚拟光驱并启动镜像

#system.iso为ISO文件名,2k3.img为虚拟机镜像文件
qemu -cdrom system.iso -m 512M -boot d 2k3.img


安装完成之后,就可以使用了。

这个是直接启动虚拟机的命令

#启动虚拟机,禁用usb,转发3389端口到宿主系统;389为主机端口,3389为虚拟机端口
qemu -hda 2k3.img -boot c -m 512M -k de -usb -redir tcp:389::3389


评论(0) 引用(0) 阅读(38674)