Microsoft IIS 10.0 – Installing IIS 10.0 on Nano Server

File Management Commands in Linux

In this recipe, we are going to install IIS 10.0 on Nano Server. We will create a Nano Server 2016 virtual machine by using PowerShell, which will be attached to our Hyper-V host server. We can use PowerShell commands to install IIS on Nano Server 2016.

Getting ready

To step through this recipe, we are going to create a Nano Server instance with IIS 10.0 using PowerShell commands. You will need a Windows Server 2016 virtual instance or a physical one of Nano Server 2016, and you also need Windows Server 2016 media. You already have a Hyper-V Host ready, where you have to attach your virtual machine. For the installation and configuration, you should have administrative privileges.

How to do it…

  1. Log in to Windows Server 2016. The IP of our Windows Server 2016 instance is 172.16.15.60 and the name is WIN2016IIS, as shown in figure.
  2. Mount the Windows Server 2016 media ISO on a CD drive. Open the CD drive, and you will find the NanoServer folder:
  1. Copy the NanoServer folder from from the DVD/CD drive (D: in this case), and paste it into the C: local disk drive:
  1. You can see in the figure that inside the NanoServer folder, you should have the following folders and files: Base, NanoServerImageGenrator, Packages, NanoServer.wim, and Nano123.vhd. Now you can close the NanoServer folder.
  2. Next, you have to open PowerShell with administrator rights. Press Windows + R key from the keyboard. You will get the Run window:
  1. Type the command RunAs /user:Administrator PowerShell_ISE.exe and press OK. Now it will ask you the administrator password. Type the administrator password and press Enter. You will get the PowerShell command window:
  1. You have to first set the execution policy to RemoteSigned. Type into the PowerShell command prompt Set-ExecutionPolicy RemoeSigned and press Enter. The Execution policy window will pop up. Press Yes or Yes to all.
  2. Next, you have to import the NanoServerImageGenerator module. Type into the PowerShell command prompt Import-Module C:\nanoserver\NanoServerImageGenerator and press Enter. Your selected folder’s files are imported into the module.
  3. Next, we set the RemoteSigned policy and import the module for NanoServerImageGenerator.

 

 

  1. Let’s create the Nano Server image with our IIS module. Type the following command in PowerShell:

      New-NanoServerImage -Edition Standard -DeploymentType Guest -MediaPath c: -BasePath .Base -TargetPath c:\nanoserver\Nano.vhd -ComputerName Nano -Package Microsoft-NanoServer-IIS-Package
  1. With this command, we are creating a VHD from the NanoServer folder, which is available in C:. When creating the VHD, it will use a folder called Base in the same directory where you run New-NanoServerImage: it will place the VHD (called Nano.vhd) in a folder in C:\NanoServer. The computer name will be Nano. The resulting VHD will contain the Standard edition of Windows Server 2016 and will be suitable for Hyper-V virtual machine deployment. Offline installation of IIS on Nano Server is recommended by Microsoft. We will use the -Package parameter to add the package while we create the new Nano Server.
  2. Run the command New-NanoServerImage -Edition Standard -DeploymentType Guest -MediaPath c:\ -BasePath .\Base -TargetPath c:\nanoserver\Nano.vhd -ComputerName Nano -Package Microsoft-NanoServer-IIS-Package in PowerShell. You have to the set the administrator password for Nano Server, as shown in the following screenshot. This password will be required in the future to use Nano Server.
  1. You can choose your own password for Nano Server 2016. Press the OK button, and you will get the process window, as shown here:
  1. Once the processing for New-NanoServerImage is complete, you will get the Nano.vhd file under the C:\NanoServer folder. That’s it! We get a message in PowerShell saying Done. The log is at C:\BaseLogs2017-04-08_23-12-34-41. Let’s go to the C:\NanoServer folder and check whether Nano.vhd is available:
  1. Copy the Nano.vhd file from the C:\NanoServer folder and paste it into the Hyper-V host (IP 172.16.15.181) server’s D:\vhdx folder. We’ve created a virtual machine and attached Nano.vhd to the Nano Server 2016 virtual machine:
  1. Click on OK to close the Nano Server 2016 settings window.
  2. Go to the HV1-Host (172.16.15.181) server, open Hyper-V Manager, go to the Virtual Machines pane, and select the Nano server 2016 VM. Go to the Nano Server 2016 Actions pane, and power on Nano server 2016. Next, you have to click on C onnect to view the server login screen. Type the admin username and password (your own password you set while creating the Nano Server instance), press Enter, and you will be logged in.

 

 

  1. Now, you have to set the IP address for Nano Server. Once you have logged in to the server, you will get the Networking option. Select the network and press Enter, and you will get the Network Adapter property window:
  1. You have to press F11 to set up IPv4. You can enter the Nano Server IP address, gateway, and subnet; I’ve made entries for IP as 172.16.15.63, gateway as 172.16.15.254, and subnet as 255.255.255.0. You can set an IP address as per your network configuration.
  2. Press Esc and close Nano Server. Once we’ve installed the IIS package, a default rule will be created in the Nano server firewall to allow ports 80 and 443.
  3. Next, come to the WIN2016IIS server, open Internet Explorer, type the IP address of our Nano Server instance (172.16.15.63), and press Enter. You will see Open the IIS default page. We have already checked it out in this chapter.

 

How it works…

In this recipe, we installed IIS 10.0 on Nano Server and created a Nano Server 2016 virtual machine, which we attached to our Hyper-V host server. We set up the 172.16.15.63 IP address for Nano Server. We used PowerShell to install IIS on Nano Server 2016 and also modified the execution policy and set it to RemoteSigned. We then imported the NanoServerImageGenrator module to create a Nano Server instance through PowerShell. We also discussed how to create a new image through PowerShell commands.

Comments are closed.