Windows Azure 部署 Windows 8 虚拟机

时间:2023-03-09 08:11:09
Windows Azure 部署 Windows 8 虚拟机

基本步骤其实很简单,主要有:

  • 本地部署虚拟机
  • 将虚拟机VHD上传至Azure
  • 在Azure上根据VHD生成映像
  • 利用映像生成虚拟机

下面我们开始:

1,本地部署虚拟机

首先我们需要在本地用 Hyper-V 建立一个 win8 虚拟机,推荐建立企业版的

我之前用win8 pro部署到 Azure 上生成虚拟机的时候卡死了…

稳妥起见建议用win8企业版

新建虚拟机

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

开始安装 win8 企业版

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

安装完成,重启配置系统

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

系统安装完成,稳妥起见你可以现在系统上开启远程桌面,并且给管理员账户加个密码…

不过这两步不是必须的…,Azure已经可以在建立虚拟机时自动新建管理员账户和开启远程桌面

而且 Azure 上会自动激活系统,在你本地的虚拟机中不需要激活

当然你也可以给系统做一些针对性的配置或安装特定应用

不过我只是测试就啥也不用装了

直接开始 sysprep

在路径 C:\Windows\System32\Sysprep 下运行 sysprep.exe

Windows Azure 部署 Windows 8 虚拟机

选择执行完毕后关机

Windows Azure 部署 Windows 8 虚拟机

运行 sysprep

Windows Azure 部署 Windows 8 虚拟机

运行完毕后,虚拟机自己关机

我们虚拟机的步骤就完成了

下面需要将虚拟机磁盘上传至Azure.

2,将虚拟机磁盘上传至Azure

要将虚拟机磁盘上传至 Azure,首先我们要知道 Azure 目前只支持 vhd 格式的虚拟盘

而 Win8 和 Server2012 建立的虚拟机是 vhdx 的…

好在我们还有 Powershell:

Windows Server 2012 and Windows 8 :http://technet.microsoft.com/zh-cn/library/hh848454(v=wps.620).aspx

Windows Server 2012 R2 and Windows 8.1 :http://technet.microsoft.com/zh-cn/library/hh848454(v=wps.630).aspx

我是在win8.1上,打开Powershell,将刚才的虚拟机磁盘从 vhdx 转换为 vhd

Windows Azure 部署 Windows 8 虚拟机

转换中

Windows Azure 部署 Windows 8 虚拟机

转换完成

Windows Azure 部署 Windows 8 虚拟机

然后我们需要在 Azure 上新建一个存储(当然用之前创建的也行),好将 vhd 磁盘上传上去,

Windows Azure 部署 Windows 8 虚拟机

建立好存储后,我们在存储中建立容器

Windows Azure 部署 Windows 8 虚拟机

容器建立完成,在 Azure上的工作就做完了

下一步是上传 vhd 磁盘

这里我们需要一个工具:Windows Azure PowerShell

我们通过Microsoft Web Platform Installer安装 Windows Azure PowerShell

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

安装完成,我们在程序中找到 Windows Azure PowerShell,运行

Windows Azure 部署 Windows 8 虚拟机

Windows Azure PowerShell 连接自己的的 Azure 有几种方式,详细见:https://www.windowsazure.com/en-us/manage/install-and-configure-windows-powershell/?fb=zh-cn

这里我们用证书的方式登陆吧,首先获取证书

Windows Azure 部署 Windows 8 虚拟机

下载证书

Windows Azure 部署 Windows 8 虚拟机

导入证书

Windows Azure 部署 Windows 8 虚拟机

然后我们就连接上我们的 Azure 了,执行下命令看看效果

Windows Azure 部署 Windows 8 虚拟机

然后我们上传 vhd 磁盘

Add-AzureVhd -Destination http://容器地址/win81.vhd -LocalFilePath e:\win8.1.vhd

Windows Azure 部署 Windows 8 虚拟机

Windows Azure 部署 Windows 8 虚拟机

上传完成

Windows Azure 部署 Windows 8 虚拟机

然后我们就可以在容器内看到我们刚才上传的 vhd 磁盘

Windows Azure 部署 Windows 8 虚拟机

然后下一步,我们要从 vhd 创建映像

3,在Azure上根据VHD生成映像

我们再回到 Azure 上,在 虚拟机--映像 中创建映像

Windows Azure 部署 Windows 8 虚拟机

选择我们刚才上传的 VHD 文件

Windows Azure 部署 Windows 8 虚拟机

创建完成

Windows Azure 部署 Windows 8 虚拟机

最后,终于可以利用映像生成虚拟机了

4,利用映像生成虚拟机

我们在 Azure 上从库中新建虚拟机,可以看到我们刚才的映像已经出现在”我的映像“中了

Windows Azure 部署 Windows 8 虚拟机

选中映像,开始配置虚拟机参数

Windows Azure 部署 Windows 8 虚拟机

继续进行配置

Windows Azure 部署 Windows 8 虚拟机

打开的端口,默认已经加入了3389

Windows Azure 部署 Windows 8 虚拟机

然后开始创建,比快速创建虚拟机要慢一点

Windows Azure 部署 Windows 8 虚拟机

经过一段时间的等待,创建成功

Windows Azure 部署 Windows 8 虚拟机

然后我们可以远程桌面进去看一下,系统也已经自动激活

Windows Azure 部署 Windows 8 虚拟机

到这里,我们已经成功在 Azure上部署了 Win8 虚拟机,另外 Win7 企业版按照这个步骤应该也是可以成功部署的。

有时间大家可以自己动手试下