Raspberry Pi Minecraft Server

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.

If you are looking for the Bedrock server, be sure to check out our Minecraft Bedrock server tutorial. It will take you through all the steps to setting it up correctly.

In this project, we will utilize Java, which should already be installed on Raspberry Pi OS. We will make a few changes to optimize the server for the Raspberry Pi 2, 3, 4, or 5. We will also set it up so you can access it on the web, and have it 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

Optional

Video Tutorial

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 an operating system onto the Raspberry Pi. If you haven’t already done this, then check out my awesome guide on installing Raspberry Pi OS. 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 Raspberry Pi OS. 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 update
sudo apt 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 our 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 hostname 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 JDK 17 package for Raspbian as well as the Git software.

sudo apt install openjdk-17-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.20.4 to the end of the command to get the latest version. Don’t forget to change 1.20.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.20.4.jar (This may vary depending on the latest version available).

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.20.4.jar)

Raspberry Pi 1

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

Raspberry Pi 2, 3, 4, or 5

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

With the 2GB and 4GB variants of the Raspberry Pi 4 or 5, 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

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 computer within the same local network as the Pi.

Go to multiplayer, and your server might pop up in the local list. If it doesn’t, simply go to direct connect and enter the IP address we got earlier on the Pi using the hostname command, for example, 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

To get the most out of our Minecraft server on the Raspberry Pi, you can install a plugin to help optimize the performance.

There are many plugins that can help with performance or extend the server’s functionality. Simply use the wget command to download them to the Pi. Below is an example.

cd /home/pi/minecraft/plugins
wget -O example.jar <example_plugin_url>

Editing the Minecraft Properties

You will 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.20.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.

Conclusion

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.

294 Comments

  1. Avatar for Travis
    Travis on

    Im trying to install some plugins onto the server but i cannot seem to get them to show up and work could you help me out?

    1. Avatar for Gus
      Gus on
      Editor

      Can you please let me know which plugins and I will try on my local copy.

  2. Avatar for Martin P-S
    Martin P-S on

    How do you re-generate the map because it is a horrid map it generated so i want a new one also i can’t do any commands on the server when i am playeing even if i op myself.

    1. Avatar for Gus
      Gus on
      Editor

      Go into your server.properties file and change the level-name.

      Eg. Change it from:

      level-name=world
      to
      level-name=world2

      Once done, reboot the server.

      Commands are working just fine on my local copy. Does it spit out any errors ?

    2. Avatar for Martin P-S
      Martin P-S on

      it’s all fine now the commands were not working for about a week now its fine.
      Thanks this is an amazing tutorial!

  3. Avatar for Martin P-S
    Martin P-S on

    How do you make one open to the whole world or in one country?

    1. Avatar for Gus
      Gus on
      Editor

      Opening the server up to the world, you will need to setup port forwarding.

    2. Avatar for Martin P-S
      Martin P-S on

      also how do i do commands in game because it says i don’t have permission to do commands? and i can’t do commands for the server in ssh or on the pi itself?

  4. Avatar for Rasmus
    Rasmus on

    Hello (:
    I have a question about the server, when we’re more than 1 on the server at a time, someone is disconnected. it says time out, connection lost.

    Does someone know what is wrong? I am using spigot version 1.11.2

  5. Avatar for Daniel
    Daniel on

    pi@raspberrypi:/home/minecraft $ ./BuildTools.jar –rev 1.11
    -bash: ./BuildTools.jar: Permission denied
    HELP WHAT TO DO??

    1. Avatar for Gus
      Gus on
      Editor

      Run as root eg. sudo java -jar ./BuildTools.jar

  6. Avatar for Nathan
    Nathan on

    Hello, the tutorial worked great! I was wondering how you update your server but keep the same world. I really want to update my server to 1.11 but I don’t want to lose my 1.10 world.

  7. Avatar for Mike
    Mike on

    How do I stop the “boot on startup” option? I need to check my ip address and I can’t get to the GUI.

    1. Avatar for daniel
      daniel on

      sudo hostname -I

  8. Avatar for Corey
    Corey on

    Server is working great now for a few weeks. Just a question I need to set someone op on the server. How do I go about that? I know the commands /op name (or fist three of four letters of the name + tab) /deop name removes it again. But thats in game and if you have op yourself. I’m talking about on the pi. How do I do it if I ssh into the pi again. Can someone please give clear instructions on how to do this. I need to set myself as op so I can change some gamerules.

  9. Avatar for Josh
    Josh on

    Hi, just tried this out and everything seemed fine until I got to using the buildtool. When I ran sudo java -jar Buildtools.jar, it told me java wasnt a valid command. I tried using the full path name and got this error:

    Loading BuildTools version: git-BuildTools-4bf25ea-55 (#55)
    Git name not set, setting it to default value.
    Exception in thread "main" java.io.IOException: Cannot run program "git" (in directory "."): error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at org.spigotmc.builder.Builder.runProcess(Builder.java:543)
    at org.spigotmc.builder.Builder.main(Builder.java:166)
    Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.(UNIXProcess.java:248)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 2 more

    Its like it doesnt recognize java

    1. Avatar for Justin
      Justin on

      same here. did you ever get a resolution?

  10. Avatar for Ben
    Ben on

    Hi,
    Is there a way to gracefully shutdown the minecraft server? I am thinking I should create a minecraft-shutdown.sh file, but I have no idea what command line I need to shut it down.
    Thanks
    -Ben

  11. Avatar for corey
    corey on

    so any idea on how to set someone as op on the server?

    1. Avatar for Berend Jan
      Berend Jan on

      In the server type /op [name of the player] when that player is online.

      or try /op 1st letters of the player and pres tab to autofill the name

    2. Avatar for Corey Skipper
      Corey Skipper on

      yea not working when your not op. I’m talking about from the raspberry pi itself. I know all the commands on minecraft but you need to be op already unless im missing something.

  12. Avatar for Nuno
    Nuno on

    hi Gus,

    excellent tutorial! i was able to have it running on my Pi3 but I’m having problems connecting with the Pocket Edition. i have two tablets with the pocket edition and when running minecraft on one of them I can see the other and so I can connect to the world. However, both android tablets can’t find the minecraft serve on the Pi. I’ve already tried manually configuring the IP but nothing connects… Could it be a limitation of pocket edition version? I don’t have the PC version, so I cannot check if the PC version is able to see the PI3 server…

    1. Avatar for Gus
      Gus on
      Editor

      Hi Nuno, Yes that’s correct, I believe the pocket edition can’t connect to a normal or spigot version of the server. It is on my “to do list” to look into a pocket edition server for the Pi.

  13. Avatar for jim
    jim on

    Hello great server,but it`s just don`t stopping with nothing,and it does not accept any kill command to stop or any other command at all,Does anyone knows how to fix this?

  14. Avatar for Ben
    Ben on

    I am getting sudo: /opt/jdk11.8.0_60/bin/java: command not found when i try to run server and if i delete the line and run the code again i get sudo: invalid option — ‘X’ what does this mean? I am using a raspberry pi 3 with the newest os and I am try to run minecraft 1.10.

    1. Avatar for Gus
      Gus on
      Editor

      Try running

      sudo java -Xms512M -Xmx1008M -jar /home/minecraft/spigot-1.10.jar nogui

  15. Avatar for Jason Taylor
    Jason Taylor on

    Hey Gus, is there any way to run a Minecraft PE server on the raspberry Pi? If there is, I would love some of your awesome instructions!. Thanks!

    1. Avatar for Gus
      Gus on
      Editor

      Hi Jason, I am not 100% sure, ill need too look into it! I have added it to my list of things to do 😀

  16. Avatar for Ronnie Zanini
    Ronnie Zanini on

    Hi: the post “Raspberry Pi OwnCloud: Your Own Personal Cloud Storage” is offline, is it possible to fix it? Thanks!
    Ronnie

    1. Avatar for Gus
      Gus on
      Editor

      Should be fixed now, not sure what happened there.

  17. Avatar for P
    P on

    Awesome tutorial – just got it going on my Raspberry Pi 2. Is there way to change the server settings to allow users from the same account on the local LAN (different PC’s) to play at the same time?

  18. Avatar for Berend Jan van Bruggen
    Berend Jan van Bruggen on

    Is there someone that gets a spigot version of 1.10.2 running on the Raspberry pi?

    I keep getting errors 🙁 and nothing seems to work it

    This is the error message i get …

    "Rebuilding Forked projects....
    fatal: '/home/MC-creative/Bukkit' does not appear to be a git repository
    fatal: Could not read from remote repository." {Edited}

    1. Avatar for Berend Jan van Bruggen
      Berend Jan van Bruggen on

      Never mind, my other Pi3 just spit out a working 1.10.2 so i copy that one over…

  19. Avatar for Jeff
    Jeff on

    Just purchased a Pi 3 and going to attempt to build this for my 6yr old son and his friends.
    Question. Can I run both the server and the client on the same Pi? the reason I asked is to decide if I need to buy him a computer, chromebook or another Pi so he can play.
    I would like to save $$ and just run both server and client on the same Pi if possible… can you answer my question? Thank You!!!!

    1. Avatar for Marc
      Marc on

      Minecraft for PI isn’t that feature complete. The PI 2/3 can run a small server. But since full Minecraft is Java you need a real desktop to nun it.

  20. Avatar for Elliot
    Elliot on

    Heads up that if you’re using Raspian Jesse, don’t bother with the OpenJDK Java that comes with the distro. Nothing but pain. Follow Gus’s guide and install the Oracle Java even though it says you don’t need to. Oracle Java is better anyway and will be more performant.

Leave a Reply

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