有幸參加盆盆老師的微信課Windows Nano Server的介紹,有感這次盆盆老師的技術分享,是以簡單的分享一下如何制作Windows Nano Server的過程,同時也非常感謝盆盆老師的技術分享。
1.先下載下傳windows_server_technical_preview_2的iso(九叔無私分享提供):連結:http://pan.baidu.com/s/1gd8KP5D 密碼:c0tc
2.下載下傳轉換的腳本:https://gallery.technet.microsoft.com/scriptcenter/Convert-WindowsImageps1-0fe23a8f
3.下載下傳完畢windows_server_technical_preview_2,我們可以先挂載ISO,可以看到與以前的windows server 的ISO有所差別:

看到這麼多的cab,大家也好奇這是啥東東,按照我的了解是跟windows添加角色功能的一樣的,隻不過是用cab打包好。如果我們需要,就打上相應的cab包添加角色。
Role or feature
Package file
Hyper-V 角色
Microsoft-NanoServer-Compute-Package.cab
故障轉移群集角色
Microsoft-NanoServer-FailoverCluster-Package.cab
NanoServer主機虛拟機驅動(我更喜歡叫它內建服務)
Microsoft-NanoServer-Guest-Package.cab
存儲和網卡驅動
Microsoft-NanoServer-OEM-Drivers-Package.cab
檔案伺服器角色和其他存儲元件
Microsoft-NanoServer-Storage-Package.cab
從這裡,我們可以看出Windows Nano Server 在整個Windows架構上可以作為Hyper-v,群集,擴充檔案伺服器,容器container以及來賓虛拟機。
4.我們就開始制作Windows Nano Server吧。先解除腳本的鎖定,
5.運作腳本
腳本格式如下:.\Convert-WindowsImage.ps1 -Sourcepath <path to wim> -VHD <path to new VHD file> –VHDformat VHD -Edition 1
PS:這個制作過程大概不超過5分鐘,整個vhd大概是483MB。
6.将vhd在windows Server TP2運作(目前隻支援在TP2的環境運作),當然需要配置一下才可以作為VM運作。
1)需要在磁盤建立一個目錄名NanoServer
2)将windows Server TP2 iso裡面提取cab複制到NanoServer裡面
3)建立一個目錄名為mountdir的檔案
4)将nano.vhd挂載映像的形式挂載到mountdir目錄下
dism /Mount-Image /ImageFile:c:\Nano.vhd /Index:1 /MountDir:.\mountdir
5)将Microsoft-NanoServer-Guest-Package.cab加載到NanoServer裡面(盆盆老師說過nano作為VM的時候要加載這個cab,後來我自己試過沒加載這個cab包啟動vm,一直都是啟動界面的)
dism /Add-Package /PackagePath:.\packages\Microsoft-NanoServer-Guest-Package.cab /Image:.\mountdir
6)這一步是為了顯示NanoServer 的ip資訊(因為隻有第一次啟動nanoserver的時候,才會顯示ip資訊),建立兩個檔案,分别為SetupComplete.cmd和Startup.cmd.
SetupComplete.cmd腳本如下:
netsh advfirewall set domainprofile state off
netsh advfirewall set privateprofile state off
netsh advfirewall set publicprofile state off
netsh advfirewall set currentprofile state off
ipconfig
schtasks /create /tn "Start" /tr c:\windows\system32\Startup.cmd /sc onstart /ru "System"
Startup.cmd腳本如下:
ping 192.168.10.101 -n 7
ipconfig
先為SetupComplete.cmd建立腳本檔案夾
md .\mountdir\Windows\Setup\Scripts
将兩個腳本copy到NanoServer裡面
copy .\SetupComplete.cmd .\mountdir\Windows\Setup\Scripts
copy .\Startup.cmd .\mountdir\Windows\System32
7)解除安裝NanoServer映像
dism /Unmount-Image /MountDir:.\MountDir /Commit
7.建立虛拟機,挂載nano.vhd,啟動虛拟機
8.通過PowerShell連接配接NanoServer
腳本如下:
$ip=”nano server ip address”
$user=”$ip\administrator”
Enter-PSSession -ComputerName $ip -Credential $user
administrator初始密碼為空
就可以看到NanoServer的連接配接會話
NanoServer概述和配置具體詳情可以通路:https://technet.microsoft.com/en-gb/library/mt126167.aspx
NanoServer啟動腳本配置可以通路:http://blogs.technet.com/b/nanoserver/archive/2015/05/19/how-to-display-ipconfig-on-nano-server-every-time-it-boots.aspx
如果本文章有什麼遺漏或者需要補充什麼,麻煩指點下,多謝。