My Raspberry Pi 2 Minecraft server

Posted on 2016-05-16 16:00

Almost three years ago when I first set up a Minecraft server for the kids (and never wrote more about it as I had originally intended to do), I imagined it becoming a frequent haunt for the kids and their friends and cousins to build stuff together. I didn't realize that the lure of real minecraft gaming servers would soon make our private server an empty wasteland. minecraftEventually my kids and their friends were no longer meeting up on our server to build houses and mess around with World Edit but were instead playing PVP on servers with hundreds of other kids they didn't know. I had no intention of putting in the kind of effort that running a Hunger Games or Parkour server would require, but after the year or so of good use it had gotten I liked the idea of keeping the server running to preserve those things the kids (and I) had created.

[gallery type="slideshow" link="file" ids="4724,4725,4726,4727,4728,4729,4730,4731,4732,4733,4734,4735,4738,4739"]

Some history about custom Minecraft servers When I first set up the Minecraft server in 2013 I chose to use a software called CraftBukkit to do so. Minecraft, at the time was owned by its creator and his company Mojang. CraftBukkit was an independently developed open source server modification software that depended on the vanilla Minecraft software. CraftBukkit made it possible to run lots of cool plugins built with Bukkit (the development API) on your server that you couldn't use otherwise. Although Mojang had purchased Bukkit (the server API software) 2 to 3 years prior, they had not purchased CraftBukkit and so didn't own that software. When Mojang sold to Microsoft in September, 2014 (about a year after I set up my server) it caused shockwaves through the Minecraft universe of independent developers. Minecraft's popularity was arguably due largely to the work of these indy devs who had created game servers with the open source server software which was popularized by players on youtube. These server softwares made running a minecraft server easy, and provided a means for admins (called "OPs" from the word "Operators") to moderate the game, kicking or banning users, control it, shut it down or restart it, and opened the door for a plethora of independent plugins that grew to provide a way to do a huge number of things in the game that the vanilla software from Mojang, then Microsoft, did not do. There was some anger from folks who saw the Mojang guys profiting wildly for a software that was popular (they believed) mostly because of open source efforts, and when CraftBukkit got shut down, it wasn't because of any action by Microsoft (they didn't have a claim on it), but by one of the CraftBukkit devs themselves! It appears that some of this has been worked through now and Spigot server, a fork of CraftBukkit is alive and well and providing tools to make running a custom server as easy and awesome as it ever was.

My first servers When I had first set up the server, I ran it under the radar at work on real hardware with a fat network connection, but after some time the resources it ate up could no longer be justified and I decided to pull the plug on it. I was able to back up the worlds and get them running again using msm [minecraft server manager] on a small Intel NUC which I had connected to my TV in the living room, but that machine is rarely on and when it is, one of the kids is usually using it to play minecraft which makes for poor performance all around. I really wanted to be able to have the server running all the time but I didn't want to leave the NUC on all the time just for some minecraft worlds that are rarely if ever used.

Running Minecraft on the Pi I already had a Raspberry Pi 2 (note: there is a Raspberry Pi 3 out now and I would recommend this kit if you're interested in getting one since it comes with everything you'll need) which I had originally set up with OpenELEC last year and it wasn't being used very much. I wondered if I could get it set up as a minecraft server instead?

mc_02

Enough of this talk! What did you do to get it set up? I found a great write up for doing just this at https://pimylifeup.com/raspberry-pi-minecraft-server but I must admit I didn't really follow it very closely.

I didn't take notes when I was setting it up but the whole setup was done in under an hour or so. I'm not done, but its up and functional. The URL is pretty simple to guess but since its really got nothing on it other than some silly things our family created I don't see any point in promoting it at all. This is what I did as far as I can remember:

  • Setting up Raspbian on the Pi.
    • Grabbed a Windows laptop because it had an SD card reader in it (I have a micro SD to SD card adapter which makes loading files to it easy)
    • Used SD Formatter for Windows to partition and format the microSD card since it had a couple funky partitions on it from my previous playing around and OpenELEC
    • Downloaded Noobs, unpacked and copied the files over to the microSD. Noobs makes it super easy to to get the Pi up and running quickly.
    • Chose to install Raspbian from the Noobs start screen
  • Configuring Raspbian a bit.
    • Used Raspi-config to set up SSH server
    • Made some other changes to Raspbian suggested by the pimylifeup article (GPU memory allocation to 16, overclocking to 1GHz)
    • note: Rasbian already had Java on it (I noticed a disclaimer from Oracle that you're granted license to use it at set up) so there wasn't any need to download and set that up again.
  • Setting up the Minecraft Server.
    • The key to getting everything set up is BuildTools by SpigotMC. The folks at SpigotMC provide enterprise level minecraft server software (this is actually a thing) which is basically a fork of and is reverse compatible with Craftbukkit. I downloaded the jar file and ran it on the Pi and the script cloned the code out using git and proceeded to build server APIs for Bukkit, Craftbukkit, and Spigot minecraft servers. This completed without error and produced a server jar file for me to use which worked with a fairly recent Minecraft version (1.9.2).
    • cd into the folder I wanted to keep the server files in, and ran the server once from the command line to create all the ancillary server files and then stopped it.
  • Configuring the Minecraft Server.
    • Edited the server.properties file and reduced the number of users that could connect at a time to 5 and reduced the number of chunks to display to 4. update 160517: upped this to 7 without any noticeable problems, but haven't tested with more than one user as yet.
    • Dropped in the NoSpawnChunks plugin
    • Dropped in Spigot-Essentials-2.x plugin (and copied my Essentials folder over from the old server)
    • wrote a short bash script with parameters to use as much memory as possible I could use to start the server and set to run it from rc.local so that it would get started at boot time. This is one thing I intend to improve (see below).
  • Things on the todo list include:
    • Bring over all the worlds (so far I've only brought the one that I was using). Not totally sure about what I want to do at this point. I want for the kids to be able to cruise around in the worlds they built but should they be set so they cannot be modified any further?
    • Figure out if the Multiverse plugin will work on this new server so that all the portals we had defined will work again between the worlds.
    • I used to have World-Edit and World-Guard running - not sure I want to bother with that again
    • I used to run Dynmap for real-time mapping available in a browser but theres just no way the Raspberry Pi will be able to handle that. I do want some kind of mapping software though. Maybe I could set up a program to produce static maps on a schedule? I've used mapcrafter like that in the past.
    • Write a true service to start and stop the server, or
    • Re-write startup script to use screen (so I can re-attach to the running script when I ssh in to the pi) but for now, it gets the server running at least. update 160517: already changed the startup script to include screen -dmS minecraft before the launch directive so that when I ssh in I can use screen -r minecraft to reattach to the running process and interact with the server on the command line.

update 160715 - I got a Raspberry Pi3 and was able to copy over my server files and settings after setting up Raspbian and get it all running fairly quickly. It runs the server a LOT smoother than the pi2 did. It does still stutter a bit as chunks load, but I don't see the "Can't keep up" messages in the log anymore. I'm also running it over the built in wireless in the Pi3 and so far no issues.