While the older Raspberry versions (A/B/B+) may not be up for the task, you can easily use the Raspberry 2 for a Minecraft server. At least 5 concurrent users are no problem at all, depending on your bandwidth. My Raspberry 2 did not use more than 300% CPU in a test, which is actually 75% – most of the time it was even below 200% (=50% on the Raspberry 2). It seems that Minecraft scales well over the 4 cores, at least with the version i am using.
First, you should use a headless installation on your Raspberry. You don´t need any GUI, so you can either check out my blogpost about Raspberry Pi basics to make your Raspbian headless, or you can use Minibian. It uses a very low amount of RAM and disk space and is perfect for servers. You will also need to use a static IP for your Raspberry, as you can read in my basics blogpost too.
Unless all your users are in your LAN, you need to use port forwarding and a static IP for the internet. This may be a problem, because most likely you will have a dynamic IP. But fear not, you can use a free dynamic DNS service like noip.org instead. Users will not access your Network with your dynamic IP, but with an URL like this one: http://yourcoolsubdomain.noip.com:25565
Actually, you don´t need to add the port as it´s the default port of Minecraft.
The usage is straightforward, and i will not get into detail with port forwarding because it´s different for every modem and there are plenty of tutorials about that already. Just make sure to forward the port 25565 to the internal IP of your Raspberry – of course with the same port.
Cuebrite (former MCServer)
I recommend using Cuberite, it´s a very fast and actively developed server written in C++. There is no specific ARMv7 build yet, but the ARMv6 build runs perfectly fine on the Raspberry 2. You can get the latest version directly on the build server, it makes sense to check for a new version from time to time: http://builds.cuberite.org/job/Cuberite%20Linux%20raspi-armhf%20Master/
Connect to your Raspberry Pi with SSH and use the following shell commands to download and extract the latest server package:
tar -xvzf Cuberite.tar.gz
I am just using the home directory, of course you can install it somewhere else too. You can update your server by doing exactly the same again, just make sure to stop the Minecraft server process first.
The easiest way to start the server now is to get into that new folder and use the Cuberite executable:
The first startup takes a while, because the world will get generated. After that is finished, you should be able to connect with Minecraft client. Of course you need to use the LAN IP, others have to use the noip.org URL to connect. Hit CTRL+C in the shell to shut the server down.
There will also be some settings files with default values after the initial run:
- Cuberite/settings.ini – general server settings
- Cuberite/webadmin.ini – settings for the web administration
- Cuberite/world/world.ini – settings for the world
In the world.ini, you can set the difficulty level from 0 to 3 and the game mode with those levels:
- 0 – survival mode (you start with an empty inventory and need to survive, as the name suggests)
- 1 – creative mode (you can´t die and you have endless resources in your pocket)
- 3 – adventure mode
- 4 – spectator mode
You can also set another seed for the world, just keep in mind that you need to delete everything except for the world.ini in your world folder to recreate the world after changing it.
Start with “screen”
While this may be the best option for initial testing, you may want to keep the server running after closing the SSH connection. For that, you can install “screen”:
sudo apt-get install screen
Alright, after installation, start Cuberite with the following commands, check if it is indeed running in the background and check the cpu load by using “top”:
screen -dmS minecraft ./Cuberite
Here is a very good tutorial about using screen: 10 Screen Command Examples to Manage Linux Terminals
Of course you can also start the Minecraft server on boot, take a look at my recent blogpost about Startup Scripts about that.
After starting the server for the first time, you should edit the webadmin.ini file with nano and change the “Password” for the administration, just to be safe. After that, restart the server and point your browser to the following location: http://internal-ip-of-raspberry:8080
You will see a nice website to log in (with the user and password of the webadmin.ini), and you can do some cool things in that admin interface. You can change the world settings (so you don´t really need to fiddle with the world.ini), you can see which players are online right now, you can send chat messages to the game, change player ranks, control the weather, …
Keep in mind that Cuberite is still under heavy development, so you may experience some bugs. But every few days there is a new build, so it will get better and better (hopefully), and it´s definitely worth it already. Time to get that shiny new Raspberry Pi 2 now!