How to Install Minecraft Server on Windows 8 Hyper-V Ubuntu Server in 60s
We have had many readers ask how to setup their own Minecraft server. For those that do not know, Minecraft is a breakout hit in gaming selling many millions of copies yet starting from an independent developer. One of the great things about Minecraft’s independent route to market is that there is no “corporate” server requirement which plagues games like recent installments of Call of Duty. That means users are free to setup their own Minecraft servers at home, colocated or elsewhere. The model is very reminiscent to the Counter-Strike scene in the 2000-2001 time frame. Today we are going to show how to install Minecraft server on Windows 8 Hyper-V Ubuntu. This is an easy setup that uses little power and is great for hosting LAN games.
To make this as relevant as possible to the test case my personal workstation is going to be used.
- CPU(s): Intel Core i7-3930K
- Motherboard: ASUS P9X79 WS
- Memory: 32GB (8x 4GB) G.Skill Ripjaws X DDR3 1600
- Drives: Corsair Force3 120GB, OCZ Vertex 3 120GB and 2x Samsung 840 Pro 256GB
- Chassis: Corsair Carbide 500R
- Power Supply: Corsair AX850 850w 80 Plus Gold
- OS: Microsoft Windows 8 Pro with Hyper-V and Ubuntu Server 12.10
One key aspect here is that the machine has a lot of very fast SSD storage. Traditional rotating disks can cause a Minecraft server to hang for players during disk access.
Prerequisite: Install Ubuntu on Windows 8 Hyper-V
Installing Ubuntu on Windows 8 Hyper-V is very easy. Hyper-V integration components are included with the major distributions making installation faster than with CentOS and many other distributions. Use the guide on how to install Ubuntu on Windows 8 Hyper-V in a few minutes. For a Minecraft server it is suggested that one uses the x64 server version. The workstation version uses more disk space and requires additional memory to run. Since Minecraft is very memory intensive, it is best to waste memory.
One major note here is that one wants the Minecraft server Hyper-V data store to run on a SSD.
Install Minecraft Server on Windows 8 Hyper-V Ubuntu in 60 seconds
Now for the fun part, getting a basic Minecraft server running in less than 60 seconds. Of course, if one has a slow Internet connection it may take slightly longer.
The first step to install Minecraft server on Windows 8 Hyper-V is to install java. For this guide we are going to use java7. Use the following command to install java on Ubuntu:
sudo apt-get install openjdk-7-jre-headless
Here is a screenshot of what this will look like (may be slightly different if you already did sudo apt-get upgrade):
Now that the Ubuntu server has java installed, you can get the files needed to install Minecraft server. First you will want to create a directory. For a simple server like this, I like to use minecraft-server as my directory so that is:
After this one needs to get the Minecraft Server files:
wget -O ~/minecraft-server/server.jar https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
That command is greatly simplified because it uses the same path. Bukkit includes version numbers which makes things a bit more difficult. Here is what this all looks like:
At this point one has installed Minecraft server on Windows 8 Hyper-V Ubuntu. One really cool thing is that by using this type of installation, you can move it to another Windows 8 Pro, Windows 8 Enterprise, Windows Server 2008 R2, Windows Server 2012 or Hyper-V server machine easily. Just import the virtual machine and you are ready to go on a dedicated server box later.
Now the next step is to launch Minecraft server after it is installed. For this I tend to use the following commands:
java -Xmx2048M -Xms2048M -jar server.jar nogui
That launches a 2GB of RAM minecraft server which most desktops can support. If one wanted to use something like the Microsoft Surface Pro as the Hyper-V host, those numbers should be lowered to 1024M due to limitations with 4GB of RAM. An important factor here is that the more RAM the Hyper-V host has, the more it can allocate the the Ubuntu VM and the Minecraft server. Here is what that looks like:
That’s all there was and it only took about a minute to get up and running with the Minecraft server in Hyper-V on a Ubuntu VM. Of course there is a slightly better way.
Scripting the Minecraft Server Installation on Ubuntu
While entering commands is fun, we can use a simple bash script to do the installation. Just log into (using SSH or the Hyper-V console) the Ubuntu VM and fire up a text editor. I use nano a lot so the command would be:
Now one can just copy the following lines into the text editor and save/ write out changes.
sudo apt-get install openjdk-7-jre-headless
mkdir ~/minecraft-server && wget -O ~/minecraft-server/server.jar https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
Once this is complete, one can run:
At which point the bash script will run, download and install java and Minecraft server. For those that want to do this on both Hyper-V and non Hyper-V Ubuntu installations, one can just download that script and complete installations in under 20 seconds each time.
Hopefully that helped. Always open to other suggestions and if we want, happy to do the same with bukkit or similar Minecraft server installations. The really cool thing here is that the installation is very portable since it is in Hyper-V and runs on many machines since Microsoft has brought Windows 8 Hyper-V to the masses.
Feel free to suggest other options.