Steps i did to install Apache2.4 on Windows Nano Server 2016
- I'm using VirtualBox 5 here for running VM's
- Client computer Windows 10 x64
- Download the Windows 2016 ISO from microsoft evaluation software
- Mount ISO image , copy the folder NanoServerImageGenerator from it somwhere convenient for your setup, i copied it to C:\ so C:\NanoServerImageGenerator is my working folder
- Copy vcruntime140.dll (search for it in C:\Windows\System32 folder, on a x64 windows ,with Visual C++ 2015 Redistributable installed)
, and httpd-2.4.23-x64-vc14-r3.zip to C:\NanoServerImageGenerator for convenience
You will need vcruntime140.dll version 14.x.+ for httpd-2.4.23-x64-vc14 (right click on it -> Properties -> Product Version should say 14.something)
Not sure if other libraries are needed , this worked for me
# All of the powershell commands are run from an elevated terminal
PS C:\WINDOWS\system32> cd C:\NanoServerImageGenerator
PS C:\NanoServerImageGenerator> Import-Module .\NanoServerImageGenerator.psm1
PS C:\NanoServerImageGenerator> dir
Directory: C:\NanoServerImageGenerator
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 9/11/2016 6:56 PM en-US
-a---- 3/25/2016 2:52 PM 162349 Convert-WindowsImage.ps1
-a---- 11/5/2016 9:33 AM 10064868 httpd-2.4.23-x64-vc14-r3.zip
-a---- 3/25/2016 2:52 PM 445 NanoServerImageGenerator.psd1
-a---- 3/25/2016 2:52 PM 81920 NanoServerImageGenerator.psm1
-a---- 9/11/2016 6:56 PM 391 NanoServerImageGenerator_d1079600-ad0a-4837-8ed9-ce3d6797f5a2_HelpInfo.xml
-a---- 6/9/2016 10:53 PM 87888 vcruntime140.dll
PS C:\NanoServerImageGenerator> Get-Item .\vcruntime140.dll | fl *
PSPath : Microsoft.PowerShell.Core\FileSystem::C:\NanoServerImageGenerator\vcruntime140.dll
PSParentPath : Microsoft.PowerShell.Core\FileSystem::C:\NanoServerImageGenerator
PSChildName : vcruntime140.dll
PSDrive : C
PSProvider : Microsoft.PowerShell.Core\FileSystem
PSIsContainer : False
Mode : -a----
VersionInfo : File: C:\NanoServerImageGenerator\vcruntime140.dll
InternalName: vcruntime140.dll
OriginalFilename: vcruntime140.dll
FileVersion: 14.00.24210.0 built by: VCTOOLSREL
FileDescription: Microsoft® C Runtime Library
Product: Microsoft® Visual Studio® 2015
ProductVersion: 14.00.24210.0
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: English (United States)
BaseName : vcruntime140
Target : {}
LinkType :
Name : vcruntime140.dll
Length : 87888
DirectoryName : C:\NanoServerImageGenerator
Directory : C:\NanoServerImageGenerator
IsReadOnly : False
Exists : True
FullName : C:\NanoServerImageGenerator\vcruntime140.dll
Extension : .dll
...
PS C:\NanoServerImageGenerator> New-NanoServerImage -DeploymentType Host -OEMDrivers -Edition Standard -MediaPath "F:\" -ComputerName nanoserver -AdministratorPassword $(ConvertTo-SecureString -AsPlainText -Force "P@ssword") -CopyFiles .\vcruntime140.dll,.\httpd-2.4.23-x64-vc14-r3.zip -TargetPath .\nano.vhd
PS C:\NanoServerImageGenerator> Set-Item WSMan:\localhost\Client\TrustedHosts -Value *
PS C:\NanoServerImageGenerator> Get-Item WSMan:\localhost\Client\TrustedHosts
WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Client
Type Name SourceOfValue Value
---- ---- ------------- -----
System.String TrustedHosts *
PS C:\NanoServerImageGenerator> dir
Directory: C:\NanoServerImageGenerator
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 9/11/2016 6:56 PM en-US
-a---- 3/25/2016 2:52 PM 162349 Convert-WindowsImage.ps1
-a---- 11/5/2016 9:33 AM 10064868 httpd-2.4.23-x64-vc14-r3.zip
-a---- 11/5/2016 11:20 AM 710089216 nano.vhd
-a---- 3/25/2016 2:52 PM 445 NanoServerImageGenerator.psd1
-a---- 3/25/2016 2:52 PM 81920 NanoServerImageGenerator.psm1
-a---- 9/11/2016 6:56 PM 391 NanoServerImageGenerator_d1079600-ad0a-4837-8ed9-ce3d6797f5a2_HelpInfo
.xml
-a---- 6/9/2016 10:53 PM 87888 vcruntime140.dll
- Create a new VirtualBox VM , choose Win 2012 x64 , attach the nano.vhd when asked about virtual hard disk , for the network interface i've selected Bridged Adapter for ease of use
- Start the VM , login with Administrator/P@ssword (if you didn't change it), select Networking -> Ethernet , to see your IP address (mine was 192.168.133.224)
PS C:\NanoServerImageGenerator> Enter-PSSession 192.168.133.224 -Credential administrator
[192.168.133.224]: PS C:\Users\Administrator\Documents> cd\
[192.168.133.224]: PS C:\> dir
Directory: C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 7/16/2016 5:20 AM Program Files
d----- 7/16/2016 5:09 AM Program Files (x86)
d-r--- 11/5/2016 2:06 AM Users
d----- 11/5/2016 1:58 AM Windows
-a---- 11/5/2016 12:33 AM 10064868 httpd-2.4.23-x64-vc14-r3.zip
-a---- 6/9/2016 12:53 PM 87888 vcruntime140.dll
[192.168.133.224]: PS C:\> Expand-Archive .\httpd-2.4.23-x64-vc14-r3.zip
[192.168.133.224]: PS C:\> mv .\httpd-2.4.23-x64-vc14-r3\Apache24\ .
[192.168.133.224]: PS C:\> rm .\httpd-2.4.23-x64-vc14-r3\ -Force -Recurse
[192.168.133.224]: PS C:\> cp .\vcruntime140.dll .\Apache24\bin\
[192.168.133.224]: PS C:\> .\Apache24\bin\httpd.exe -k install -n "httpd"
.\Apache24\bin\httpd.exe : Installing the 'httpd' service
+ CategoryInfo : NotSpecified: (Installing the 'httpd' service:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
The 'httpd' service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
# this is complaining about ServerName warning/error not set globally , you can ignore it
[192.168.133.224]: PS C:\> Get-Service httpd
Status Name DisplayName
------ ---- -----------
Stopped httpd httpd
[192.168.133.224]: PS C:\> Start-Service httpd
[192.168.133.224]: PS C:\> Get-Service httpd
Status Name DisplayName
------ ---- -----------
Running httpd httpd
[192.168.133.224]: PS C:\> New-NetFirewallRule -Name "Allow-Web-Service" -DisplayName "Allow incoming connection on TCP port 80" -Enabled True -Profile Any -Direction Inbound -Action Allow -Protocol TCP -LocalPort 80
Name : Allow-Web-Service
DisplayName : Allow incoming connection on TCP port 80
Description :
DisplayGroup :
Group :
Enabled : True
Profile : Any
Platform : {}
Direction : Inbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
- Point your browser to http://192.168.133.224 in my case , yours will be different and you should see the apache index
Note: if you want to run your Nano server in Hyper-V , since you don't need the OEMDrivers (which take up more space ,and take longer to generate the virtual disk) , you can use this command to generate the vhd instead
PS C:\NanoServerImageGenerator> New-NanoServerImage -DeploymentType Guest -Edition Standard -MediaPath "F:\" -ComputerName nanoserver -AdministratorPassword $(ConvertTo-SecureString -AsPlainText -Force "P@ssword") -CopyFiles .\vcruntime140.dll,.\httpd-2.4.23-x64-vc14-r3.zip -TargetPath .\nano.vhd
Thanks for posting your experience installing on this new version of Windows. :)
no problem :) , i also wrote the same article on microsoft's technet wiki
also managed to have full WAMP stack installed , but it's tricky since you don't have full .net framework and/or visual c++ redistributable
which also means that you can't even run , basic console based text editor like vim or nano for windows or any other shell like mysql client, php interactively on Nano Server
the good thing is that you can copy files to remote machine through powershell sessions , and you can edit files remotely with Powershell ISE using PSEdit command , i will add the continuation in a couple of days although i would rather use Windows Server Core to run WAMP