[IT Pro Con NYC 2016] Minecraft Server 1.9 running on Nano Server 2016 TP4

Hi Everyone,

After having skipped 2015, the NY Techstravaganza team decided to revive the event and we gave it a new name: IT Pro Con NYC. As usual, we had different tracks:

As a board member of the Enterprise Windows User Group, I worked on the Windows Track and managed to get great speakers to come to New York and speak about: Datacenters networking, Windows as a Service, OMS and EMS. And I couldn’t help it, I also decided to be part of the speakers line up and worked on a session about the upcoming windows 2016 feature: Nano Server.

All slide Decks will be available online but one of the biggest feedback we received from our attendees and speakers this year is that we should record the sessions and make them available online after the event. We’ll definitely evaluate the feasibility for the next events but in the meantime I wanted to write a blog post that summarizes what I presented in my session.

Introduction to Nano Server

The first part of my session covered general information about Nano Server and why Microsoft decided to follow that path. It was very short because I wanted to focus on demos, if you want more details, I recommend the following online resources.

Demo 1: Creating a Nano Server VHD

While working on my session, I couldn’t find one resource that showed everything about Nano Server. I did find several of them talking about one specific point at a time though. Therefore, I tried to build my session as a succession of demos with a final goal of having a Nano Server running a Minecraft 1.9 server. For those of you who don’t know, Minecraft Server runs on Java and I thought that it would be a good example of what is possible to do with Nano Server. The first step was of course to create a Nano Server VHD from scratch, the good point with Nano Server is that it is headless and therefore, all my demos were packed with PowerShell scripts that I can easily share on this blog. Here’s the first one:

Download Script

NOTE: The New-NanoServerImage cmdlet sometimes fails with an error complaining about not being able to load the WIM2VHD.WimFile type. I still don’t understand why this happens but it seems like Powershell ISE on Windows 10 fails to execute the C# code in the Convert-WindowsImage.ps1 script provided in the Windows Server 2016 TP4 ISO. To bypass this issue, run the script in powershell console and not the ISE.

Demo 2: Joining a Nano Server to a domain and customizing the Firewall Rules

Once my Nano Server was created, I joined it to a domain and enabled the File and Printer Sharing Firewall rules in order to be able to easily copy files to and from my newly created VM. This script uses Powershell Direct therefore you will need a Windows 10 or Windows Server 2016 machine running Hyper-V to use it. Also, this script requires an AD Domain to be created beforehand, in my case, the domain name was NANO.LAB. here’s the script of the second demo:

Download script

In this Demo, I also showed how to manage a Nano Server using Remote Server Management Tools. Unfortunately there was not script for that but you can refer to this blog article that I used to build my platform: http://blogs.technet.com/b/nanoserver/archive/2016/02/09/server-management-tools-is-now-live.aspx

Demo 3: Customizing the Nano Server image

At that point I had a running Nano Server joined to my domain but it had no additional feature and was not providing any services so I had to start customize it. Also, because I decided to run a Java Console application, I needed to add the Reverse Forwarders Package. Without this package, Java and other application making API calls that don’t exist anymore in Nano Server wouldn’t run properly. This script copies the CAB files from the Windows Server 2016 ISO to the Nano Server Drive and loads them using DISM.

Download Script

Demo 4: packaging a WSA based AppX and running Minecraft Server 1.9

This part is the most frustrating one, I tried as hard as I could to package Minecraft server into a Windows Server Apps (WSA) Based AppX and have the server run inside a Windows Service but the service would never launch. Is it a bug? did I miss something? I cannot tell and couldn’t find enough details on WSA to troubleshoot my package. The first step here is to put all the files needed in a folder and to create an application manifest with WSA extensions (which are not yet documented on MSDN). to run Minecraft Server, you need Java 64bits, therefore you need to download and install it on a 64Bit OS, then you need to copy the content of C:\Program Files\Java into your package folder. Then you need to download the Minecraft Server JAR file from minecraft.net and put it in your package folder which should look like that:

Minecraft Server creates several files the first time it runs, so I recommend to open a command prompt and try to run Minecraft server, it will create the default files but will stop because the EULA was not accepted.

Now, open the EULA.txt file and replace eula=false by eula=true, run the server again and wait for it to finish the world initialization as well as generation of working files which should look like this at the end.

Your package folder is now ready, you need to add a logo picture called logo.png and a manifest, this is the one I used (Please remember that this creates a service but the service won’t start)

Download Manifest File

You are now ready for the packaging, you will need Windows 10 SDK installed on your packaging machine in order to have access to the makeappx and other tools. The script below will

  1. create the appx package
  2. create the certificate referenced in the manifest
  3. export the certificate with Private key to a pfx file
  4. use the pfx file to sign the appx package
  5. copy the appx package to the nano server as well as the Minecraft server files (since the appx doesn’t work, we will run the Minecraft server from the command line directly)
  6. Create the firewall rules needed to allow clients to connect to the Minecraft server
  7. Launch the Minecraft server

Please note that the paths have been changed, you might want to modify this script to make it work

Download Script

We’re now all set the Minecraft server was started with the last line, and if your VM has access to the internet and the Mojang authentication server you should be able to connect to it using the Minecraft client.

Yes, yes … I was shot by a skeleton … I’m ashamed but to be very honest this was my reaction when I finally got in my Minecraft Server running on Nano Server and the sneaky skeleton took the opportunity to shoot me 🙂


2 thoughts on “[IT Pro Con NYC 2016] Minecraft Server 1.9 running on Nano Server 2016 TP4

    1. It was a proof of concept with limited resources on my VM. Therefore the perfs were not great but I’m sure that it can run smoothly with more RAM.
      I was never able to make it run as a service. Now that TP5 is out maybe there is more documentation but I haven’t checked yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s