We all have seen all the great new announcements about Azure Stack, System Center 2016, Server 2016 and off course Nano Server. In this post i am going ahead of preparing the new Azure Stack in my environment. In Azure Stack you can create Compute and Storage resources. The details about that i will save for a later blog post. Lets first start by creating an nano cluster. I am going to create a 2 node cluster.
So i created the following script to create the nano server. In order to successful run the script i need to have the prereqs listed on http://aka.ms/nanoserver in place. So i have the Convert-WindowsImage.ps1 downloaded and copied over the Nano.wim, Nano Packages and DISM files from the TP2 DVD and prepared an unattend.xml.
First i prepared the vhd:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
md C:\NanoServer cd C:\NanoServer .\Convert-WindowsImage.ps1 -Sourcepath .\NanoServer.wim -edition 1 -vhdpath .\NanoServer.vhdx -VHDFormat VHDX -VHDPartitionStyle GPT rm .\mountdir -Force -Recurse md .\mountdir dism\dism /Mount-Image /ImageFile:.\NanoServer.vhdx /Index:1 /MountDir:.\mountdir md .\mountdir\Windows\Setup md .\mountdir\Windows\Setup\Scripts md .\mountdir\windows\panther #select package you want to install #Hyper-V role dism\dism /Add-Package /PackagePath:.\packages\Microsoft-NanoServer-Compute-Package.cab /Image:.\mountdir dism\dism /Add-Package /PackagePath:.\packages\en-us\Microsoft-NanoServer-Compute-Package.cab /Image:.\mountdir #Failover Clustering dism\dism /Add-Package /PackagePath:.\packages\Microsoft-NanoServer-FailoverCluster-Package.cab /Image:.\mountdir dism\dism /Add-Package /PackagePath:.\packages\en-us\Microsoft-NanoServer-FailoverCluster-Package.cab /Image:.\mountdir #File Server role and other storage components dism\dism /Add-Package /PackagePath:.\packages\Microsoft-NanoServer-Storage-Package.cab /Image:.\mountdir dism\dism /Add-Package /PackagePath:.\packages\en-us\Microsoft-NanoServer-Storage-Package.cab /Image:.\mountdir #Drivers for hosting Nano Server as a virtual machine dism\dism /Add-Package /PackagePath:.\packages\Microsoft-NanoServer-Guest-Package.cab /Image:.\mountdir dism\dism /Add-Package /PackagePath:.\packages\en-us\Microsoft-NanoServer-Guest-Package.cab /Image:.\mountdir #Basic drivers for a variety of network adapters and storage controllers dism\dism /Add-Package /PackagePath:.\packages\Microsoft-NanoServer-OEM-Drivers-Package.cab /Image:.\mountdir dism\dism /Add-Package /PackagePath:.\packages\en-US\Microsoft-NanoServer-OEM-Drivers-Package.cab /Image:.\mountdir dism\dism /Unmount-Image /MountDir:.\MountDir /Commit |
If you get the error when running convert-windowsimage about “Windows version not compatible” you need to hack the script to allow your windows 10 or Server 2016 Tp2 version run the script. Just return $true on line 3047 and comment out all lines in that function.I know its not the right way, but worked for me. When i unmounted the disk i made a copy of the VHD as reference for other nodes of the cluster. Next i prepared the unattend.xml. The XML i used is here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<?xml version='1.0' encoding='utf-8'?> <unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <settings pass="offlineServicing"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> <ComputerName>NSFSN02</ComputerName> </component> </settings> <settings pass="oobeSystem"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> <UserAccounts> <AdministratorPassword> <Value>Tuva</Value> <PlainText>true</PlainText> </AdministratorPassword> </UserAccounts> <TimeZone>W. Europe Standard Time</TimeZone> </component> </settings> <settings pass="specialize"> <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> <RegisteredOwner>Mark Scholman</RegisteredOwner> <RegisteredOrganization>INOVATIV</RegisteredOrganization> </component> </settings> </unattend> |
Then i run per copied VHDX (for each node in my new cluster) the following script (first edit the content to match the specific node settings by editing the IP address in this script and the server name in the unattend.xml. As this is my lab i set Firewall to allow any. You might want to change that according your environment)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
rm .\mountdir -Force -Recurse md mountdir dism\dism /Mount-Image /ImageFile:.\NanoServer.vhdx /Index:1 /MountDir:.\mountdir Set-Content -Value "ping 127.0.0.1 -n 4" -Path .\SetupComplete.cmd -Encoding Ascii Add-Content -Value "netsh interface ip set address `"Ethernet`" static 10.10.0.12 255.255.255.0 10.10.0.1" -Path .\SetupComplete.cmd -Encoding Ascii Add-Content -Value "netsh interface ip add dns `"Ethernet`" 10.10.0.46" -Path .\SetupComplete.cmd -Encoding Ascii Add-Content -Value "hostname" -Path .\SetupComplete.cmd -Encoding Ascii Add-Content -Value "netsh advfirewall firewall add rule name=`"Local Any`" dir=in action=allow profile=any remoteip=any" -Path .\SetupComplete.cmd -Encoding Ascii dism\dism /Apply-Unattend:unattend.xml /Image:.\mountdir copy .\unattend.xml .\mountdir\windows\panther copy .\SetupComplete.cmd .\mountdir\Windows\Setup\Scripts dism\dism /Unmount-Image /MountDir:.\MountDir /Commit |
When the image is prepared i created the VM and moved the disk to the VM folder and booted it. I need to repeat the last script with the copied disk i made before. When both VMs are created and up and running we can join it to the domain
First i need to prepare the domain join config by running this on my domain controller:
1 2 |
#On domain controller run this command: djoin.exe /provision /domain AZURE.LAB /machine <nodename> /savefile .\odjblob |
Next i need to copy that file to my nano server. you can do that simply by using unc path to C$ of the nano server. When the file is copied i need to remote into the nano server or use invoke-command to join it to the domain.
1 2 3 4 5 6 7 |
#Copy the domain join file to the node c:\ #Then remote powershell into the node and run this Enter-PSSession <node> -Credential Administrator #use djoin to join it to the domain djoin /requestodj /loadfile C:\odjblob /windowspath C:\Windows /localos #reboot nano node Shutdown -r -t 0 |
And your node is joined to the domain. I have only 1 Domain controller running TP2 preview so i installed all RSAT features on that box so i can have some management consoles.
Now next step is to prepare the cluster. As i have the FailoverCluster tools installed i ran the following:
1 2 |
$Servers = 'NSFSN01','NSFSN02' New-cluster -name NSFSCL01 -node $Servers -StaticAddress 10.10.0.13 |
And my cluster is running. Now if you want to setup Compute or Storage resources its a matter of using remote tools to configure the nodes.
I hope this gave you a quick overview of how to configure Nano Server Cluster.