Easy Raspberry Pi Minecraft Server Tutorial

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.

Raspberry Pi Minecraft

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 five people and the server will start to get a bit wonky. I found the optimal amount of people is only two to three, 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 work for me. I found that it will crash a lot, be laggy, and is very unstable. The official Java version may improve over time.

In this project, we will utilize Java that should already be installed on the Raspberry Pi (If you’re using the full version of Raspbian).

We will make a few changes to optimize 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 reboot if the Pi goes offline for any reason.

Equipment

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

Recommended

Raspberry Pi

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 an Ethernet cord for the best network performance)

Power Supply

Optional

USB Keyboard

USB Mouse

HDMI Cable

Raspberry Pi Case

Video

If you want to see 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 or follow us on social, so you’re kept up to date.

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 Buster. 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, Stretch, or Buster.

In this tutorial, we will work entirely in the terminal. It is probably best we boot straight into the 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 line.

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 don’t want to boot into the Raspbian desktop, so ensure the boot option is set to the CLI (Command Line Interface) instead. This change will help give the server as much processing power as possible.

5. If possible, change 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 our server. To get the Raspberry Pi IP address, enter the following command.

sudo hostname -I

To ensure that the IP doesn’t change you might want to setup a static IP address.

8. Next, we need to make sure that Java and Git is installed. Otherwise, we will not be able to build or launch the server.

Enter the following command to install the default JDK package for Raspbian as well as the Git software.

sudo apt install default-jdk git

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

mkdir /home/pi/minecraft
cd /home/pi/minecraft
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.14.4 to the end of the command to get the latest version. Don’t forget to change 1.14.4 in the command to the latest version number.

java -Xmx1024M -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 will need to instead generate the spigot.jar on a more powerful computer.

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

ls

Make sure you remain in the /home/pi/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 e.g. spigot-1.14.4.jar)

Raspberry Pi 1

java -Xms256M -Xmx496M -jar /home/pi/minecraft/spigot-1.14.4.jar nogui

Raspberry Pi 2, 3, or 4

java -Xms512M -Xmx1008M -jar /home/pi/minecraft/spigot-1.14.4.jar nogui

With the 2GB and 4GB variants of the Raspberry Pi 4, you can increase the Xmx value even higher.

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.

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, it will take a while to create a map so give it about three to five minutes. If you ever reboot again, it will only take thirty 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 log in. If we have it auto-boot on startup, accessing the server backend 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 Minecraft server on the Raspberry Pi will now be up and running fine, but you may want to do some optimizations to the server to make it run even better.

Raspberry Pi Minecraft Server

Connecting to the Minecraft Server on the Raspberry Pi

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

Load up the Minecraft Java client 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.

Assuming 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 Minecraft Server for the Raspberry Pi

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/pi/minecraft/plugins
wget -O NoSpawnChunks.jar https://files.pimylifeup.com/minecraft/NoSpawnChunks.jar

There are other plugins out there that can help with performance or extend the servers functionality, simply use the wget command to download them to the Pi as we did above.

Editing the Minecraft Properties

Now you probably want to know how to edit the server properties. This ability to edit 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 line.

sudo nano /home/pi/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

To have the server start on boot, we will need to do a few extra steps.

1. We will need to create a service for the Minecraft server so let’s start writing the service file by entering the command below.

sudo nano /lib/systemd/system/minecraftserver.service

2. In this file you will need to enter the following text.

This file defines the service, so the service manager knows how and what to run. Don’t forget to update the spigot version number whenever you upgrade.

[Unit]
Description=Minecraft Spigot Server

[Service]
User=pi
Group=pi
Restart=on-abort
WorkingDirectory=/home/pi/minecraft/
ExecStart=/usr/bin/java -Xms512M -Xmx1008M -jar /home/pi/minecraft/spigot-1.14.4.jar nogui

[Install]
WantedBy=multi-user.target

Once done, save the file by pressing CTRL + X then Y followed by ENTER.

3. Now, we will need to enable the service. You can enable the service by running the command below.

sudo systemctl enable minecraftserver.service

4. You should now be able to start the Minecraft server by simply using the following command.

sudo systemctl start minecraftserver.service

5. Using a similar command, you can check on the status of the service. Checking the status is great for debugging.

sudo systemctl status minecraftserver.service

5. You can stop the server by using the following command.

sudo systemctl stop minecraftserver.service

Your server should now start on boot. You can test it by restarting the Raspberry Pi. It will take a few minutes to startup.

If you want to get access to the server on the command line, then you will need to shutdown the server and load it using the normal command.

I hope this tutorial has helped you in setting up a stable version of a Raspberry Pi Minecraft server. If you like this tutorial, then 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. If you’re having trouble, let us know below.

287 Comments

  1. JC on

    Is there any word on getting a prebuilt spigot 1.8.9 jar out?

  2. Kevin on

    Hi guys the server works nearly perfect, so my problem is when I go into the nether the server crashes. I already tried to delete the worl_nether folder but nothing worked. It always ends with the error java.net.connectexception: Connection refused: no further information:
    Please I need help.

  3. darren on

    Thanks for this, it looks really useful.

    I just set up the Mojang Minecraft server on my Pi2, per the Idiot’s Guide to Raspberry Pi and it’s awful – constantly crashing and extremely slow. So it seems I should try a different server, but I have some Qs (Dec 2015 as I write this):

    1. is Spigot still subject to legal wranglings? What other servers would run on RasPi (canarymod, bukkit (spigot is an offshoot of bukkit, no?), etc)?

    2. I tried overclocking my Pi2 to Turbo and it failed miserably. I’m now at the overclock setting “Pi2” (1000, 500, 500, 2v) – presumably this is the best setting, given that I’m running a Pi2?

    3. does -Xms256M -Xmx1024M seem like reasonable settings for the server start command?

    4. I’ve tried in vain to connect an Android phone and an iPad running MCPE to the server but they fail, whereas my Mac desktop MC client connects fine – should they be able to connect ok or will most servers need special settings to support MCPE clients? Or do I need a specific server?

    Thanks for your help.

    1. darren on

      Replying to my own comment: I saw that you stated Xms and Xmx in your text, 512 and 1008 – that’s what I’m currently using.

      I was previously using crontab to start the server on boot but it didn’t work. Your solution seems better. One thing though: sudo ps -aux | grep “minecraft-start.sh”, won’t this just tell us if the shell script is running, but if the server itself has crashed underneath the script could still be running (I believe I’ve seen that). sudo ps -aux | grep “minecraft” will show everything (i.e. four processes: the sudo java… ; the java… ; the shell script; and the ps -aux cmd itself).

    2. Steven Elemen on

      Did you ever find a way to connect MCPE on iOS (iPad or iPod)? Both of my kids have MC on their PCs and can connect to the RPi with no issues, but it would be nice to be able to connect with our iPads as well so I could play too or when their friends come over.

    3. darren on

      I installed PocketMine but the problem is it only supported an older version of MCPE than the current release (I’m on Android v0.13.1 alpha) and I think PocketMine was supporting v0.10x or something like that. (I’m not that bothered to even look into rolling back my MCPE, if indeed that’s possible).

      It was several weeks ago and I haven’t checked back since. I would’ve thought Mojang would release an MCPE server sometime but who knows.

  4. DeWet on

    So, i did everything and my server works, but when I try to access server properties, I come up with a blank screen with no text besides the date and such at the top. Any help?

  5. Hammerface on

    After a minute of logging on to the server, it crashes display in 3 pages of error messages. The server also only works if the pi has rebooted just before it starts.
    I think it is to do with Java but as I’m new to this I don’t know exactly. It doesn’t crash if nobody joins though. The only plugin I have is Clearlag, I’m running spigot 1.8.8 and Java version 1.8.0_72. People who are trying to join are running Minecraft 1.8.9 Thanks!

  6. Matt on

    I’m getting weird issues with port forwarding. I set up a port forwarding rule on my router that forwarded to TCP destination port 25565 and UDP destination port 25565 but it only works with UDP 25565. I am trying to set it up to let me access it from outside my network. Any idea why the TCP port won’t work?

  7. hectorcampus on

    Thx so much Gus,your guide help me to install minecraft in orange pi (clone of Taspberry), I have another problems but finally i make it.

    With your permission,i make another guide exclusive for orange pi.I will mention your guide in the credits.

    1. Gus on Editor

      Go for it! 🙂

  8. StingCRO on

    I have done everything as said.
    Did the raspberry pi forwarding and my friend still cant connect to the server.
    I can connect locally but not over wan IP.

    If you need further information just tell me.

  9. Ricardo on

    After restarting my server the next day it recreated the whole world instead of using the one the day before. The command I ran to shutdown was sudo shutdown now and to run the server the next day I used the same command as in the tutorial.

  10. Tom on

    After doing Step 11. I get:

    gzip: stdin: not in gzip format
    tar: Child returned status 1
    tar: Error is not recoverable: exiting now

    on my raspberry pi.
    I’ve been googling for hours straight now and I can’t find something to work. Please help me 😉
    If you need any more information about my device or settings; tell me precisely what to do please!

  11. Leon on

    I tried this on a first issue RP model-B (the one with 256mb of memory), but it was way too slow and disconnects after a short amount of time.

    Trying to overclock that model to turbo caused it to crash on startup so I had to keep it to moderate overclocking.

    However, I’m going to try this on an old eeepc-701-4G, with debian. The process is almost the same — instead using http://www.webupd8.org/2014/03/oracle-java-8-stable-released-install.html for the java install and updates.

    I’m just waiting for the 2GB memory module to arrive from China.

  12. Nik on

    Hi, thanks for this awesome tutorial! Worked really fine, but wehre can I get the OP rights?! Within a normal server, there´s the console, but the pi dind´t got a console for something like that, didn´t it? Could you tell me, wehre I have to do the settings to get OP on the server?!
    Thanks from Germany Nik

  13. Peter Wong on

    Dear Gus,

    You have made a perfect tutorial to generate the new raspberry pi 2 and new bukkit jar file 1.8.8. My son is so happy now, we are playing day and night! XD

    I have manage to use “screen” and auto startup script to boot up my minecraft server.
    I used this tutorial to get it done!

    https://coderwall.com/p/quflrg/run-a-script-on-startup-in-a-detached-screen-on-a-raspberry-pi

    for the one who could not figured out yet.

    Happy crafting!!!

    regards,
    Peter

    1. Jeff on

      Curious what command you used, in the /etc/rc.local file I’m using:

      cd /home/minecraft && screen -dmS minecraft /opt/jdk1.8.0_60/bin/java -Xms512M -Xmx1008M -jar /home/minecraft1_9/spigot-1.9.jar nogui

  14. Leon on

    The latest RaspianOS has java jdk8 pre-installed so no need to call java from /opt…

    1. Gus on Editor

      Thanks Leon! I have updated the tutorial with a couple of notes so people will be aware of this.

    2. Jonathan on

      Thanks Leon and Gus!

      How do I update to Java 8?

    3. Jonathan on

      Well, It already comes with Java 8 so I just found out but…
      I can’t use this command:
      sudo /opt/jdk1.8.0_60/bin/java -jar filename.jar

      It says that is doesn’t recognise the command.
      Thanks Leon!

    4. Gus on Editor

      Just use sudo java -jar filename.jar

  15. Lorenz on

    Thank you for this guide. Easy to set up and works well.
    Only problem i have is once I’ve booted and the server is running no commands i type are working.
    Not even sudo commands work.
    I can type anything but it just doesn’t do anything. I can’t get back to the config file or to the gui.
    Any suggestions?

    1. Ole on

      I have the same Problem. Everytime i boot my raspberry pi b+ the Server starts automatically and then i can’t even stop the Server. Can somebody help me?

    2. Dan Hendrix on

      Same thing here. I can type, but get no response to anything except Ctrl+alt+del, which reboots and it returns to the same state.

    3. Jonas on

      I’ve got the same problem, maybe the autostart line should be done with nohup?
      I ended up reinstalling the whole thing. Only because I didn’t have any other linux machines with a spare sd card reader. Otherwise you could mount up the card in another linux box and change back the rc.local file.

    4. Chris on

      I got the same problem. I also ended up reinstalling my whole device. at least now I might install some kind of safety button if I do sth stupid again 😀

    5. JJ on

      I am having the same problem.

      I guess I should have added a ‘&’ to run the server in the background. I do not know but maybe that would have helped.

    6. Kevin on

      I have this issue as well. I was hoping someone would post a solution though. Any ideas?

  16. Jonathan on

    Hey Gus! Thank you heaps for this tutorial, I got my server working… But :\
    I’m using a Model B and I followed all of the lines. But its slow as ever, just wondering if I should install a new version of java? I tried to install this one:
    http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-linux-arm32-vfp-hflt.tar.gz?AuthParam=1445905057_620fbf309d330bb0cfa0e10b54a1a809
    but then I tried the code to unzip it:
    sudo tar zxvf jdk-8u65-linux-arm32-vfp-hflt.tar.gz -C /opt
    but it didnt work… Please help!

  17. Nate F on

    I forwarded the port to the pi, but no luck. Would the problem be with having two routers?

  18. Nate F on

    Could someone please tell me how players outside my local network can connect to the server? And by the way, great tutorial, first one that’s worked very smoothly.

    1. Gus on Editor

      Hi Nate, This can really vary since it depends on your internet connection speed etc. However I would say the Raspberry Pi probably will struggle with more than just a few players. Roughly I would say 5 but I haven’t been able to test this.

    2. Nate F on

      I was wondering about dynamic DNS and that link above really helped, but it didn’t help with other people connecting to the MC server. Would someone have to enter (my routers’s ip):25565 when adding a server in Minecraft? After I forwarded port 25565 to the Pi’s local IP (the 192.168.1.xxx)? Sorry, I’m kinda new at this.

    3. Gus on Editor

      Hi Nate,

      Yes that is correct once you have setup port forwarding anyone not on your local network will need to connect via your external IP.(If you’re not sure what your external IP is just google “My IP” and it should let you know what it is) It should look something like xx.xxx.xxx.xxx:25565 when someone enters it.

    4. wizdude on

      If you need some specific router instructions, http://www.portforward.com/ has some great step by step instructions for many common devices.

  19. Scott on

    I loved this walk-through. Could you possibly make one for PocketMine Server. My kids are addicted.

  20. Dave on

    Thanx for this great guide! All seems to be working, but when I try to connect MC to the server I get the following error:

    java.net.ConnectException: Connection refused

    This is local, I haven’t tried it yet from the outside.

    1. TLF on

      I’m getting this too. It’s usually as a result of the server version and client version not matching. But as I downloaded my client from the official site I’m not sure about how to fix it.

    2. Ludwig on

      Same problem here, “Connection refused”. How can I fix that?
      Thanks! Ludwig.

    3. Caleb McPherson on

      More likely than not, you haven’t put the EULA as true, which is a trouble I had

Leave a Reply

Your email address will not be published. Required fields are marked *