My server is 'usually' up, so if you want to check it out before setting up your own, open up Minecraft and connect to martinohanlon.servebeer.com:25565.
Setting up the Pi
I amend the Pi config through raspi-config to give it the most amount of memory and overclock it.
- Overclock, Ok, Medium, Ok
- Advanced Options, Memory Split, Change to 16, Ok
Choose Yes to reboot
Static IP address
This isn't essential but I find it a lot easier to manage the minecraft pi server if its got a static IP address; its easier to connect to as the IP address never changes and if you want to make it public it makes port forwarding simpler too.
See this post for details on how to give your Raspberry Pi a static IP address.
Java isn't installed on the Pi, so this is the first step:
Check java is installed properly by running:
If it hasn't returned an error, so far so good.
Install Minecraft Server
I installed the bukkit server variant, spigot, I found it to be the best for reliability and performance on the Pi.
Run Minecraft Server
To run the minecraft server I create a bash script called start.sh:
Cut and paste the following command into the start.sh file
Note - I never got the minecraft server working reliably on a 256 meg Raspberry Pi, you may have better results that me though, so if you have a 256 meg Pi use the following command instead of the one above.
Ctrl X to save
Make the script executable
Start-up the server
The first time the server runs it will install the server from the spigot.jar file and create the world. This is going to take a little while the first time, but the next time it starts up, it will be much quicker.
Once it has finished and displayed the message Done, stop the server so it be can configured.
To stop the server type the command:
Configuring the Server
As part of the install process a file called server.properties will be created in the ~/minecraft-server directory, this holds the key configuration for how the server runs. See this page for full details on the server.properties configuration file.
The most important setting you need to change is the view-distance, when set to the default of 10, I found that the server was very unstable and prone to crashing.
These are the common flags I change:
allow-flight=false - change to true if you want to allow users to fly
gamemode=0 - change to 1 if you want to have creative mode, rather than survival
max-players=20 - 20 maybe too much for the Pi to handle, I set a maximum of 5
spawn-monsters=true - set to false to turn off monsters
spawn-animals=true - set to false to turn off animals
view-distance=10 - this is the distance in chunks the player can see, I set this value to 4, to reduce load on the Pi
motd=A Minecraft Server - "message of the day", is displayed when people join the server
Ctrl X to save
In order to change the view-distance, you also need to modify the spigot.yml file:
Scroll down till you find:
Modify this value to your new view-distance.
Ctrl X to save
I use 2 plugins on my server, NoSpawnChunks to improve performance and Raspberry Juice which allows you to run programs created using the Minecraft: Pi Edition api on your Minecraft server.
Start up the Server
Its time to start up the server and give yourself 'op', making yourself the operator, you leave your server open if there is no operator
Once the server has started up and reported "Done", you can give yourself 'op' by typing the following command:
e.g. op martinohanlon (but don't give me op - I can't be trusted!)
Your done, your server is running, you can login from minecraft using the address <ipofyourpi>:25565
Using screen to Run the Server
One of the problems with this setup so far, is if you started up the server directly on the Pi, you now cant do anything else with it, or if you have started it up over SSH you can't disconnect otherwise the server will stop. I use a utility called 'screen' to open multiple terminal sessions, which you can 'detached' from and they keep on running even when you disconnect.
To use screen, just type:
This opens a new terminal window in a terminal window, cool eh! Anything you run in this screen is separate from you main terminal, you can exit screen using the exit command, or you can detached the screen using Ctrl A, then D, which takes you back to your original terminal window but leaves the screen running.
See this page for a Tutorial on how to use screen.
You can then view all the detached screens by using the command:
Which will show you information like this:
Showing there are 2 screens running at the moment, to reconnect to a screen type, screen -r <name of screen>:
Open a new screen, run ~/minecraft-server/start.sh and use Ctrl A, then D to detach and your minecraft server will be running in the background
Running Minecraft:Pi Edition programs
I setup my minecraft server originally to show people what you could do with the Minecraft: Pi edition's API, , even though the raspberry juice plugin doesn't support all of the API functions, you can run most of the same programs on your server as you would on the minecraft Pi edition. If you want to try it out, the minecraft clock I created works really well. Startup the server, download the code and run it.