Quite an informal use for a website that is supposedly supposed to say a lot about the owner. Nonetheless, I have gone through what should’ve have been a painless process of linking a subdomain to a minecraft server’s IP address and will divulge what I’ve learned.

For the most part, one can follow the Mac setup guide found on minecraft’s unofficial but really official looking wiki page:

http://minecraft.gamepedia.com/Tutorials/Setting_up_a_server#OS_X_Yosemite_instructions

Getting/Installing/Running the minecraft server:

I will assume that java is already installed on your computer but there was a minor blip in the process that I myself am not too sure about. I personally have Java 1.7.0 running on my Mac for school purposes, but when I running the minecraft_server.jar file it says that it is running with Java 1.8 which I find odd because I don’t have Java 1.8 installed. Who knows. To check your version of Java you can either type into terminal, java –version or navigate to your java folder in your /Library folder and see which version you have in the JavaVirtualMachines folder.

I downloaded the server file directly from Mojang’s site:¬†https://minecraft.net/download and the downloaded file’s name, for me, was minecraft_server.1.8.3.jar. Now according to official documentation, in order to “automate the running of the server process”, one should create a file with the following code:

#!/bin/bash
cd “$(dirname “$0″)”
exec java -Xms1G -Xmx2G -jar minecraft_server.jar nogui

and save it as start.command. The problem I had with this was that terminal would throw this error:

clays-air:~ clayshieh$ /Users/clayshieh/minecraft/start.command ; exit;
Error: Unable to access jarfile minecraft_server.jar
logout

Which is quite confusing considering that both the download page and the wiki page state that this is the right thing to do. Well from the obvious look of things, I simply changed the start.command file to:

#!/bin/bash
cd “$(dirname “$0″)”
exec java -Xms1G -Xmx2G -jar minecraft_server.1.8.3.jar nogui

Notice the added “.1.8.3″. With that, everything proceeded smoothly.

Linking a subdomain to the minecraft server’s IP address

This part of the post will have assumed that you’ve figured out your connection/port forwarding settings so that the rest of the world can access your minecraft server, when it’s running, via your external IP or an address provided by software such as Hamachi.

My website is hosted on Hostmetro which gives its users a very standard cPanel to manage their “shared hosting”. To create a subdomain, just simply login to your cPanel and click on subdomain. There, just type in your desired subdomain name which in my case was, mc.clayshieh.com. That was my mistake. On the same row where you found the subdomain button, there are 6 options: Addon Domains, Subdomains, Aliases, Redirects, Simple Zone Editor and Advanced Zone Editor. One would think that to create a valid subdomain, one would need to create it with the subdomain button first right? Yes for most cases. But in this case, because I am trying to link the URL so that it translates to my minecraft server’s IP address (really just my external IP address), what I really needed to do was create an A record with the name mc.clayshieh.com. So my guess is that, when creating a subdomain with the subdomain button, it was really creating another “valid website” setup that wouldn’t work with what I needed the URL to do. I ended up spending a one frustrating hour trying to get the subdomain to point to my external IP by changing all the subdomain aliases so that they would point to the IP address but with no results. What I actually needed to do was not create mc.clayshieh.com with the subdomain button and just directly click the Simple Zone Editor (or the Advanced Zone Editor and put 14400 in the TTL box) and add a A record with the name mc.clayshieh.com with my external IP as the address. Long story short, I looked into it and can’t figure out what the difference is between my logical way of creating a subdomain first and then changing all the related records to point to my external IP and the simple way of just adding it with the Simple Zone Editor.

What I did learn however, is that Hostmetro has zero to nil support officially and unofficially on sites like Stackoverflow which could be a turn off to most people but I’d imagine that the cPanel that Hostmetro uses is pretty standard compared to bigger hosting companies such as Hostgator and such. In addition to my disappointment, also picked up a few bits of technical knowledge such as the fact that A records, by definition, are used to map URL’s to IP address in the sense that it returns a 32 bit IPv4 address, namely my external IP, and the fact that most applications will by default know which port to use if using your external IP (i.e. Minecraft uses the port 25565 by default and so I only have to give it my external IP and it’ll default to port 25565 instead of me having to actually feed it :25565).

My thoughts probably got a bit jumbled up in the process of writing this up but it has been a while since I’ve wrote anything in my blog so give me a break!