Setting up a Raspberry Pi as a Minecraft server

My kids are occasional Minecraft addicts. As I want to support their creative activities, I have setup a Minecraft server at home so they can collaborate with friends on their construction endeavours. The system we use is a Raspberry Pi 3 with a Spigot Minecraft server. A few weeks ago I had an SD-card corruption so I had to start from scratch with a new Raspbian OS install and setup the Minecraft server once again. This time I have decided to write down the installation- and configuration steps if someone else needs them.

About Raspberry Pi as server

Spigot runs just fine on a Raspberry Pi though the RAM and CPU of the little computer is limited. Each user will consume a chunk of RAM and processing power from the RPi so you can not have a large number of concurrent players in the system. I have only used the system with two simultaneous users so far. From what I can see from my monitoring tools, the RPi has no problem handling the load. For example, the total RAM usage on the RPi increased from 10% to 50% when the Spigot server was started. With two players connected and using the server, the RAM usage increased to 60% after a few hours of playing. The CPU temperature heightened from 50 °C to 55 °C after the server was started and had no obvious increase after that.

By searching the forums, it seems that there are lots of different configuration optimizations that can be used for reducing the memory footprint of the Minecraft server. With only two concurrent users, I don’t have to bother about this, but if I were to add additional players I would need to dive into the optimization details.

Fetching and building the Spigot server

To get the Spigot Minecraft server in place, the build tools needs to be downloaded and the server has to be built. Minecraft uses Java so make sure that you have it installed (I have version 1.8.0_65 and it works fine).

Create a new folder and cd into it:

mkdir mc
cd mc

Then, download the latest BuildTools for Spigot:

wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar

and build the Spigot server:

java -jar BuildTools.jar

This will take a while…

When finished, the latest Spigot server is available in the mc folder. At the time of writing, I got version 1.11.2. To start the server use the command below and change the jar file version number to whatever version you’ve got when downloading and building:

java -jar -Xms512M -Xmx1008M spigot-1.11.2.jar nogui

The first start fails, and it has created an eula.txt file. You have to accept the End-user license agreement. Open eula.txt with nano and change eula=false to eula=true. Start the server again and check that the startup process works. I have put the server start command in a startmc.sh file so that it easier to start the server again.

Connect and test with a Minecraft client

With the server running, start a Minecraft client on another computer in your network. Log in with a Minecraft account and select the same version of Minecraft as is running on the server (1.11.2 in my case). You can save and use profiles with different versions of Minecraft on your client if you want to easily switch between versions.

Press Play, select Multiplayer mode->Direct connect and enter the IP address of your Raspberry Pi that runs the server. Add :25565 to the end of the address to select the default Minecraft server port for the server. Click Join server and you’re ready to rock some blocks!

Some configuration options

There are tons of configuration options for Minecraft. See this list for example:

http://minecraft.gamepedia.com/Server.properties

I have gathered a few that I’ve found very useful.

Creative mode

My kids often prefer to play Minecraft in creative mode so that they can make their constructions with an unlimited tool set and “fly”. The default setting on the server is survival mode. To change it to creative enter

>defaultgamemode 1

on the server prompt.

You can set force-gamemode=true in the server.properties file to force players to join in on the default game mode (otherwise they will join in the game mode they left in).

Changing game mode for a player on-the-fly can be done from the Minecraft server prompt:

>gamemode  [player]

Use a whitelist

If you use port forwarding to let people outside your LAN be part of the game, a whitelist is useful for specifying what users are allowed to connect. This can be set as white-list=true in the server.properties file or by using whitelist on on the server prompt.

Whitelisted users can be added with whitelist add [player] from the server prompt. The list will be stored in whitelist.json.

Backup your worlds

The Minecraft worlds are stored as folders, typically named world*. To backup a world you can simply make a copy of that folder. To create new worlds, copy the content of an existing folder to a new folder.

The world to use in the game can be set with the level-name property in server.properties.

To use a downloaded world for the kids to build upon, just copy it to a separate folder and set the level-name accordingly in server.properties.

Advertisements

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

Blog at WordPress.com.

Up ↑

%d bloggers like this: