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 Ozzyrockin
    Ozzyrockin on

    Hello! coming from the srb2 tutorial would it be possible to use screen with the Minecraft server by chance?

    1. Avatar for Emmet
      Emmet on
      Editor

      Hey,

      Yes it definitely would be possible. That might be a good improvement for this tutorial to make it easier for people to access the terminal.

      Hopefully I will find some time soon and update the tutorial to use screen as well.

      Thank you for the suggestion.

      Cheers,
      Emmet

  2. Avatar for bacco
    bacco on

    BuildTools.jar

    In my case, I had to look at the spigotmc website and research how to have the command be sent to be able to build the tools:

    java -Xmx1024M -jar BuildTools.jar --rev 1.15.1

    Memory allocation has to be manually set or it will return an error (rpi3)

    1. Avatar for Gus
      Gus on
      Editor

      Hi Bacco,

      Thanks for that, we have updated the tutorial, so we specify the memory allocation.

  3. Avatar for Jeremy
    Jeremy on

    Just so you are aware, I created my minecraft server the other day and tried your NoSpawnChunks wget line and it returned a 404 error. Not sure if you are aware of this. Figured you would want to know. Maybe the file on your end is working and I made a mistake. Either way, how do you download it from the supplied website and transfer it from my mac to the pi via ssh?

    1. Avatar for Gus
      Gus on
      Editor

      Hi Jeremy,

      Thank you for pointing this out. I have re-uploaded the file to our file-server and should no longer 404.

      Alternatively, this line should get it from bukkit website.

      wget -O NoSpawnChunks.jar https://dev.bukkit.org/projects/nospawnchunks/files/latest
  4. Avatar for AG
    AG on

    Hey, great tutorial! I got it up and running, but was wondering if it would be possible to install mods to the server (not plugins). Would I need to install a Forge version of minecraft? Thanks in advance, AG.

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi AG,

      From a quick look, it doesn’t look like Spigot supports mods and yes you will need to use a Forge version of minecraft to do this.

      Cheers,
      Emmet

  5. Avatar for emanuel
    emanuel on

    I get the following error trying to connect with my client on MacOS:
    “Failed to connect to the server
    Outdated Server! I’m still on 1.14.4”

    Any thoughts?

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi emanuel,

      Looks like you will need to try running the buildtools.jar file to generate a newer version of the Minecraft server software.

      There is steps to do this in the guide above.

      Cheers,
      Emmet

  6. Avatar for Connor
    Connor on

    Great tutorial! Really thorough and exactly what I needed!

    When running the Build java file, I found I needed to install git for it to work. I’d recommend adding that to the tutorial. 🙂

  7. Avatar for Tree
    Tree on

    Hey Gus, thanks for the reply! I did get it to work and my server is up! One problem though, when I attempt to direct connect to my pi via Java minecraft it simply says “Connection Refused”. Thanks, Tree

    1. Avatar for Gus
      Gus on
      Editor

      Hi Tree,

      Is there any output in the server terminal on the Raspberry Pi? If not, it could mean the client is failing to connect to the Raspberry Pi at all.

      Also, are you running any firewall on the Pi that might interfere?

  8. Avatar for Tree
    Tree on

    Hey, when I try to do the spigotmc connection to download the jar file or whatever it says “unknown host” and name or service not known. Then says unable to resolve hostname address hub.spigotmc.org. Any clues as to how to fix this Gus? Thanks in advance, great tutorial btw

    1. Avatar for Gus
      Gus on
      Editor

      Hi Tree,

      That error points to an issue with hub.spigotmc.org, which may have been having issues at the time. I recommend trying to download it again.

      If the error continues to occur, you can try downloading a compiled version of Spigot from our file server.

  9. Avatar for Matt Hannan
    Matt Hannan on

    Glad to see that there are recent comments (and replies!) to this.

    How concerned should I be about this?

    — Snipped 404 Error —

    1. Avatar for Gus
      Gus on
      Editor

      Hi Matt,

      Thanks for bringing this to our attention. It appears the file somehow got deleted from our file CDN. I have re-uploaded the file so it should download without error now.

  10. Avatar for Luuk Fröling
    Luuk Fröling on

    Hey, the spigot-1.13.2.jar is outdated. Could this be updated? I would like to have version 1.14 🙂

    thanks!

    1. Avatar for Gus
      Gus on
      Editor

      Hi Luuk,

      We have updated the download link to the latest version.

      Thanks,
      Gus

  11. Avatar for Eli
    Eli on

    Hey Gus,

    Just wondering if this server setup only works with the Java Edition of Minecraft on PC or if I would be able to use this server to play on the Windows 10 Edition. Also was thinking about looking into port-forwarding to be able to play this on Xbox One as well. Tested it with the Java Edition and I can connect there, but it will not allow the connection on Windows 10 Edition. I put in the port number: 25565 and my IP address and it was not making the connection.

    Thanks for any help you can lend me

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Eli,

      This tutorial purely focuses on setting up a Minecraft server on your Raspberry Pi for the Java edition. If you would like to setup a server that will work with the Windows 10 Edition of Minecraft you can follow our Minecraft Pocket edition server tutorial.

      Due to the huge differences between the Windows 10 edition and Java edition’s of Minecraft you can only have a server that will support one or the other.

      Cheers,
      Emmet

  12. Avatar for Jacob
    Jacob on

    What command do I need to use if i want to start the server (I dont want to have it start on boot or reboot)

    1. Avatar for Gus
      Gus on
      Editor

      Just use the standard Java command.

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

  13. Avatar for Mr_PineCow
    Mr_PineCow on

    Hey I started my minecraft server about two weeks ago on version 1.13.2 and I followed the tutorial exactly. My raspberry pi 3 B+ failed to run buildtools for some reason so I downloaded spigot with — Snipped —
    Is there anyway to update this to 1.14 without losing the world? Memory shouldn’t be a problem I have a 32 GB sd card running raspbian buster.

    1. Avatar for Gus
      Gus on
      Editor

      I just uploaded the 1.14.4 version to the file server. You can download it by updating the URL, so it’s spigot-1.14.4.jar

      Firstly, I would back up your current install by copying it to a new folder.

      You should then be able to copy the new server .jar and run that. It should upgrade your world to the latest version. I do highly recommend you back up the current install first.

  14. Avatar for Kendragon
    Kendragon on

    If you want to be able to use server commands, remove the ampersand (&) from the bash file. The ampersand effectively runs the server in the background which allows you to continue doing stuff on the pi terminal.

    1. Avatar for Gus
      Gus on
      Editor

      Hi Kendragon,

      That’s a good suggestion, especially if you don’t need the server to run in the background.

  15. Avatar for Marius
    Marius on

    Hello,

    I do not find the newest source for the server.
    Can you update tutorial for the 1,14,3 minecraft version ?

    Thank in advance,

    1. Avatar for Gus
      Gus on
      Editor

      Hi Marius,

      I have uploaded the latest Spigot version to the file server. However, 14.1.3 is considered a development build, so I will hold off updating the tutorial with the new number.

  16. Avatar for Bryce Washington
    Bryce Washington on

    Hey I was just wondering if you could update the spigot version for the Raspberry Pi B+ installation. I’m pretty sure the newest one is 1.14.2.

    1. Avatar for Gus
      Gus on
      Editor

      Hi Bryce,

      I uploaded the latest version 1.14.3. You will just need to update the version number in the tutorial.

  17. Avatar for Anton
    Anton on

    Hi, I followed your steps to make the server start on reboot. It works, but I want to go back to the” >” prompt in which i can make myself “op” let myself use commands in game.

    1. Avatar for Gus
      Gus on
      Editor

      Hi Anton,

      To get back to the prompt you will need to shutdown the server using the process detailed in the boot on startup section.

      Once you have done that, simply launch the server from the command line and you will enter the command prompt.

  18. Avatar for Leo
    Leo on

    How do you install plugins using wget? there is no /home/minecraft/plugins folder.

    1. Avatar for Gus
      Gus on
      Editor

      Hey Leo,

      You simply need to create the folder. Utilize the command sudo mkdir -p /home/minecraft/plugins/ to create it.

      Cheers

  19. Avatar for rik
    rik on

    java -jar BuildTools.jar –rev latest
    will always work

  20. Avatar for Tomas
    Tomas on

    i have made a server, but if i type cd /home/minecraft/plugins it says that i dont have the map plugins and i also cant make a map called plugins because i don’t have the premission can someone please help me??

    1. Avatar for Gus
      Gus on
      Editor

      Hey Tomas,

      To create a new folder within the /home/minecraft folder you will need to use SUDO as the default pi user does not have read and write access to it.
      To create a folder in /home/minecraft/plugins utilize the following command sudo mkdir /home/minecraft/plugins.

      I hope that helps.

      Cheers

Leave a Reply

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