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. Morris on

    Hi it was a nice tutorial thanks for it but how to delete a plugins ?

  2. Cory on

    Same issue as Corey -> Feb 9 | Frozen command line on reboot

    I'm having this exact same issue and no idea how to solve it. The server however is working.

  3. Mike on

    Hi Gus,

    going to try creating the minecraft server tonight….fingers crossed! hahaha.
    But I have a small other question about the Pi. When I was running OpenElec with Kodi and I pulled the power cable out OpenElec had to be reinstalled from the ground up.
    Is that allso the case with this minecraft server?
    A Pi doesn’t have a power button. So how do I shut-down the server propperly so I don’t lose data and don’t have to reinstall it over again?

    With kind regards,
    Mike
    The Netherlands

    1. Anglaborg on

      Write “stop” in the commandline.

    2. Bri on

      If you login to the pi via ssh and enter this it will shut down

      sudo shutdown -h now

  4. Steve on

    This worked great for me, thank you. We have had quite a bit of use of the last two weeks 🙂

    With the update today to to 1.9 minecraft how to I easily (hopefully) update the server, without losing the config, whitelist and world etc.

    Kind Regards,
    Steve

    1. Gus on Editor

      Hi Steve,

      To update you will need to redownload the buildtools and have --rev 1.9 at the end of the command when you go to run them eg.
      sudo /opt/jdk1.8.0_60/bin/java -jar BuildTools.jar --rev 1.9

      When you run them you should have a new server to run called spigot-1.9.jar.

      Something like the following should back up your entire minecraft folder just in case anything goes wrong.

      sudo mkdir /home/minecraft_backup
      sudo cp -R /home/minecraft/* /home/minecraft_backup/

      Double check to make sure it all copied over correctly by using something like:

      ls /home/minecraft_backup

    2. Steve on

      Morning Gus,

      I would have missed the –rev switch. Took a while to update, but worked without a hitch and my son and I are enjoying playing Minecraft 1.9 on our Pi 2 server.

      We would like to thank you, both for the initial Tutorial and your prompt response regarding the update process. Your readers may like to look at a plugin we found to help keep the monster spawns to a reasonable level, it’s called Clearlagg.

      Hope you all have a lot of fun.

      Cheers,

  5. Anglaborg on

    How do I update the minecraft server if Spigot updates to 1.9?

    Otherwise it works perfect! 😀

    1. Gus on Editor

      Hi Anglaborg,

      Spigot updated to 1.9 today to update you will need to either download the buildtools again and use the tag --rev 1.9 when you run it or I have a prebuilt version further up on this page you can download.

      I would recomened backing up banned-ips.txt, banned-players.txt, ops.txt, server.properties and the world folder beofer you go to update just in case.

      Something like
      sudo mkdir /home/minecraft_backup
      sudo cp -R /home/minecraft/* /home/minecraft_backup/

      This should back up the entire minecraft folder to minecraft_backup.

    2. Anglaborg on

      Thank you! Tried it and it worked perfectly after I updated/redownloaded the newest BuildTools.jar!

      One question:
      I start the server with “sudo java………”
      instead of “sudo /opt/jdk1.8.0_60/bin/java……..”
      So is there any difference or why should I do the “sudo /opt/jdk1.8.0_60/bin/java…”?

    3. Gus on Editor

      There is no difference, /opt/jdk1.8.0_60/bin was required as Raspbian Wheezy didn’t include Java by default. Raspbian Jessie however includes Java by default so we can just use “java” now.

  6. Mike on

    Hi Guys,

    Great tutorial! My sons are playing Minecraft for about a week now. They around 6 and 7 years so.. 🙂
    And I would like to setup a minecraft server so they can play in that world with there friends.
    I have a Pi 2 model B that’s running OpenElec but I want to use the Pi now for the server.
    As I need to start from scratch I need Raspbian.
    But there is Raspbian and Raspbian Lite. Can I use both for this?

    Hope you can help me out here.

    With kind regards,
    Mike
    The Netherlands

    1. Gus on Editor

      Hey Mike, Either of those should work just fine. I would personally probably go the Lite version for a server since there will be less overhead.

      I haven’t tried doing doing this on the lite OS so you might run into problems.

      If you do just let me know!

    2. Mike Wellink on

      Hi Gus,

      Thanks for your reply.
      I’ll have a go at it…the Lite version I mean. I’m not a programmer so I hope all goes well! 🙂 hahahaha.
      If I run into problems your the first one I notify. 😉

      Kind regards,
      Mike

  7. Jake on

    Hi,
    So when I made the startup start.sh file, Im not sure but I dont think I included the “nogui” part and now when the device boots, it automatically loads the server however doesnt have the “>” sign that shows I can use commands and instead it is just blank. I can type anything in and when I press enter, nothing will happen, it just goes onto the next blank line, is there anyway I can access the rc.local file or start.sh so I can modify it?

    Even anyway to just kill the server so I can go back to the main console?

    Any help is appreciated, thank you

    1. Eduardo Osorio on

      Take a snapshot of the memory usage stats at the time the server crashes. Also check for disk usage. If you want to use a monitor tool for memory and disk usage I’d recommend the Nagios monitoring tool.

  8. marten on

    omg it’s working.
    I didn’t want to buy a server, so I wanted to make one on my pi and succes.
    without your tutorial I wouldn’t succeed!

  9. Erik on

    I was able to get this up and running for a few days and then without making any changes it crashes every time time. I have the latest.log file posted in case anyone can maybe identify what is happening.

  10. Corey on

    Hi Gus, I have a situation with the final sudo reboot. Once I set the file to automatically start upon a reboot, it loads but never lets me do anything. It constantly loads and never allows commands to be entered. But once I deleted the addon in rc.local it allowed me login up reboot. Is there a way around this or a way to not start the server automatically but still be able to start it?

    1. Corey on

      This meant to be a reply of the one above ^^

  11. Corey on

    Hiya Gus, thanks for the awesome tutorial. Just one problem from me that I have no clue what to do about. When I run sudo reboot to test the server starting automatically, it does all its loading and what not. But then I get to the INFO message “Done (6.234s, < this always changes)! For help, type "help" or "?" After this nothing happens and I can not enter any commands. Did I possibly upload a file wrong? Is my PI messed up? I have no clue here, anything from anyone would be greatly appreciated.

  12. Griffin on

    whenever I run the “sudo -Xms512M -Xmx1008M -jar /home/minecraft/spigot-1.8.8.jar nogui” command, it fails, saying sudo: invalid option – – ‘X’ please tell me how I can fix this. I would really like to play with my friends, and none of the other tutorials out there help me.

    1. Gus on Editor

      Hi Griffin,

      Make sure your command contains a call to java otherwise it won’t understand the Xms commands. Also sometimes if you copy and paste the “-” won’t be correct but looks the same.

      The following should work if you’re running a Raspberry Pi 2 with Raspbian Jessie.

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

      Let me know if that helps!

    2. Griffin Lee on

      Yes. That helped so much! Thank You! I never thought it could be that simple…

  13. Steven Elemen on

    I followed the tutorial above and have had the server up and running for a week or so. I can’t seem to get any plugins working though. I installed the NoSpawnChunks plugin per the tutorial and assumed that it was working. But when I tried to install others, such as Essentials it looks like none of them are. I looked at the compatibility list for 1.8.8 and only have plugins that are marked as working, but when I do >plugins, I always get Plugins (0):
    Even after rebooting the server and confirming they are in the correct folder (/home/minecraft/plugins/).

    Any suggestions?

  14. Kevin on

    How do you make someone op?

    1. Berend Jan on

      /op name (or fist three of four letters of the name + tab)
      /deop name removes it again.

  15. stan on

    After set the autostart, how do I get in the console/window to see the (screen) log and where I can give the op commands?

  16. sal on

    how do you exit eula.txt?

    1. Colton on

      I had the same problem. Do:

      Ctrl X
      Y
      Enter (return)

      Control X exits the text file, the Y tells the computer to save the change, and the enter saves it as eula.txt, overriding the eula.txt with “false”

      Hope this helps.

  17. Bob on

    How do i get the minecraft console when i have the server start on boot up

    1. John on

      You go to https://[your.server.ip.here]:8443 and log in. From there go to the drop down menu and select your server. Now in the navigation bar on the left several things will appear one of which is your server log. Go to the server log and that’s where your console will be slumbering 🙂

  18. Sean Gilligan on

    Thanks for posting this — it has been very helpful.

    One suggestion I would make though, is to update the instructions so that ‘sudo’ is only used when truly needed.

    We’re using the latest Raspbian that includes Java. We created a user named ‘minecraft’ (with the ‘adduser’ command) and have run many of the commands from that account without sudo (starting with the wget of BuildTools.jar) and have the server up and running.

    We haven’t done the optimization or boot-on-startup yet, but will be doing that today and will let you know if we have any issues.

    Thanks again, for creating this post!

  19. Colton on

    When I run step 14 (The step to download the Spigot.jar) It takes about 30 min, like Gus said it would, but then gave me an error and when I compare the files I have to what Gus has, it shows me that I have all the same files except for the spigot1.8.8.jar and the craftbukkit1.8.8.jar

    I am scared to do the command again for fear of downloading something twice and messing future things up. Any thoughts?

    This is a great tutorial, and other than this slight bump in the road it has been perfect.

    1. Colton on

      *replying to own comment*

      Also, I have a Pi 2 B with Raspbian Jessie.

  20. Peter on

    Hello! Thanks for a superb tutorial!
    I’ve now setup up the server, and it’s running.

    My question is, how do I get to the minecraft-server now, when it starts automatically?

    Best regards
    //Peter

Leave a Reply

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