In Windows Server 2016, in addition to familiar Server Core and Full GUI, there is another installation option called Nano Server. Nano Server is a more compact version of Windows Server installation designed to run cloud containers and apps. To reduce the size of the system, all roles, components and drivers are taken out of the Nano Server image. You can download and install them as packages. You can get these packages from Windows Server 2016 distribution image (..\Nano Server\Packages), or from the online package repository. In this article we’ll talk about the peculiarities of package management in Windows Nano Server 2016.
Nano Server Packages can be compared to Windows Server roles and components that can be installed by an administrator if necessary. You can install a package in the Nano Server image from a host system during deployment (using New-NanoServerImage cmdlet), when editing the image (Edit-NanoServerImage), or using DISM or PackageManagement module (aka OneGet).
Connect to a deployed Nano VM from a Hyper-V host:
Enter-PSSession Nano1
Download and import NanoServerPackage module for PowerShell:
Save-Module -Path “$env:ProgramFiles\WindowsPowerShell\Modules” -Name NanoServerPackage -MinimumVersion 1.0.0.0
Import-PackageProvider NanoServerPackage
Display the list of available Nano Server packages as follows:
find-NanoServerPackage -Name *
Or using a more general command:
Find-Package -ProviderName NanoServerPackage
To install a package (e. g., a storage component package — Storage Package) on a running Nano Server, run this command:
Install-NanoServerPackage -Name Microsoft-NanoServer-Storage-Package
To install and start IIS services from PowerShell, the installation command will look like this:
Install-Package -ProviderName NanoServerPackage -Name Microsoft-NanoServer-IIS-Package
Start-Service WAS
Start-Service W3SVC
You can install a Nano package offline directly into the VHD/VHDX file of a virtual machine:
Install-NanoServerPackage -Name Microsoft-NanoServer-Storage-Package -culture en-us -RequiredVersion 10.0.14300.0 -ToVHd C:\VMstore\nano1\Nano1.vhd
The latest version of a Nano package can be downloaded from the official repository and added to the list of available packages:
Find-NanoServerPackage -Name *Storage* -MaximumVersion 10.2 -MinimumVersion 1.0 -Culture en-us | Save-NanoServerPackage -Path C:\NanoBase\Packages
You can get the list of the installed packages in the system online using this command:
Get-Package
Or in offline mode based on the data in the VHD file of Nano VM image:
Get-Package -provider NanoserverPackage -fromVhd C:\VMstore\nano1\Nano1.vhd
If the host machine and Nano Server are not connected to the Internet, you can add a component to the system image from a CAB file using DISM:
dism.exe /Mount-Image /ImageFile:C:\VMstore\nano1\Nano1.vhd /index:1 /mountdir:c:\mountdir
dism.exe /add-package /packagepath:c:\nanoserver\packages\Microsoft-NanoServer-IIS-Package_en-US.cab /image:c:\mountdir
dism.exe /unmount-image /mountdir:c:\mountdir /commit