{"id":382,"date":"2007-11-11T17:49:35","date_gmt":"2007-11-11T09:49:35","guid":{"rendered":"http:\/\/blog.smallken.ink\/2007\/11\/11\/%e6%9c%aa%e5%88%86%e9%a1%9e\/382.html"},"modified":"2007-11-11T17:50:54","modified_gmt":"2007-11-11T09:50:54","slug":"%e8%99%9b%e6%93%ac%e4%bc%ba%e6%9c%8d%e5%99%a8-xen-%e5%af%a6%e4%bd%9c%e6%95%99%e5%ad%b8-for-cenos5","status":"publish","type":"post","link":"https:\/\/blog.smallken.site\/?p=382","title":{"rendered":"\u865b\u64ec\u4f3a\u670d\u5668 Xen \u5be6\u4f5c\u6559\u5b78 for CenOS5"},"content":{"rendered":"<p>Xen \u53ef\u4ee5\u628a\u5b83\u60f3\u6210\u662f\u4f7f\u7528\u5728 Linux \u4f5c\u696d\u7cfb\u7d71\u4e0a\u7684 VMware\uff0c\u4f7f\u7528 Xen \u8edf\u9ad4\u53ef\u4ee5\u518d\u6a21\u64ec\u51fa\u591a\u500b\u5206\u8eab\u4f5c\u696d\u7cfb\u7d71\uff0c\u4e5f\u5c31\u662f\u8aaa\u5982\u679c\u6a5f\u5668\u672c\u8eab\u7684\u786c\u789f\u5920\u5927\uff0c\u8a18\u61b6\u9ad4\u5920\u591a\uff0c\u9019\u4e9b\u8cc7\u6e90\u53ef\u4ee5\u518d\u591a\u5207\u51fa\u4f86\u53e6\u5916\u4e00\u53f0\u6216\u591a\u53f0\u96fb\u8166\u3002<\/p>\n<p>\u90a3 Xen \u7684\u67b6\u69cb\u4e0a\u4f86\u8b1b\u5176\u5be6\u8ddf Windows \u4e0a\u7684 VMware \u6709\u4e00\u9ede\u4e0d\u4e00\u6a23\u5c31\u662f Xen \u662f\u76f4\u63a5\u542b\u5728 Linux \u7684 kernel \u88e1\u982d\u7684\uff0c\u4e5f\u5c31\u662f\u8aaa VMware \u7684\u67b6\u69cb\u6709\u9ede\u50cf<strong>\u8edf\u9ad4\u4e2d\u7684\u8edf\u9ad4<\/strong>\uff0c\u4f46\u662f Xen \u537b\u5f88\u50cf\u6a5f\u5668\u4e00\u958b\u8d77\u4f86\u4e4b\u5f8c\uff0c\u81ea\u7136\u5c31\u628a\u591a\u500b\u4f5c\u696d\u7cfb\u7d71\u4e00\u8d77\u8dd1\u8d77\u4f86\u4e00\u6a23\uff0c\u5728\u4e0d\u540c\u7684\u4f5c\u696d\u7cfb\u7d71\u7576\u4e2d\u529f\u80fd\u4e0a\u770b\u8d77\u4f86\u662f\u5dee\u4e0d\u591a\u7684\uff0c\u4f46\u662f\u5728\u67b6\u69cb\u4e0a\u6700\u539f\u59cb\u7684\u90a3\u500b\u4f5c\u696d\u7cfb\u7d71(\u4e3b\u7cfb\u7d71)\u5730\u4f4d\u6703\u6bd4\u8f03\u9ad8\uff0c\u5b83\u901a\u5e38\u662f\u7d93\u7531\u5b83\u4f86\u63a7\u7ba1\u5176\u4ed6\u7684\u4f5c\u696d\u7cfb\u7d71(\u6b21\u7cfb\u7d71)\uff0c\u6982\u5ff5\u807d\u8d77\u4f86\u53ef\u80fd\u5f88\u6a21\u7cca\uff0c\u6216\u8a31\u4f60\u9084\u6c92\u6709\u4efb\u4f55\u611f\u89ba\uff0c\u4f46\u662f\u76f8\u4fe1\u7d93\u904e\u6211\u5be6\u4f5c\u4e4b\u5f8c\u81ea\u7136\u5c31\u6703\u77e5\u9053\u4e86\u3002<\/p>\n<p>\u4ee5\u4e0b\u6211\u5c31\u4f86\u5be6\u4f5c\u5728 CentOS5 \u4e0b\u4f7f\u7528 Xen \u5207\u51fa1\u53f0\u704c\u6587\u5b57\u4ecb\u9762\u7684 Red Hat Fedora 8\u3002<\/p>\n<p>\u9996\u5148\u9019\u53f0\u662f CentOS5\uff0c\u5b89\u88dd Xen \u9700\u8981\u4ee5\u4e0b\u4e09\u9805\u5957\u4f5c\u4e00\u8d77\u5b89\u88dd\uff0c1.xen(\u8edf\u9ad4\u672c\u8eab) 2.kernel-xen(xen \u7248\u672c\u7684 kernel\uff0c\u5b89\u88dd\u5b8c\u6210\u4ee5\u5f8c\u90fd\u6703\u7528\u9019\u500b kernel\u4f86 \u958b\u6a5f) 3.virt-manager(\u7ba1\u7406xen\u7684\u8edf\u9ad4)<\/p>\n<p>\u6240\u4ee5\u9700\u8981\u5b89\u88dd xen, kernel-xen,virt-manager \u9019\u4e09\u9805\u5957\u4ef6<br \/>\n# yum -y install xen kernel-xen virt-manager<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/aycu33.webshots.com\/image\/34312\/2003972474759485589_rs.jpg\" \/><\/p>\n<p>\u5b89\u88dd\u597d\u4e4b\u5f8c\uff0c\u9700\u8981\u6539\u4e00\u4e0b\u958b\u6a5f\u7684 kernel\uff0c\u56e0\u70ba\u525b\u525b\u5b89\u88dd\u4e86 xen \u7248\u672c\u7684 kernel \uff0c\u4ee5\u5f8c\u90fd\u8981\u4f7f\u7528\u9019\u500b <font color=\"#0000ff\">2.6.18-8.1.15.el5xen<\/font> \u7248\u672c\u4f86\u958b\u6a5f\u4e86<\/p>\n<p># vim \/boot\/grub\/menu.lst<br \/>\ndefault=<font color=\"#ff0000\">0<br \/>\n<\/font>timeout=5<br \/>\nsplashimage=(hd0,0)\/grub\/splash.xpm.gz<br \/>\nhiddenmenu<br \/>\ntitle CentOS (<font color=\"#0000ff\">2.6.18-8.1.15.el5xen<\/font>)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 root (hd0,0)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 kernel \/xen.gz-2.6.18-8.1.15.el5<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 module \/vmlinuz-2.6.18-8.1.15.el5xen ro root=\/dev\/VolGroup00\/LogVol00 rhgb quiet<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 module \/initrd-2.6.18-8.1.15.el5xen.img<br \/>\ntitle CentOS (2.6.18-8.el5)<br \/>\n\u00a0<\/p>\n<p># reboot<\/p>\n<p><!--nextpage--><\/p>\n<p>\u91cd\u65b0\u958b\u6a5f\u4e4b\u5f8c\u4f60\u6703\u770b\u5230\u5982\u4e0b\u5716\uff0c\u9810\u8a2d\u4f7f\u7528\u65b0\u7684 kernel \u958b\u6a5f<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/aycu36.webshots.com\/image\/33275\/2004589807627966050_rs.jpg\" \/><\/p>\n<p>\u958b\u6a5f\u5b8c\u6210\u4e4b\u5f8c\uff0c\u5728\u5716\u5f62\u4ecb\u9762\u4e0b\u958b\u555f\u7ba1\u7406 xen \u7684\u4ecb\u9762\uff0c\u61c9\u7528\u7a0b\u5f0f\u2192\u7cfb\u7d71\u5de5\u5177\u2192Virtual Machine Manager\u2192\u9023\u63a5<br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu01.webshots.com\/image\/32160\/2006133558388910051_rs.jpg\" \/>\u00a0<img decoding=\"async\" src=\"http:\/\/aycu01.webshots.com\/image\/32160\/2006129375084785400_rs.jpg\" \/> <img decoding=\"async\" src=\"http:\/\/aycu26.webshots.com\/image\/32465\/2002592469758726681_rs.jpg\" \/> \u5982\u4e0a\u5716\uff0c\u73fe\u5728\u53ef\u4ee5\u770b\u5230Domain-0\u9019\u53f0\u96fb\u8166\u7684CPU\u4f7f\u7528\u91cf\u3001\u8a18\u61b6\u9ad4\u4f7f\u7528\u91cf&#8230;\u7b49\u7b49\uff0c\u9019\u53f0\u5c31\u662f\u76ee\u524d\u9019\u53f0\u6700\u539f\u59cb\u7684\u96fb\u8166\uff0c\u6211\u5011\u7b49\u4e00\u4e0b\u5c31\u662f\u8981\u518d\u5207\u51fa\u5e7e\u500b\u5206\u8eab\u96fb\u8166\u5594\u3002<br \/>\n<!--nextpage--><\/p>\n<p>\u56e0\u70ba\u7b49\u4e00\u4e0b\u5b89\u88dd\u65b0\u7684\u4f5c\u696d\u7cfb\u7d71\u6642\u53ea\u80fd\u900f\u904eNFS\u3001HTTP\u6216FTP\u9019\u4e9b\u7db2\u8def\u5b89\u88dd\uff0c\u56e0\u70ba\u7919\u65bc\u7db2\u8def\u983b\u5bec\u7684\u95dc\u4fc2\uff0c\u6211\u5011\u8b8a\u901a\u7684\u65b9\u5f0f\u5c31\u662f\u5728\u81ea\u5df1\u672c\u6a5f\u67b6HTTP\u5206\u4eab\u5b89\u88dd\u5149\u789f\u4e2dCDROM\u7684\u8cc7\u6599\uff0c\u9019\u6a23\u5c31\u4e0d\u7528\u518d\u9023\u5230\u5916\u9762\u53bb\uff0c\u6d6a\u8cbb\u591a\u9918\u7684\u6642\u9593\u50b3\u8cc7\u6599<\/p>\n<p>\u653e\u5165 Red Hat Fedora 8 \u7684\u5b89\u88dd\u5149\u789f\u5230 CDROM \u4e2d\uff0c\u518d\u628a\u5b83 mount \u5230 \/media<br \/>\n# mount \/dev\/cdrom \/media\/<br \/>\nmount: block device \/dev\/cdrom is write-protected, mounting read-only<\/p>\n<p>\u5b89\u88dd httpd<br \/>\n# yum -y install httpd<\/p>\n<p>\u628a cdrom \u7684\u8cc7\u6599\u5229\u7528\u6377\u5f91\u7684\u65b9\u5f0f\u9023\u7d50\u5230 http \u7684\u7db2\u8def\u7a7a\u9593\u4e2d\uff0c\u53d6\u540d\u70ba fedora8<br \/>\n# ln -s \/media\/ \/var\/www\/html\/fedora8<\/p>\n<p>\u555f\u52d5 httpd<br \/>\n# service httpd start<\/p>\n<p>\u958b\u555f\u700f\u89bd\u5668\u6e2c\u8a66\u4e00\u4e0b\u7db2\u9801\u986f\u793a\u61c9\u8a72\u6c92\u554f\u984c<br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu27.webshots.com\/image\/35306\/2002741590611760904_rs.jpg\" \/><\/p>\n<p>\u63a5\u8457\u6211\u5011\u5c31\u8981\u6b63\u5f0f\u4f86\u65b0\u589e\u4e00\u53f0\u4f3a\u670d\u5668\uff0c\u5b89\u88dd Fedora 8 \u56c9!<br \/>\n\u63a5\u4e0b\u4f86\u9019\u88e1\u53ef\u4ee5\u4f7f\u7528\u5716\u5f62\u4ecb\u9762\u4f86\u5b89\u88dd\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u6587\u5b57\u4ecb\u9762\u4f86\u5b89\u88dd\uff0c\u6211\u5148\u8b1b\u5716\u5f62\u5b89\u88dd\u7684\u90e8\u5206<\/p>\n<p><strong>\u5716\u5f62\u4ecb\u9762\u5b89\u88dd\u65b9\u5f0f\uff1a<\/strong><br \/>\n\u5982\u4e0b\u5716\u5728\u7ba1\u7406\u4ecb\u9762\u4e2d\u6309[\u65b0\u589e]<img decoding=\"async\" src=\"http:\/\/aycu39.webshots.com\/image\/33238\/2004075381243564084_rs.jpg\" \/><\/p>\n<p><!--nextpage--><\/p>\n<p>\u66ff\u9019\u500b\u5206\u8eab\u7684\u96fb\u8166\u53d6\u4e00\u500b\u540d\u5b57\uff0c\u5982\u4e0b\u5716\uff0c\u6211\u53d6 vm1<br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu26.webshots.com\/image\/34145\/2004073827469910674_rs.jpg\" \/><img decoding=\"async\" src=\"http:\/\/aycu29.webshots.com\/image\/34068\/2004027087158913433_rs.jpg\" \/><br \/>\n\u63a5\u8457\u6211\u5011\u525b\u525b\u6e96\u5099\u7684\u6771\u897f\u9019\u88e1\u5c31\u6d3e\u4e0a\u7528\u5834\u4e86\uff0c\u9019\u88e1\u8f38\u5165\u7db2\u8def\u5b89\u88dd\u7684\u7db2\u5740 <a href=\"http:\/\/192.168.1.101\/fedora8\">http:\/\/192.168.1.101\/fedora8<\/a><br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu26.webshots.com\/image\/34145\/2004063022845433356_rs.jpg\" \/> <!--nextpage-->\u63a5\u8457\u5982\u679c\u4f60\u6709\u53e6\u5916\u4e00\u9846\u786c\u789f\uff0c\u5728[\u6b63\u5e38\u78c1\u789f\u5206\u5272\u5340]\u4e2d\u4f60\u53ef\u4ee5\u9078\u64c7\u4e00\u9846\u7368\u7acb\u7684\u786c\u789f\u7d66\u9019\u500b\u4f5c\u696d\u7cfb\u7d71\u4f7f\u7528\uff0c\u5426\u5247\u4f60\u53ef\u4ee5\u7528\u6a94\u6848\u7684\u65b9\u5f0f\u7d66\u9019\u500b\u4f5c\u696d\u7cfb\u7d71\u4e00\u500b\u786c\u789f\u7a7a\u9593\uff0c\u6a94\u6848\u4f4d\u7f6e\u7684\u8a71\u6211\u5011\u898f\u5283\u5c31\u662f\u6240\u6709\u4f5c\u696d\u7cfb\u7d71\u90fd\u653e\u5728 \/vm \u76ee\u9304\uff0c\u4ee5\u5f8c\u65b0\u589e\u7684\u6a5f\u5668\u5c31\u4f7f\u7528 \/vm\/vm1,vm\/vm2&#8230;\u4ee5\u6b64\u985e\u63a8\uff0c\u56e0\u70ba\u6211\u53ea\u662f\u6e2c\u8a66\u7528\uff0c\u6240\u4ee5\u786c\u789f\u6211\u53ea\u7d664G<img decoding=\"async\" src=\"http:\/\/aycu15.webshots.com\/image\/34134\/2004015321177392985_rs.jpg\" \/><br \/>\n\u63a5\u4e0b\u4f86\u8981\u8a2d\u5b9a\u8981\u7d66\u9019\u53f0\u96fb\u8166\u591a\u5c11\u8a18\u61b6\u9ad4\uff0c\u6211\u53ea\u662f\u6e2c\u8a66\u7528\u6211\u5206\u914d200MB\u7d66\u5b83\uff0c\u518d\u4f86\u6c7a\u5b9aCPU\u7684\u6578\u91cf\uff0c2\u9846\u7684\u8a71\u5c31\u662f\u6a21\u64ec\u51fa\u96d9\u6838\u5fc3\u7684\u67b6\u69cb\uff0c\u5373\u4f7f\u4f60\u539f\u672c\u7684\u6a5f\u5668\u53ea\u6709\u4e00\u9846CPU\u4e5f\u53ef\u4ee5\u6a21\u64ec\u51fa\u591a\u9846CPU\u5594\uff0c\u4e0d\u904e\u8207\u6548\u80fd\u7121\u95dc<br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu22.webshots.com\/image\/33061\/2004014994473039184_rs.jpg\" \/> <img decoding=\"async\" src=\"http:\/\/aycu18.webshots.com\/image\/33337\/2004092370391079241_rs.jpg\" \/> <!--nextpage-->\u5982\u4e0b\u5716\uff0c\u4e4b\u5f8c\u4f60\u5c31\u53ef\u4ee5\u770b\u5230\u719f\u6089\u7684\u958b\u59cb\u5b89\u88dd\u756b\u9762<br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu23.webshots.com\/image\/32502\/2004004314493168512_rs.jpg\" \/><br \/>\n\u56e0\u70ba\u8981\u7db2\u8def\u5b89\u88dd\uff0c\u6240\u4ee5\u6211\u5011\u5fc5\u9808\u5148\u5e6b\u5b83\u8a2d\u5b9a\u597d\u7db2\u8def<br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu33.webshots.com\/image\/32352\/2005731501617115146_rs.jpg\" \/><br \/>\n\u57fa\u672c\u4e0a\u5c31\u662f\u8a2d\u5b9a\u5728\u540c\u4e00\u500b\u5340\u57df\u7db2\u8def\u4e2d\uff0c\u6216\u8005\u8a2d\u5b9a\u5230\u53ef\u4ee5\u9023\u5f97\u5230\u5916\u9762\u7684\u7db2\u8def\u5b89\u88dd\u4f4d\u7f6e\u5373\u53ef<br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu40.webshots.com\/image\/33919\/2005755165249256789_rs.jpg\" \/><br \/>\n\u63a5\u4e0b\u4f86\u8df3\u51fa\u4f86\u7684\u756b\u9762\u5c31\u662f\u5716\u5f62\u4ecb\u9762\u7684\u5b89\u88dd\u756b\u9762\u4e86\uff0c\u4f60\u53ef\u4ee5\u6309\u7167\u81ea\u5df1\u539f\u672c\u7684\u7fd2\u6163\u5b89\u88dd\u9019\u53f0\u96fb\u8166\u4e86<br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu17.webshots.com\/image\/34976\/2001605491593135563_rs.jpg\" \/><\/p>\n<p>\u4f46\u662f\u5982\u4e0a\u7684\u5b89\u88dd\u65b9\u5f0f\u6703\u4f7f\u7528\u5f97\u5b89\u88dd\u904e\u7a0b\u592a\u5403\u8a18\u61b6\u9ad4\uff0c\u6703\u8b8a\u5f97\u5f88\u6162\uff0c\u6211\u6bd4\u8f03\u5efa\u8b70\u4f7f\u7528\u6587\u5b57\u4ecb\u9762\u7684\u65b9\u5f0f\u4f86\u5b89\u88dd<\/p>\n<p><strong>\u6587\u5b57\u4ecb\u9762\u5b89\u88dd\u65b9\u5f0f\uff1a<br \/>\n<\/strong>\u5982\u4e0b\uff0c\u5728 console \u4e2d\u57f7\u884c virt-install\uff0c\u63a5\u8457\u8a72\u586b\u5165\u7684\u6b04\u4f4d\u8207\u5716\u5f62\u4ecb\u9762\u5b89\u88dd\u5dee\u4e0d\u591a<br \/>\n# <font color=\"#ff0000\">virt-install<\/font><br \/>\nWhat is the name of your virtual machine? &lt;&#8211; <font color=\"#ff0000\">vm1<br \/>\n<\/font>How much RAM should be allocated (in megabytes)? &lt;&#8211; <font color=\"#ff0000\">200<\/font><br \/>\nWhat would you like to use as the disk (path)? &lt;&#8211; <font color=\"#ff0000\">\/vm\/vm1.img<\/font><br \/>\nHow large would you like the disk (\/vm\/vm01.img) to be (in gigabytes)? &lt;&#8211; <font color=\"#ff0000\">4<br \/>\n<\/font>Would you like to enable graphics support? (yes or no) &lt;&#8211; <font color=\"#ff0000\">no<\/font><br \/>\nWhat is the install location? &lt;&#8211; <a href=\"http:\/\/192.168.1.101\/fedora8\"><\/a><a href=\"http:\/\/192.168.1.101\/fedora8\"><font color=\"#ff0000\">http:\/\/192.168.1.101\/fedora8<\/font><\/a><\/p>\n<p>\u63a5\u4e0b\u4f86\u4f60\u6703\u770b\u5230\u7684\u5c31\u662f<strong>\u4e00\u9023\u4e32\u7684\u6587\u5b57\u4ecb\u9762\u7684\u7db2\u8def\u5b89\u88dd\u756b\u9762<\/strong>\uff0c\u5176\u5be6\u900f\u904e sshd \u5f9e\u9060\u7aef login \u9032\u53bb\u5b89\u88dd\u4e5f\u53ef\u4ee5\u5594\uff0c\u4ee5\u4e0b\u9019\u4e9b\u6b65\u9a5f\u90fd\u8ddf\u4e4b\u524d\u5927\u540c\u5c0f\u7570\uff0c\u6211\u5c31\u7701\u7565\u6389\u3002<br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu17.webshots.com\/image\/32696\/2001917875706869500_rs.jpg\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu38.webshots.com\/image\/35077\/2005379587465114527_rs.jpg\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu03.webshots.com\/image\/32482\/2002540067437331700_rs.jpg\" \/> <img decoding=\"async\" src=\"http:\/\/aycu22.webshots.com\/image\/35381\/2000322922352700759_rs.jpg\" \/> <img decoding=\"async\" src=\"http:\/\/aycu15.webshots.com\/image\/32774\/2000333821587622220_rs.jpg\" \/> <img decoding=\"async\" src=\"http:\/\/aycu40.webshots.com\/image\/32839\/2002722521045937535_rs.jpg\" \/> <!--nextpage-->\u5b89\u88dd\u904e\u7a0b\u6293\u4e86\u5e7e\u500b\u5716\u5230\u9019\u88e1\uff0c\u73fe\u5728\u4e0a\u9762\u7684\u756b\u9762\u5df2\u7d93\u9032\u5165\u4e86 vm1 \u7684\u6b21\u7cfb\u7d71\u4e2d\u4e86\u5594\uff0c\u518d\u56de\u9867\u4e00\u4e0b\uff0c\u525b\u525b\u4e00\u958b\u59cb\u6211\u5011\u5728 192.168.1.101 \u9019\u53f0\u96fb\u8166\u7684 console \u4e2d\uff0c\u6211\u5011\u4f7f\u7528 virt-install \u6307\u4ee4\u53bb\u5b89\u88dd\u4e86\u9019\u53f0\u6b21\u7cfb\u7d71\uff0cIP\u8a2d\u5b9a\u662f192.168.1.102\uff0c\u5b89\u88dd\u597d\u4e4b\u5f8c\u91cd\u65b0\u958b\u6a5f\uff0c\u6211\u5011\u540c\u6642\u4e5f\u53ef\u4ee5\u5f9e console \u4e2d\u76f4\u63a5\u770b\u5230\u958b\u6a5f\u756b\u9762\u4e86\u5427\uff0c\u958b\u5b8c\u6a5f\u4e4b\u5f8c\u5c31\u9032\u5165\u4e86\u6b21\u7cfb\u7d71\u7684\u767b\u5165\u756b\u9762\u4e2d\uff0c\u767b\u5165\u4ee5\u5f8c\uff0c\u73fe\u5728\u5c31\u662f\u5728\u6b21\u7cfb\u7d71\u7684Linux\u4e2d\u4e86\u3002<\/p>\n<p>\u597d\uff0c\u554f\u984c\u4f86\u4e86\uff0c\u90a3\u5982\u4f55\u8df3\u56de\u53bb\u539f\u4f86\u7684\u4e3b\u7cfb\u7d71(192.168.1.101)\u5462?<br \/>\n\u55ef\uff0c\u5f88\u7c21\u55ae\uff0c\u53ea\u8981\u6309 <strong>Ctrl + ]<\/strong> \u6216\u8005 <strong>Ctrl+5<\/strong> \u5c31\u53ef\u4ee5\u8df3\u56de\u539f\u4f86\u7684\u7cfb\u7d71\u4e86<\/p>\n<p>\u6240\u4ee5\u73fe\u5728\u4e00\u53f0\u4e3b\u6a5f\u4e2d\u5df2\u7d93\u6709\u5169\u5957Linux\u56c9\uff0c\u4f7f\u7528 sshd \u5206\u5225\u90fd\u53ef\u4ee5\u5206\u5225\u767b\u5165\u5176\u4e2d\u4e00\u53f0\u3002<\/p>\n<p>\u518d\u56de\u5230\u5716\u5f62\u4ecb\u9762\u4e2d\u7684 virt-manager\uff0c\u5982\u4e0b\u5716\uff0c\u591a\u4e86\u4e00\u53f0 vm1 \u7684\u96fb\u8166\u4e86\u5427\uff0c\u6211\u5011\u53ef\u4ee5\u6aa2\u8996\u4e00\u4e0b[\u8a73\u7d30\u8cc7\u6599]<br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu13.webshots.com\/image\/32372\/2001584364941429343_rs.jpg\" \/> [\u8a73\u7d30\u8cc7\u6599]\u4e2d\u6211\u5011\u53ef\u4ee5\u770b\u5230\u9019\u53f0 vm1 \u7684\u4e00\u4e9b\u57fa\u672c\u8cc7\u6599\uff0c\u9084\u53ef\u4ee5\u5c0d\u9019\u53f0\u96fb\u8166\u505a\u66ab\u505c\u3001\u95dc\u6a5f\u7b49\u52d5\u4f5c\uff0c\u5176\u4e2d\u8a18\u61b6\u9ad4\uff0c\u5982\u4e0b\u5716\uff0c\u662f\u53ef\u4ee5\u52d5\u614b\u8b8a\u52d5\u7684\u5594\uff0c\u76f4\u63a5\u6539\uff0c\u76f4\u63a5\u751f\u6548^^<br \/>\n<img decoding=\"async\" src=\"http:\/\/aycu05.webshots.com\/image\/34484\/2001504186815586665_rs.jpg\" \/><\/p>\n<p>\u7522\u751f\u7684 vm1 \u7cfb\u7d71\u662f\u653e\u5728\u6211\u5011\u525b\u525b\u8a2d\u5b9a\u7684 \/vm\/vm1 \u9019\u500b\u6620\u8c61\u6a94\u6848\u4e4b\u4e2d<br \/>\n[root@localhost ~]# <strong>ll -h \/vm\/vm1<\/strong><br \/>\n-rwxr-xr-x 1 root root 3.1G 11\u6708 11 15:26 \/vm\/vm1<br \/>\nvm1 \u7684\u8a2d\u5b9a\u6a94\u4f4d\u7f6e<strong>\uff1a\/etc\/xen\/vm1<\/strong><\/p>\n<p>\u4ee5\u4e0a\u4ee5\u6b64\u985e\u63a8\uff0c\u6211\u5011\u53ef\u4ee5\u4e00\u76f4\u518d\u5207\u51fa\u4f86 vm2, vm3&#8230;\u53ea\u8981\u786c\u789f\u5920\u5927\uff0c\u8a18\u61b6\u9ad4\u5920\u591a\u5c31\u53ef\u4ee5\u56c9^^<\/p>\n<p><!--nextpage--><\/p>\n<p>\u63a5\u4e0b\u4f86\u6700\u5f8c\u9019\u90e8\u4efd\u4f86\u8b1b\u4e00\u4e9b xen \u91cd\u8981\u7684\u57fa\u672c\u6307\u4ee4\u64cd\u4f5c<\/p>\n<p>\u525b\u525b\u6709\u8b1b\u904e\u5728 vm1 \u4e2d\u8981\u8df3\u56de domain-0\uff0c\u53ea\u8981\u6309Ctrl+]\u6216Ctrl+5\u5373\u53ef\uff0c\u90a3\u5982\u679c\u53c8\u8981\u9032\u5165vm1\u4e2d\u5462?<\/p>\n<p>[root@localhost ~]# <strong>xm console vm1<\/strong><br \/>\n\/\/\u518d\u6309\u4e00\u6b21 Enter<\/p>\n<p>Fedora release 8 (Werewolf)<br \/>\nKernel 2.6.21-2950.fc8xen on an i686<\/p>\n<p>vm1 login:<\/p>\n<p>\/\/ \u5c31\u9032\u5165\u4e86 vm1 \u7684\u767b\u5165\u756b\u9762\uff0c\u9019\u500b\u52d5\u4f5c\u53ea\u662f\u7b49\u65bc\u985e\u4f3c\u9032\u5165\u5728 vm1 \u7684\u672c\u6a5f\u64cd\u4f5c\u800c\u5df2\uff0c\u800c\u4e0d\u662f\u9060\u7aef login \u64cd\u4f5c\uff0c\u9060\u7aef\u767b\u5165 vm1 \u53ea\u8981 vm1 \u7684 sshd \u6709\u8dd1\u8d77\u4f86\u5c31\u8ddf\u4e00\u822c\u7684\u767b\u5165\u65b9\u5f0f\u6c92\u6709\u4e0d\u4e00\u6a23\u3002<\/p>\n<p>\/\/ \u5217\u51fa\u6240\u6709 vm<br \/>\n#<strong> xm list<br \/>\n<\/strong>Name\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ID Mem(MiB) VCPUs State\u00a0\u00a0 Time(s)<br \/>\nDomain-0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 484\u00a0\u00a0\u00a0\u00a0 1 r&#8212;&#8211;\u00a0\u00a0 1981.0<br \/>\nvm1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0\u00a0 199\u00a0\u00a0\u00a0\u00a0 1 &#8212;&#8212;\u00a0\u00a0\u00a0\u00a0 26.2<br \/>\nvm2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\u00a0\u00a0\u00a0\u00a0\u00a0 199\u00a0\u00a0\u00a0\u00a0 1 &#8212;&#8212;\u00a0\u00a0\u00a0\u00a0 22.0\u00a0\u00a0\u00a0<\/p>\n<p>\/\/ \u5c0d vm1 \u505a\u958b\u6a5f\u52d5\u4f5c\uff0c\/etc\/xen\/vm1 \u70ba vm1 \u7684\u8a2d\u5b9a\u6a94\u4f4d\u7f6e<br \/>\n# <strong>xm create \/etc\/xen\/vm1<br \/>\nor<br \/>\n<\/strong>#<strong> xm create vm1<\/strong><\/p>\n<p>\/\/ \u5c0d vm1 \u505a\u95dc\u6a5f\u52d5\u4f5c<br \/>\n# <strong>xm shutdown vm1<\/strong><\/p>\n<p>\/\/ \u5f37\u8feb\u95dc\u6a5f<br \/>\n# <strong>xm destroy vm1<\/strong><\/p>\n<p>\/\/ \u5c0d vm1 \u505a\u66ab\u505c\u52d5\u4f5c<br \/>\n#<strong> xm pause vm1<\/strong><\/p>\n<p>\/\/ \u89e3\u9664\u66ab\u505c<br \/>\n# <strong>xm unpause vm1<\/strong><\/p>\n<p>\/\/ \u82e5\u8981\u8b93 vm1 \u4e00\u958b\u6a5f\u6642\u5c31\u80fd\u99ac\u4e0a\u555f\u52d5\uff0c\u5c31\u628a vm1 \u7684\u8a2d\u5b9a\u6a94\u9023\u7d50\u5230 \/etc\/xen\/auto\/\u76ee\u9304\u4e2d\u5373\u53ef<br \/>\n# <strong>ln -s \/etc\/xen\/vm1 \/etc\/xen\/auto\/<\/strong><\/p>\n<p>\/\/ \u5176\u4ed6\u66f4\u591a\u7684\u6307\u4ee4<br \/>\n# <strong>xm help<\/strong><\/p>\n<p>\u7d93\u904e\u6e2c\u8a66\u4ee5 virt-install \u9019\u500b\u65b9\u6cd5\uff0c\u53ea\u9069\u7528\u5728\u5b89\u88dd Red Hat \u7cfb\u5217\u7684\u4f5c\u696d\u7cfb\u7d71\uff0c\u5982Red Hat\u3001Fedora\u3001CentOS\uff0c\u8981\u5b89\u88dd ubuntu \u6216\u5176\u4ed6 OS \u7684\u8a71\u8981\u4f7f\u7528\u5176\u4ed6\u65b9\u6cd5\uff0c\u90a3MS-Windows \u56e0\u70ba\u6838\u5fc3\u7684\u95dc\u4fc2\u662f\u4e0d\u7ba1\u600e\u6a23\u78ba\u5b9a\u4e0d\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Xen \u53ef\u4ee5\u628a\u5b83\u60f3\u6210\u662f\u4f7f\u7528\u5728 Linux \u4f5c\u696d\u7cfb\u7d71\u4e0a\u7684 VMware\uff0c\u4f7f\u7528 Xen \u8edf\u9ad4\u53ef\u4ee5\u518d\u6a21\u64ec\u51fa\u591a\u500b\u5206\u8eab\u4f5c&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-382","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/blog.smallken.site\/index.php?rest_route=\/wp\/v2\/posts\/382","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.smallken.site\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.smallken.site\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.smallken.site\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.smallken.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=382"}],"version-history":[{"count":0,"href":"https:\/\/blog.smallken.site\/index.php?rest_route=\/wp\/v2\/posts\/382\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.smallken.site\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.smallken.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.smallken.site\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}