讓我心酸的Hyper-v虛擬機安裝


前言

想在自己的windows7系統上搭建hyper-v來創建虛擬機,因為公司有許多現成的VHD文件,直接加載就可以,看同事們都是那么做的。但是后來發現windows7下找不到任何關於hyper-v的程序,在網上找到了這篇文章:

INSTALLING HYPER-V MANAGER ON WINDOWS 7 按照文中提示我下載了那個補丁並安裝,安裝過程持續一個多小時,我看完兩集big bang才見到這個補丁安裝好,在程序中添加hyper-v功能,這樣我就能在管理工具中找到“hyper-v管理器”。但是,這只是一個hyper-v管理器而已,是用來連接到其他服務器的,不能在windows7 localhost上安裝hyper-v。所以我想在自己的windows7下使用hyper-v創建虛擬機並管理的願望就失敗了。

接下來我想,既然我的windows7不能裝,那么我就用vmware裝個windows server 2008的虛擬機,然后widows server 2008下安裝hyper-v。最后經歷千辛萬苦,終於裝好了windows server 2008,並且添加了“hyper-v”這個角色。需要注意的是如果要添加在vmware虛擬中添加hyper-v這個功能,必須在processor的選項勾選“Virtualize Intel VT-x/EPT or AMD-V/RVI”,參考How to install Hyper-v inside VMware Workstation 8.0。也可以使用一個securable.exe的工具來檢測機器是否支持虛擬化。

到目前為止,所以都是往好的方向發展的。然后我在hyper-v下創建虛擬機,最后一步我使用現成的VHD文件,而不是創建一個。創建虛擬機完成,但是當我試圖啟動虛擬的時候,會報如下錯誤:

在網上找了資料,發現有人跟我碰到同樣的錯誤,參考:Creating a Virtual Machine with Server 2008 Hyper-V Tools 。最后作者給出的解釋是:

“The reason is actually quite simple and obvious if you think about it – Hyper-V depends on the hardware virtualization support of the underlying Intel or AMD processor. Only one process can control that hardware virtualization in the current iterations of CPUs, therefore a hyper-v child VM can’t possibly have access to the hardware virtualiztion – the hyper-v parent already “owns” it.”

上面的解釋就是,我們在使用vmware創建虛擬機的時候已經使用了cpu的VT,而我們還想再vmware下再次去創建hyper-v的虛擬機,而這個虛擬機也是需要VT的,但是一個cpu只能使用一次VT,所以hyper-v得不到VT,那么就不能連接創建好的hyper-v虛擬機了。這個討論在 Installing Hyper-V inside VMware Workstation 7 這個帖子上說的很詳細。

主要的摘錄:

摘錄1

VMware workstation, Microsoft Virtual PC and Virtual Server are all type 2 hypervisors, which means they are applications that run inside an ordinary OS. VMware ESX, Xen and Microsoft Hyper-V are type 1 hypervisors, meaning that they are essentially operating systems modified to run other operating systems. Type 1 hypervisors must be installed directly on physical hardware. They cannot be installed inside another virtualization engine.

摘錄2

To run Hyper-V, you must install it on bare metal, a physical machine. There is no workaround.

對摘錄1的回復

This isn't 100% correct.  You can run ESX 3.02 on VMware workstation and boot up Virtual Machines.  

對上面回復的回復

ESX 3.02 didn't require VT, that's why you could run it, but any modern hypervisor uses VT. (or AMD's equivalent)  VM's don't see VT so you can't run a modern hypervisor in a VM.

在windows server 2008上安裝hyper

一台電腦如果要裝hyper-v虛擬機,必須得CPU支持,所以在安裝虛擬機之前,我們需要檢測自己的電腦是否支持虛擬化。具體方法參考 快速檢測你的系統是否支持Hyper-V

假如你的cpu可以支持hyper-v,那么接下來就開始安裝。但是得注意一點,hyper-v只支持windows server 2008及以后的服務器版本呢,windows7是不帶hyper-v功能的,但是win7上可以安裝hyper-v管理器,管理器是讓我們連接到服務器端的hyper-v虛擬機,但是本身不能創建虛擬機,具體如何在windows7上安裝hyper-v管理器可以參考文章:

INSTALLING HYPER-V MANAGER ON WINDOWS 7

windows 7在工作組模式下管理 Hyper-V

Hyper-V Remote Management Configuration Utility

Installing Hyper-V on Windows 7這個貼子上也討論了,不能在windows7上安裝hyper-v。

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM