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

sudo apt install default-jdk

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.

284 Comments

  1. Steven on

    having trouble updating to 1.10, can i get some assistance

  2. Peter Lowe on

    Everything seemed to be going fine until I got to ‘sudo nano eula.txt’ where nothing is found. I just get a blank new file. Thinking about this now it could be that I downloaded 1.9 spigot. I am one of those strange creatures (teachers) who want to use Minecraft for Pi to teach Python programming. Should I go back through the config and stipulate ‘Minecraft for Pi’ and how do I do that?

    1. Marc on

      If you’re getting a blank screen that means it’s creating a new file. Just viewing the EULA you don’t need to use SUDO and a simple CAT, MORE or LESS will suffice.

    2. Marc on

      Come to think of it Peter, it sounds like you’re in the wrong directory. Use PWD (print working directory) to make sure you’re where you think you are and LS to see if the file exists.

      It’s been a while since I installed Spigot but I am using 1.9 on that device.

  3. Thomas on

    I have completed all the steps and I think it’s a great and straight forward tutorial. But, I don’t know how to change the wold’s seed. I typed in the seed I wanted in the server.propeties folder next to ‘level-seed=’. But when I reloaded the seed the world didn’t change 🙁
    Plzzz help,
    Thomas

    1. wizdude on

      the seed is only used when the world is first generated. it is not possible to change the seed once once the world exists.

      if you wish to re-seed your world with a new seed specified in the server.properties, you need to stop your server and delete the entire “world” folder (with a command such as: rm -r world)

      when you start your server again, a new world will be generated using the seed you have specified.

      it should be obvious, but be aware that by removing the world folder you are erasing the minecraft world you have been working in.

      happy seeding!

    2. Thomas on

      Thanks! But there’s one more problem, when I use the command : ‘rm -r world’ and try to remove it, Terminal says : ‘rm: cannot remove ‘world/session.lock’ : Permission denied’. It’s really frustrating! :'( >:( Is there any way round this? If so, plzzz tell me.

    3. marc on

      The system won’t allow you to remove files that are in use. Sounds like your sever is still running. If you stop it (using “killall java” example, although that’s a bit brutal) you should be good to go. Failing that, restart your PI and remove the world with “sudo rm -fr world” (CAREFUL!) that should sort you.

  4. Drew on

    I just got my MC Pi server up and running thanks to this tutorial! I did the setup using ssh (for the first time) on my Mac to contact the Pi. Is it possible to copy a previously saved game file from my Mac directly to the Pi, or will I need to put it on a thumbdrive? I would appreciate any guidance on how to copy the files over and how to get the saved game running on the server rather than the game initiated when I launched the server.

  5. Nick on

    Everything was great. But then server stopped. We power-cycled. And then did the command again to restart server…but it seems like it started a new world again. Is there a way to get old world back?

    How do we properly shut down and restart the same world?

  6. youssef on

    Hello,i tried to connect to my raspberry pi 3 minecraft server but on the pc minecraft says”failed to verify username”.What can i do?

  7. Rich on

    Hello, great tutorial! Can some one post up a link of the eula.txt file? Mine got corrupted and I need a clean copy. Thanks.

  8. Jordan on

    This tutorial was great. I have one question. How do you access the minecraft server from a PC that is on the same network. My raspberry pi 3 has an ip of 192.168.1.13, do I enter the ip address of the pi directly into the web browser on my pc??? Any help would be appreciated. Thanks in advance.

    1. Berend Jan on

      Go to multi-player (in minecraft)

      And select “direct connect” put your server IP (and port when you don’t use the default one) there and connect. I need 192.168.1.50 for creative and 192.168.1.51:55566 for survival. The different port is only needed when you try to connect your server to the Web and make it aprochable from outside your (safe) home network.

  9. Kevin on

    Hello! I’ve got this problem. When i get to step 16 (Raspberry Pi 1 modell B) and run the command: sudo java -Xms256M -Xmx496M -jar /home/minecraft/spigot-1.9.jar nogui I get the error: “Error: Invalid or corrupt jarfile /home/minecraft/spigot-1.9.2.jar” I’ve tried deleting everything and redo the steps and got the same error, i reinstalled rasbian and did the step and still got the same error.

    Someone please help me!

  10. Culpritt on

    Gus,
    Mate this was a great project for us {DAD and kids}.
    Your tutorial above was great we had it up and running in a couple of hours.

  11. Guy on

    Hi, this is my first Pi setup and wanted to say this was a great tutorial and after researching many sites on performance settings and making many modification to the server settings, have a very stable. *Lag is almost non-existent. you have to try\force to get it to lag.
    ~ RPi 3 running headless
    ~ Java v1.8 with Spigot 1.9 Mine craft sever
    ~ Plugins – ClearLag, NoSpawnChunks.
    ~ my World + Nether and The End are enabled
    ~ RPi3 has been up and running 24\7 for weeks now and very stable with 5 players.

    *** Have a few Q’s: (I’m a noob at this Linux based stuff as well with MC server).
    1. Was going to upgrade\replace the RPi3 with a new Odroid C2 (using eMMC5.0 storage) and wanted to copy the whole Minecraft Server folder from the RPi3 (spigot files\plugins\world) to the new Odroid C2 running on Ubuntu 16.04 (v1.1). http://www.hardkernel.com/main/products/prdt_info.php
    ~ Can this be done or do I have to Rebuild the MCserver.?

    2. If I had to rebuild the server would I use the same steps \ install files I used to make the MCserver on the RPi3.? if different what would I use.?

    3. on a Rebuild, would just copying my World be supported as is.?

    Thanks in advance.!

    1. Berend Jan on

      In your server.config you have named your world (default world) just build a new minecraft server on your new hardware. Copy your world directorys (world, world.end and world.nether) to your new server and tadaahhh.

      You can also change the name of your world. I renamed my world on my new server to mc-creative in the server.config and renamed the directory to me-creative. Easy as that.

  12. Nathan on

    Server seems to be working on my Pi2, but receive this while loading: “Java HotSpot(TM) Client VM warning: You have loaded library /tmp/libnetty-transport-native-epoll2403844579300997802.so which might have disabled stack guard. The VM will try to fix the stack guard now.
    It's highly recommended that you fix the library with 'execstack -c ', or link it with '-z noexecstack'.

    Also, I cannot see the server on any edition of Minecraft. I have been running the P.E. version, and the windows 10 beta. I understand this isn’t for the tablet or phone version. Is there a separate server that includes the compatibility?

    1. Guy on

      My RPi3 Spigot v1.9 MC server (non P.E.) is very stable and I get this as well “Java HotSpot(TM) Client VM warning:” but have disregarded it since I could not find any real support of it in online forums and it never seems to cause problems in-game.
      But I’m a noob at this, so what do I know anyway..lol

  13. Kiah May on

    Please update the mediafire path as it is invalid or deleted

    1. Gus on

      They’re all valid….

  14. Ian on

    Apparently, the build tools keep failing for me, and when I download directly from the mirror, Spigot shows up as “spigot-1.9.2.jar”, is colored red, and whenever I try to do “sudo java -Xms512M -Xmx1008M -jar /home/minecraft/spigot-1.9.2.jar nogui” it says “invalid or corrupt jarfile”. Any idea on what I could do?

    1. Gus on

      Hi Ian, that’s strange the build tools keep failing.
      I have reuploaded the spigot-1.9.2.jar file so you can try downloading and running it again.
      If that still fails you can try updating your Pi using the sudo apt-get update & sudo apt-get upgrade commands.

    2. Ian on

      The jar file still won’t work for me. Also, I noticed that when I try to run the BuildTools, I have the error “Exception in thread “main” org.eclipse.jgit.api.errors.TransportException” which was mentioned on the spigot site as being caused by AntiVirus, but I don’t know how to whitelist the spigot site on the Raspberry Pi.

    3. Ian on

      Well, I got it to work, but is there any way to kill the server without the process id? I think I forgot to use nogui in an important place.

    4. Jeff on

      I’m using a Raspberry PI 2, like Ian I also found that my upgrade attempts from 1.9 to 1.92 failed. Here is the error:

      Exception in thread "main" java.io.IOException: Cannot run program "java" (in directory "."): error=2, No such file or directory

  15. Josh on

    I got this up and running without any troubles. Now, though, Mojang just rolled out 1.9.2 and my server won’t let us log in unless we’re on 1.9.1. How do I update the server to the latest?

  16. djlawzon on

    Hey, great guide. Got a server up and running if anyone would like to test it.

    1.9 server running a couple plugins, seems to run ok with a couple players.

    Address is: lawsonmc.servegame.com:25800

    Thanks

  17. Scott on

    Gus,

    Thank you for the great tutorial – even us newbies to Pi and ssh can follow along.

    I’ve got the 1.9 server running on a RPi3 and all seems to be going fine, but I’ve got a few questions I have not found answers to in the tutorial or here in the comments.

    The only things I did differently in the install was that:
    1) I did not create the auto-start script.
    2) I was not allowed to Overclock

    1) Each time I restart the server, it stops, with the message “Failed to load eula.txt. You need to agree to the EULA…” When I again edit the eula.txt file, it contains the TRUE setting I had earlier edited. Any idea why it isn’t loading/recognizing the edited file?

    2) On my PC install of Minecraft, I can delete(or rename) the “world” directory and the game will create a new world to play. When I do the same thing on the Pi install, the server fails. Apparently there is something different in the Pi versions’ “world” directory. What is the best way to create a “new world” to play on this server?

    3) During gameplay, I’m getting a little hesitation in movement and then seeing Terminal warnings that “UserName” moved too quickly! Since I’m not running the server 24/7, would the solution be to bump up the memory from the recommended setting of 16?

    4) Can I just replace the whitelist.json file with the same document from a PC server version? – or, like renaming the “world” folder, is there something different about these servers that would cause a fail?

    Thanks again for this and your other projects.

    Scott

  18. Richard on

    Just installed the server on my Pi 3 following your guide. All went well apart from a few issues. Firstly, plugins only seemed to be detected if they were in /home/minecraft/plugins/plugins, I get an error if I try the ‘wstats’ command from within the server environment, and I can’t actually access the server via Minecraft PE on our phones or tablets. I’ve got the IP address correct, and the port is 25565 (rather than the default port that Minecraft PE assumes (19132)). The server is running on the Pi so I’m not sure what else to try?

    1. Steve on

      Hi Richard, this installation guide is for PC version of Minecraft. You won’t be able to join Pocket Edition clients.

  19. Jeff on

    This tutorial is great and easy to follow!

    As evidence, I was able to hand my 11 year old, who had never worked with Linux / Unix, a Raspberry Pi2 and point him at this tutorial. By the end of the day he had a fully functional Minecraft 1.9 server.

    The only places that I had to assist was that I pre-installed putty and winscp on his computer and showed him how to use them. Then for the steps themselves he had issues with steps 14 and 15. For step 14 he missed the –rev 1.9 switch, and thus made a Minecraft 1.8 server. For step 15 he was afraid to proceed because he didn’t see spigot.jar. He didn’t realize the steps were referring to spigot-1.8.8.jar or spigot-1.9.jar. He was also able to easily follow the Boot on Startup section, and the Editing the Minecraft properties section.

  20. J on

    1. Is it necessary to download any version of java when java is already installed?

    2. Does that Chunks plugin need to be ran with java or does it do whatever it needs to do from the plugins folder? I tried running it and couldn’t get it to go.

Leave a Reply

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