My 6 year old recently asked me to setup a Minecraft server, so I thought Id try on a Pi on the local Network.
There are lots of guides already on t’internet but all ask you to download the files to a PC and then transfer to the Pi via FTP or ssh. this sounds like more effort than needed so here are my instructions.
first step is check if you have JAVA installed
whereis java
if you get unknown then you need to download the JDK.
this is when the other guides tell you to download to another device and copy onto the Pi but all we need to do is set a couple of headers to get around Oracles cookie block on direct downloads.
pop to http://www.oracle.com/technetwork/java/javase/downloads/index.html to check the latest version, follow int instructions to download but just copy the location rather than downloading it, the enter the following in your terminal on the Pi
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-linux-arm-vfp-hflt.tar.gz
create a new home for minecraft, can go anywhere you like, I just popped it in /home
mkdir /home/minecraft-server
Download the Latest Minecraft Server from Mojang – https://minecraft.net/download
wget --no-check-certificate https://s3.amazonaws.com/Minecraft.Download/versions/1.7.10/minecraft_server.1.7.10.jar
start the server to generate the world and default server files, you will need to make sure you start the server with the right amount of memory or you will run into issues.
do a quick memory check
pi@raspbmc:~$ free -m
total used free shared buffers cached
Mem: 374 111 262 0 0 37
-/+ buffers/cache: 72 301
Swap: 0 0 0
and then start your server.
sudo /opt/jdk1.8.0/bin/java -Xms256M -Xmx256M -jar /home/minecraft-server/minecraft_server.1.7.10.jar nogui
You will get an error straight away to say you need to agree to an eula, the jar file will have created an eula.txt file, edit this and set eula=true
It will also have created a server.properties file, I recommend quickly editing this to set your defaults before starting up the server again. Remember on a Pi with limited memory, you will want to reduce player numbers, maybe disable nether etc. some people recommend disabling mobs as well.
This first start may take a couple of minutes, as it will now generate a new world based on your server settings.
One attempts took just over 200 seconds.
Tags: java, minecraft, mojang, Oracle, Pi, RaspberryPi, server
Turns out the lag is terrible, which to be fair isn’t the Pi’s fault, it just isn’t built for this job. I’ve been having more success with a MCPE server instead – see http://gavtaylor.co.uk/blog/minecraft-pocket-edition-server-on-a-pi