Raspberry Pi Minecraft
A Raspberry Pi Minecraft Server is a cost effective way to have your very own private server with your friends or just for stuffing around on.

I have had mine running for quite some time now and haven’t come across too many problems. It is very important to know that this server will not be able to hold many people. From my experience anything over 5 the server starts to get a bit wonky. I found the optimal amount of people is only 2-3 but this can be improved upon by tweaking the server.

We are also going to be using the spigot version of Minecraft as the default install didn’t really work for me. I found it crashed a lot, lagged and was very unstable.

In this project we will utilize Java that should already be installed on the Raspberry Pi (If you’re using full version of Raspbian). We will make a few changes to optimise the server for the Raspberry Pi 2 or 3, if you have one.  We will also set it up so you can access it on the web and also reboot if the Pi goes offline for any reason.

If you want to see visually how to setup the server then check out my video below otherwise I have a detailed text explanation immediately below the video. If you like the video please make sure you subscribe to the channel so you’re kept up to date.

Equipment

Please find below the equipment that I used for making this Raspberry Pi Minecraft server.

Recommended:

Raspberry Pi

8 GB+ SD Card or Micro SD Card if you’re using a Raspberry Pi 2, 3 or B+

Ethernet Cord or WiFi dongle (I recommend using a Ethernet cord)

Power Supply

Optional:

USB Keyboard

USB Mouse

1 HDMI Cord

Raspberry Pi Case

Setting up the Raspberry Pi Minecraft Server

Firstly, we will need to install Raspbian onto the Raspberry Pi. If you haven’t already done this, then check out my awesome guide on installing NOOBs Raspberry Pi. It will take you through all the steps that you will need to do.

Important:You will need to be on the latest versions of Raspbian (Jessie & Stretch). If not then you will find that Java is not installed, this will need to be done if you wish to get this server working. I highly recommend updating to Jessie or Stretch.

In this tutorial we will work completely in the terminal. It is probably best we boot straight into terminal so we can save on memory by not loading the GUI.
1. First let’s bring Raspbian up to the latest version by entering the following.

sudo apt-get update
sudo apt-get upgrade

2. Now we will need to make a couple of changes in the config tool. Let’s bring the tool up by entering the following:

sudo raspi-config

(If you need more information regarding the raspi-config tool check out my guide)

3. First let’s go to Advanced Options->Memory Split, update this to 16. (This will allow for more memory to be free for the server)

4. Also you probably don’t want to boot into the Raspbian desktop so ensure Enable Boot to desktop/scratch goes to command line.

5. Enable overclocking to High.

6. Finally, also enable SSH so we can access the Pi remotely if required (Unless you already have it enabled).

7. Now go to finish and reboot.

8. We will now want the IP address of our Pi for when we try to connect to to our server. To get the Raspberry Pi IP address enter the following command:

sudo hostname -I

9. Now we will need the Minecraft server file, we’re going to use a builder tool that is supplied by spigot, to get this enter the following commands:

sudo mkdir /home/minecraft
cd /home/minecraft
sudo wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar

10. Now we will want to run the build tools file so it creates our spigot server. It will take about 15-30 minutes to finish. Add --rev 1.9 to the end of the command to get the latest version. Don’t forget to change 1.9 in the command to the latest version number.

sudo java -jar BuildTools.jar

Important: If you have a Raspberry Pi B+/B or any variation before the Raspberry Pi 2 then the build tools will likely fail. You can instead download the spigot.jar directly from file mirror using the following command:

sudo wget https://pimylifeup.com/out/spigotlatestbuild
sudo mv spigotlatestbuild spigotlatestbuild.jar

If you want a previous version for some reason you can use one of the following.

sudo wget http://www.mediafire.com/download/pg7xzshq5cdmfjx/spigot-1.10.2.jar
sudo wget http://www.mediafire.com/download/6h09558h3ekzyd3/spigot-1.9.4.jar
sudo wget http://www.mediafire.com/download/nld0qtn49gyx723/spigot-1.9.2.jar
sudo wget http://www.mediafire.com/download/3rf1fawywqfd5g5/spigot-1.9.jar
sudo wget http://www.mediafire.com/download/kvkkxsu7ws6nhvz/spigot-1.8.8.jar

11. To make sure the spigot server successfully downloaded and saved simply type ls and should see spigot.jar.

ls

Make sure you remain in the /home/minecraft folder as we want all the server files to be created in here. If you start the server in a different folder it will create the files in there.

12. Now we’re ready to launch the server, to do this enter the following command. (You may need to change the version number depending on what version you’re using eg. spigot-1.9.jar)
Raspberry Pi

sudo java -Xms256M -Xmx496M -jar /home/minecraft/spigotlatestbuild.jar nogui

Raspberry Pi 2 & 3

sudo java -Xms512M -Xmx1008M -jar /home/minecraft/spigotlatestbuild.jar nogui

The server will stop straight away as we will need to agree to the Eula. You can do this by opening the Eula by typing the following command.

sudo nano eula.txt

13. In here change false to TRUE, once done save and exit by pressing ctrl+x then y.

14. Now relaunch the server again it will take a while to create a map so give it about 3-5 minutes. If you ever reboot it will only take 30 seconds to load if the map has already been created.

15. The server should now be running and accessible over the local network.

16. You might want to mod your user now so that you can use all the server commands when you login, if we have it auto-boot on startup accessing the server is slightly more difficult. To mod your user simply run the following command when the server has launched (Replacing username with your username):

op username

17. The Raspberry Pi Minecraft server will now be up and running just fine but we may want to some optimizations to the server to make it run even better.

Raspberry Pi Minecraft Server

Connecting to the Minecraft Server on Raspberry Pi

If you’re on a local network, then it should be pretty easy to connect to the Raspberry Pi Minecraft server. To test it out do the following:

Load up Minecraft on a PC within the same local network as the Pi.

Go to multiplayer and then your server might pop up in the local list. If it doesn’t simply go to direct connect and enter the IP we got earlier on the Pi using the command hostname -I.

If you want to allow access to the Minecraft server via the internet, then you will need to setup port forwarding.

If you want to learn how to do this, then head over to my guide on setting up Raspberry Pi port forwarding. You will need to port forward the port 25565 (Unless you change it in the server properties)to the IP of your Pi.

Configuring the Server

Here are a few tips for configuring the server and getting it up and running.

Optimizing the Raspberry Pi Minecraft Server

Now to get the most out of our Raspberry Pi Minecraft server we will want to install a plugin to help optimize the performance.

Firstly let’s install the NoSpawnChunks plugin, this will help prevent the Minecraft server from chewing up too much RAM.

cd /home/minecraft/plugins
sudo wget -O NoSpawnChunks.jar https://pimylifeup.com/out/nospawnchunks

There are other plugins out there that can help with performance, just simply use the wget command to download them to the Pi like we did above.

Editing the Minecraft properties

Now you probably want to know how to edit the server properties. This is very important for optimizing the server and customizing it to how you want the server to be. If you want more information for each of the server settings you can find a good page on all the server properties here.

To enter the server properties, enter the following:

sudo nano /home/minecraft/server.properties

Now in here we will want to change a few settings to help optimize the performance of the server. You change these and other settings to whatever you like however you want but keep in mind the Pi can’t handle too much processing.

view-distance=04
max-player=5

Boot on Startup

Let’s first start by making a simple startup script. To do this let’s first create the file by entering:

sudo nano /home/minecraft-start.sh

In here simply add the following lines so that the Raspberry Pi Minecraft server will start up correctly. (Make sure the spigot version is correct)

#!/bin/bash
cd /home/minecraft
sudo java -Xms512M -Xmx1008M -jar /home/minecraft/spigotlatestbuild.jar nogui &

If you want the server to startup automatically on reboot then we need to simply add it to the rc.local file. To do this enter the following:

sudo nano /etc/rc.local

In here, add the following line right before the exit line.

bash /home/minecraft-start.sh

Once done, exit and save.

Now the server should start on reboot automatically. If you want to test this simply enter the following:

sudo reboot

To check if the script is running either try to load the server in Minecraft or in the terminal of your Pi enter:

ps aux | grep "minecraft-start.sh"

This will return two results you only need to pay attention to the first.

If you need to kill the process get the process id from the above command, it is the first number after the username (In this case it should be root).

To kill the process simply enter the following (Replacing {pid} with process id):

sudo kill {pid}

If you want to get access to the server in the command line then you will need to shutdown the server and load it back it back using the normal command (not the autostart file).

I hope this tutorial has help you in setting up a stable version of a Raspberry Pi minecraft server. If you like this tutorial be sure to check out our many other Raspberry Pi Projects.

Also feel free to drop us a comment below if you have better optimization settings, plugins or ideas. Also if you’re having trouble let us know below.

The Raspberry Pi Crash Course

The Raspberry Pi Crash Course

Enter your email address below to get the

Raspberry Pi crash course delivered straight to your inbox

Please check your inbox for a confirmation email!