查看完整版本: CentOS 6 install 安裝 kvm 虛擬機器


apple 2012-8-9 17:40

CentOS 6 install 安裝 kvm 虛擬機器

<span id="ctl00_ContentPlaceHolder1_lbFmyWodCon">之前就想玩看看 Linux 上的Virtual Machine,現在CentOS 6.0 以上的版本已經改用 KVM(Kenral base Virtrual Machine),在安裝上似乎是非常簡單的。下面是一些安裝心得跟大家分享討論~~</span><div><span><br></span></div><div><div class="audience"><div class="audience"><p>安裝KVM 之主機必須支援 CPU 虛擬化技術,如 AMD 的 AMD-V 或是 Intel 的 VT-x。</p><p><br></p>
<p>進入終端機後,輸入以下指令</p><p>[quote]</p>
<p>egrep -c '(vmx|svm)' /proc/cpuinfo</p>
<p>[/quote]</p><p>若輸出為 0 則代表不支援;反之若輸出為 1 以上則代表主機支援 CPU 虛擬化技術。</p></div><div class="audience"><br></div><div class="audience">安裝kvm、網路橋接套件:</div><div class="no-overflow"><div class="text_to_html"># yum install kvm virt-manager libvirt&nbsp;bridge-utils<br>
# lsmod | grep kvm <br>
# service libvirtd start</div><div class="text_to_html"><br></div><div class="text_to_html"><img src="http://www.techotopia.com/images/3/34/Rhel6_virt_machine_manager.jpg" border="0"><br></div><div class="text_to_html"><br></div><div class="text_to_html">至於要如何在KVM 上面安裝一個新的OS...直接參考這篇教學比較快囉~~</div><div class="text_to_html"><a href="http://www.techotopia.com/index.php/Creating_an_RHEL_6_KVM_Virtual_Machine" target="_blank">http://www.techotopia.com/index.php/Creating_an_RHEL_6_KVM_Virtual_Machine</a></div><div class="text_to_html"><br></div><div class="text_to_html"><div class="text_to_html">##設定網路的橋接功能</div><div class="text_to_html"><br></div><div class="text_to_html">&nbsp; &nbsp; 建立橋接網卡</div><div class="text_to_html">&nbsp; &nbsp; 進入/etc/sysconfig/network-scripts/目錄,複製ifcfg-eth0成ifcfg-br0</div><div class="text_to_html">&nbsp; &nbsp; 修改ifcfg-br0中的device和type的資料</div><div class="text_to_html">&nbsp; &nbsp; =================================</div><div class="text_to_html">&nbsp; &nbsp; DEVICE=br0 (原為eth0)</div><div class="text_to_html">&nbsp; &nbsp; BOOTPROTO=none</div><div class="text_to_html">&nbsp; &nbsp; HWADDR=xx:xx:xx:xx:xx:xx</div><div class="text_to_html">&nbsp; &nbsp; ONBOOT=yes</div><div class="text_to_html">&nbsp; &nbsp; NETMASK=xxx.xxx.xxx.xxx</div><div class="text_to_html">&nbsp; &nbsp; IPADDR=xxx.xxx.xxx.xxx</div><div class="text_to_html">&nbsp; &nbsp; GATEWAY=xxx.xxx.xxx.xxx</div><div class="text_to_html">&nbsp; &nbsp; TYPE=Bridge (原為Ethernet)</div><div class="text_to_html">&nbsp; &nbsp; =================================</div><div class="text_to_html">&nbsp; &nbsp; 修改ifcfg-eth0的資料</div><div class="text_to_html">&nbsp; &nbsp; =================================</div><div class="text_to_html">&nbsp; &nbsp; DEVICE=eth0</div><div class="text_to_html">&nbsp; &nbsp; #BOOTPROTO=none &nbsp;(加上註解)</div><div class="text_to_html">&nbsp; &nbsp; HWADDR=xx:xx:xx:xx:xx:xx</div><div class="text_to_html">&nbsp; &nbsp; ONBOOT=yes</div><div class="text_to_html">&nbsp; &nbsp; #NETMASK=xxx.xxx.xxx.xxx &nbsp;(加上註解)</div><div class="text_to_html">&nbsp; &nbsp; #IPADDR=xxx.xxx.xxx.xxx &nbsp;(加上註解)</div><div class="text_to_html">&nbsp; &nbsp; #GATEWAY=xxx.xxx.xxx.xxx &nbsp;(加上註解)</div><div class="text_to_html">&nbsp; &nbsp; #TYPE=Ethernet &nbsp;(加上註解)</div><div class="text_to_html">&nbsp; &nbsp; BRIDGE=br0 &nbsp; &nbsp;(加上這一行)</div><div class="text_to_html">&nbsp; &nbsp; =================================</div><div class="text_to_html">&nbsp; &nbsp; 開啟IP forwarding,讓guest可以和host相通,修改/etc/sysctl.conf,</div><div class="text_to_html">&nbsp; &nbsp; 設定net.ipv4.ip_forward = 1</div><div class="text_to_html"><br></div><div class="text_to_html">&nbsp; &nbsp; 重新啟動網路:/etc/init.d/network restart</div><div><br></div><div>這樣裝好之後...就可以使用 Bridge Mode囉~~</div></div></div></div></div>
頁: [1]
查看完整版本: CentOS 6 install 安裝 kvm 虛擬機器