This blog talks about setting up the IIS on nano server as a guest OS for the Hyper-V virtual machine. I shall write another blog on running my website on Nano within a container.
Before I get into installing IIS on Nano server in my hyper-V, let us get some background on Nano Server.
Nano Server:
Difference between Server Core and Nano Server:
Server Core:
Nano Server:
Note: Both run on physical and VM. Both run on the container. The dotnet core application which run on nano can run on server core too.
Creating the nano VHD:
I will be using a 180 day free trial ISO downloaded from the Evaluation Center site: https://www.microsoft.com/evalcenter/evaluate-windows-server-2016
Then follow the below steps in order:
1. Extract the ISO and you should be having it in your storage drive. I had it inside my F:\ drive
2. I created a sample folder C:\Nano\ and placed the NanoServerImageGenerator folder from the F:\NanoServer folder which we extracted in Step 1
3. Start Windows PowerShell as an administrator, Navigate to the folder C:\Nano\NanoServerImageGenerator\ and run the powershell command: Import-Module .\NanoServerImageGenerator.psm1 -Verbose
4. After this, you need to run the below command to create a nano server VHD which can be imported as a Guest OS in our Hyper V:
PS C:\nano> New-NanoServerImage -edition Standard -MediaPath F:\ -BasePath C:\nano -targetPath C:\nano\nanodemo.vhdx -deploymentType Guest -Computername nanodemo -storage -Package Microsoft-NanoServer-IIS-Package
This command copies the necessary files from media path F:\ drive into my base path C:\nano\. It converts the Nano Server .wim file into a .vhd file. It then moves the newly created standard edition of VHD to my target path. I have given my computer name as nanodemo and since I will be using it as a Guest OS, I have mentioned Guest in my deploymentType.
I am installing the IIS role using the -package switch while creating the VHD. Note that you can also install the IIS feature later, I will be explaining it later in this blog.
5. It will also prompt you for providing the administrator password. Remember this password and you are expected to provide this password while you login to your nano server.
Setting up the VM:
I have installed the Hyper-V role in my Host machine.
Configuring the Nano Server:
Accessing nano server remotely:
$server="nanodemo"
Enter-PSSession -VMName $server -Credential administrator
The above command will prompt you to enter the administrator credentials. On successful login, the powershell is ready to accept your commands:
[nanodemo]: PS C:\Users\administrator\Documents>
Install-PackageProvider NanoServerPackage
Import-PackageProvider NanoServerPackage
Install-NanoServerPackage -Name Microsoft-NanoServer-IIS-Package
To see all the available packages on Nano server, you can use the command: Find-NanoServerPackage
Creating IIS website:
Import-Module iisadministration
New-IISSite -Name samplesite -BindingInformation "*:80:" -PhysicalPath C:\inetpub\samplesite
3. After this you can access the website:
References:
https://docs.microsoft.com/en-us/windows-server/get-started/nano-server-quick-start
https://docs.microsoft.com/en-us/windows-server/get-started/getting-started-with-nano-server
https://docs.microsoft.com/en-us/windows-server/get-started/iis-on-nano-server
Hope this helps
Author: Naveen Baliga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.