Xen虚拟机技术

所需积分/C币:35 2012-09-03 15:56:38 683KB PDF
收藏 收藏
举报

自己根据多个资料总结的一套Linux下Xen虚拟机安装的步骤
将 default的值修改为0,或者在系统时按ESC键选择从Ⅺen内核启动 7、重启以后,检查当前系统是否运行在Ⅹen内核之上 uname -r 如果显示:2.6.18-308.11.1.e15xen,说明当前系统已经运行在Xen内校之上。 8、检查Xen是否已经成功启动 /usr/sbin/xm list 如果显示类似如下输出,则说明Xen已经成功启动 Name ID Mem(Mib) vCPUs State Time(s Domain 747 1 r 339.3 至此·Ken服务端已经全部安装完成。接下来是创建和安装客户端端( guest) *****************第一篇结束***************** 第二篇:Xen客户端安装(基于图形界面的安装方式) 1、安装virt- manager工具包 yum -y install virt-manager 2、打开图形化管理界面 virt-manager 或 it* Applications - System Tools - Virtual Machine Manager virtual Machine Manager Hlc三 dit vicw Hclp View: All virtual machines Nama D Status Cru usage Memory usage localhost Active 49107MB48% Domain-0 0 d Funning 6.19% 49107MB4E% 3、点击New按钮,新建一个虚拟机 create a new virtual machine Virtual machine creation This assistant will guide you through creating a new vir lull rtlachuirpe Tuu will be ds ked or so me irifotir'aljunl about the virtua machine youd ke to create, such as o A name for your new virtual machine Whether the virtual m achine will be full virtualized or para-virtualized The location of the files necessary for installing an operating system on the vIrtual machIne storage details. which disk partitions or files the virtual machine should us ● Memory and cPU allocation X Cancel中ac◆ Forward 4、这是虚拟机的一些说明文字,点击 Forward create a new virtual machine Virtual machine name Please choose a name fer your virtual machin Name: viral Exam ple: systeml xan日l中Back|| Forward 5、给虚拟机起个名叫virt1,点击 Forward Create a new tua Virtualization method mu wll need fo choose a wlt? aflon methad for your new virtual macie O: Faravirtualizcd Lightweight method of virtualizing machines. Limits operating system choices bocause the os must be special y modified to support paravirtualiz ation, but FHIfcarr115 hiel Hr Ihan fully vir ILlali/ec Involves hardware simulation. allowIng for a greater range of virtual devices and operating systems (docs no re quire os modification) CPU architecture: 1656 Hypervisor" Xe∏ Note: The host CPU(s) In tals machIne do not h auEport for full virtualizatioN cAncel+BacK|+ Forwarc 如果是 paravirtualized的话就不能直按从iso文件安装,必须把iso文件解出来后放 到一个http:/ftp服务器上安装,只有fullyvirtualized的才可以从iso文件CD-ROM 等安装。还要注意的是; paravirtualiκed需要修改过的操作系统内核’所以不能安装 Windows; fully virtualized可以用来安装 Windows只要CPU支持 Ⅴ actualization( Intel vt or amd y)。 6、选择半虚揪化或全虚拟化,点击 Forward create a new virtual machine 百x Installation method Please indicate where installation me dia is va lable for the opera ing system you would like In ir saL torI Ihis villa rmlt hiIIH O Local install medIa (Iso image or CDROMX O Network install tree Http, Ftp, or Nf5) ○ Network arnt(PxF Please choose the operating system you will be installing on the virtual machine: OS Type: Linux os Variant: Red Ha: Entcrprisc Linux 5 g Not all operating system choices are supported by Red Hat. Please see the link be ow For supported conf durations 堅a Forwand 7、选择要安装系统的类型,点击 Forward create a new virtual machine nstallation s。urce Please indicate where installation medla is avallable tor the operating system you would like to ins.all on this vi tual machine. Optionally ycu can provide te URL for a kickstart file Installation media URL: ns: 192.168.0.254: /ar/fto/ pub i Example: LLp: //serverlldrmeexampleculm/islru 1385/ree ikttmL:7/92160.254/b/fl4ksWmcfg i Example: tp: / /ho stname e xample. com/ks/ks.cfg Kerne parameters () Example: pusLes=hLLp: /husllla ne exarrplecuIn/up: daLes. iImIy x Cancel+Back命 Forward 所以这里需要先安装和配置一个web服务器,然后把下载的iso文件解压到web服务器能 访问的目录下(http://127.0.0.1/centos)如果网速够快,可以从Internet上直接安 装把http://127.0.0.1/centos换成http://mirrors.kernel.org/centos/5.3/os/i386 8、指定安装介质的路径,支持 kickstart无人值守的安装脚本。点击 Forward Create a new virtual machine storage host for your new virtual machine This space WIbo o Please Indicate how you'd like to assIgn space from ti used to install the virtual machines operaing system O Block device (partition) Location: /cv/vol/v01 Brew彐c ① Example:/ dew/nrc ○He( disk image) Location: / lib/xenimages/virl mg Browse a AlloCate entire virtual disk now /n Warning: If you do nat allocate the entire disk now, space wil te a located as needec while the virtual mach ine is runin g. f sufficient frec spacc is no- available on thc host, this may result in ddd cuI rup liuli un Lhe vir Ludl inldthiinle Tip: You may addadd tional storage, including netwok- JunKed slui due, Ly suur vir LudI Machine afLer iL lias beerl create d using the same tools you would on a phys cal system x Cancel中Eak命 Forward 9、指定虚拟机存放位置。点击 Forward create a new virtual machine Network P ease indic ate how you'd like to connect your mew vir ludl ITldchii le lu Ule husl rielwurk o virtual network Netwerk:default Tip: Choose this option if your host is disconnected connected via wirel lly configure d with NetworkManager O Shared physical device Device. patho (Bridge xenbrC TIp: choose thls option If your host Is s-alcally conne cred to a n the ability to mig e the virtual sy'stem lo share a physical device, configure it as a bridge Set fix ed MAC address for your virtual machine X Cancel+Eack|命 Forwarc 1θ、选择网卡的模式为桥接模式,点击 Forward create a new virtual machine Memory and cPu Allocation Mer Please erter the memory configuration for this vitual machine You can specify the maximum amoun of memory the vir ual machine should be able to use, and optionally a lower amount to grab on startup. Warn ng: setting virual machine memory too high will cause out-of-memory errors in your host domain Total memory on host machinE. 1023.00 MB Slarlup ImleInury (MB]: 512 CPUS. Please enter the number of virtual cPUs this virtual machine shculd stat up with LogIcal host CPUs: I MaxImum vIrtual CPUs:3乏 Tip: For best per urlidILt, Lhe r umber uf vii lual CPUs should be less than (or equal to the numb er of physica CPus cn te host system Cancelφ旦ack命 Forw and 11、指定虚拟内存的大小和cPU的数量,点击 Forward create a new vIrtual machine Finish virtual machine creation Summary Machine name virtl Virtualization method faravirtualized Initial memory. 12 MB Maximum memory: =12 MB ∏ sta media Installation source nfs 19? 168 754:,var trp/pih kICkstart source: r-p: //192.1b80.254 pub/ksflle/ksvm -tg Kernel arguments: ks=ftp: /1921680.254/pub/ksfilcAksvm cfg St。ra啁e Disk image: /dev/gCl/Mv0l Disk sizE: 9424 MB Netword Connectlon type: shared physIcal devIce MAC adress Sound Enable aurIc: False s< Cancel中Back幻Ensh 2、这里就是刚才定义的虚拟机的配置,确定没有问题后,点击 Finish Create a new vIrtual machine summary Machine name virtU Virtualization method Paravirtualized 512 MB Vitual Cells: 2 Install med Creating Virtual Machine Inst o The virtua machine is now being created. Allocation of disk storage and retrieval of the instal ation images hay take a few minutes t Stor Network Creating domain MAC address Sound Enable audio Fa se Cancel中Bac2h 在正在创建虚拟机·稍等 13、检查配置 当我们安装虛拟机以后’系统会自动创建一个关于虛拟机的配置文件,在/etc/xen下面就 有关于所有虛拟机的配置文件。 cd /etc/xen/ #1s auto virt 1 xend-pci-quirks sxp xmexample hvm gemu-ifup xend-config sxp xmexample1 xmexample vti scripts nd-pci-permissive. sxp mexample 2 vi virt 1 name = virtu uuid=ge72edfa-9 39 c-aa2b-f289-8d3ba8f49bb1 maxmum= 512 memorv=512 vcpus bootloader =/usr/bin/pygrub on poweroff ="destroy on reboot ="restart on crash =restart ["type=vnc, vncunused=1, keymap=en-us] disk=["phy: /dev/vgo1/v01, nvda, W"] vif =["mac=00: 16: 36: 76: ad: ef, bridge=xenbro, script=vif-bridge"] 这里面就有虛拟机的名字’uid’最大内存’虚拟内存’CPU的数量’引导程序’关机’重 启磁盘,虛拟的mac地址,网卡等等。 4、管理虚拟机 # xm shutdownⅵirt1关闭虚拟机(正常关闭虚拟机) #xm destroy virt1 强制关闭虛拟机(非正常关闭虚拟机’相当于拨出电源) #xm create -c virt 1 C代表查看启动过程,可以看到grub界面’启动虚拟机 #m pause virt 1 暂停虚拟机 # xm unpauser virt1取消暂停虛拟机 #xm save virtl /var/ftp/pub/virtl bak 将虚拟机的系统设置成休眠状态 #xm restore/var/ftp/pub/virt. bak 将处于休眠状态的虚拟机修复回来 #vm reboot virt 1 重启虚拟机 #ym list 查看运行在后台的虚拟机 #vm console virt1 通过控制台的方式连接到虚拟机,退出虛拟 机利用Ctr1+]方式退出虚拟机 第三篇:Xen客户端安装(基于字符界面的安装方式) 1、搭建httpd环境,因为等会需婴httpd服务。 yum-yinstallhttpd&&servicehttpdstart 成功安装后’在默认安装路径下新建一个文件夹’/var/ww/html/ centos5 2、新建虚拟机存放目录Vm mkdir /vm 3、安装虛拟机系统 cd/vm #Ⅴirt- install What is the name of your virtual machine? -m01 How much RaM should he allocated (in megabytes)? <--256 What would you like to use as the disk(path)? <--/vm/vml.img How large would you like the disk (/vm/vmol. img) to be (in gigabytes)? <--4 Would you like to enable graphics support? (yes or no <--no

...展开详情
试读 12P Xen虚拟机技术
立即下载 低至0.43元/次 身份认证VIP会员低至7折
    抢沙发
    一个资源只可评论一次,评论内容不能少于5个字
    关注 私信 TA的资源
    上传资源赚积分,得勋章
    最新推荐
    Xen虚拟机技术 35积分/C币 立即下载
    1/12
    Xen虚拟机技术第1页
    Xen虚拟机技术第2页
    Xen虚拟机技术第3页
    Xen虚拟机技术第4页

    试读已结束,剩余8页未读...

    35积分/C币 立即下载 >