Raspberry Pi Minecraft Server 1.13.2 / 1.14.4 Installation Script / Optimization Guide

Many things have changed since I wrote my last Raspberry Pi Minecraft Server guide.  OpenJDK is now the better supported Java for Raspberry Pi and Oracle has discontinued support for Java 8 in January 2019.  Java 11 is out and offers a ton of performance improvements. 

The Raspberry Pi 44 has also arrived!  After testing the server on the 4B 2GB version using OpenJDK 11 I was blown away by the performance and decided to write an updated guide and a script that will have you up and running in minutes.

To give you a taste of how smooth the timings are in OpenJDK 11 headless using the Paper Spigot Minecraft Server here is a nearly 2 hour session I played with my girlfriend.  This was played in survival mode on a brand new server so no blocks had been pregenerated and no settings were modified from the defaults.  Nothing is overclocked except the SD card.  There was even a village right by the spawn so many entities were in use.  Here’s the timings output report:

Raspberry Pi Minecraft Server Timings
Raspberry Pi 3B+ Minecraft Server Timings
Raspberry Pi 3B+ Minecraft Config
Raspberry Pi 3B+ Minecraft Config

RPI Minecraft Server Requirements

Minecraft Server Setup Script

SSH into your Raspberry Pi and type/paste the following commands:

wget -O SetupMinecraft.sh https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/SetupMinecraft.sh
chmod +x SetupMinecraft.sh
./SetupMinecraft.sh

This will start the server and configuration setup process. It will ask you some questions on how you want to configure the server and then automatically download, setup and start the server. Follow the Minecraft Server setup script in-depth guide here for a walkthrough.

… and we’re done!  The Minecraft server is now in the folder “minecraft”.  To start the server type:

cd minecraft
./start.sh

The server will start in the background using the screen application.  To view the console type:

screen -r minecraft

From this console you can issue any command to the Minecraft server.  The most important one you should know is the command to safely stop the server.  This will save all players and states which is simply “stop” without the quotes. 

To get out of the console without closing the server press Ctrl+A and then Ctrl+D.  This will minimize the screen session and put you back in your main console session.  The screen session will continue to run even if you disconnect from your SSH session to your Pi!

For a more in depth guide/walkthrough of the installation script check out this post covering the setup script in depth.

Pi Specific Performance Optimizations: Storage and GPU Memory

The most important optimization you can make is high performance storage.  Read my Raspberry Pi Storage Benchmarks article to see why some storage mediums are over 1000% faster for I/O which is the most critical factor for a Raspberry Pi Minecraft server.  You can also use USB adapters for mSATA SSDs (cheap on eBay) or a USB to SATA cable if you have a 2.5″ older SSD.

If you are going to use MicroSD anyway you must use a high performance MicroSD card and overclock your SD card reader to obtain the best performance.  It is normally 50hz to ensure compatibility with the cheap low quality cards but goes all the way up to 100hz.  Storage speed is a major bottleneck on the Pi and this increases your read/write speeds. 

The second most important optimization is setting your GPU to only use 16mb of RAM.  Since RAM is at a premium on the Pi it needs need as much as possible (64 MB is used by default).  This is all done in the Raspberry Pi’s /boot/config.txt file.  Type:

sudo nano /boot/config.txt

Then place these lines at the bottom of your config.txt file:

dtparam=sd_overclock=100
gpu_mem=16

Now restart your Pi using

sudo reboot

That’s it!  If your Pi won’t boot up after doing the SD card overclock don’t panic.  Just put the SD card in any computer and remove the line dtparam=sd_overclock=100 from boot.txt.  You can do it from Windows using notepad or any other text editor on any OS as the boot partition is always visible.

If you are using a older Raspberry Pi or a Raspberry Pi Zero then you may want to overclock it as well for smooth performance in game.  My favorite guide for overclocking older Raspberry Pis is located at the one and only RetroPie project wiki page located here.  The CPU and memory overclocking is going to be the most beneficial.

Minecraft Optimizations – The Timings Tool

If you are using an older Pi or have more than a few players using the server you may need to do some optimizations.  The most important thing to understand about optimizing your Minecraft server is to understand what is slowing it down.  There is an extremely useful tool built into the Paper Minecraft server called timings.  In the intro to this post I posted a picture of the graphs from this report.

To start the timings measurements open up your Minecraft console with the screen -r minecraft command like I covered earlier.  Once in the Minecraft console type:

timings on

The longer you take timings the better insight you will get into what is slowing down your server.  It is best to play as you normally would when taking these timings so you are taking accurate measurements.  To generate the report type the following:

timings report

This will give a link to paste in a web browser to view an incredibly detailed report.

Correctly Interpreting Timings

Detailed timings broken down by category
Detailed timings broken down by category

There are several different views available.  It is important not to look only at the “Lag” category but also view the “All” category.  If you only look at “Lag” you’re only seeing part of the picture.  This is useful for identifying major “spikey” slowdowns but not the overall performance of the server.  Check the “All” tab and toggle between total, average and count to understand how your server is performing.

In this example we can see some of the more expensive operations on my server are entities and chunks.  Entities are monsters/animals/items/villagers/etc.  Chunks are the map itself.  If you are doing heavy exploring on a new server you may see very large numbers for chunks.  This is due to the Pi generating them and storing them on the SD card (slow).  If you are spending lots of time in villages or fighting monsters the entities may be high.

Applying Optimizations

If you are not getting good performance and you have ran the timings tool here are some of the usual suspects to look for and possible optimizations to apply:

  • Be careful with mods/plugins – This is one of the most frequent causes of poor performance. Some mods massively increase the load on the server. The best way to find which plugin is doing this is to disable all plugins and enable them one at a time until you see the performance issues and have isolated the problem plugin.
  • Check config files – Configuration files are server.properties, paper.yml, spigot.yml, and bukkit.yml.  If unsure about what a setting does google it or consult the documentation.  If you screw up your configuration unintentionally then you can revert it to default by removing the file and relaunching the server.
  • Lower your entity counts/ranges – Type nano bukkit.yml and in the file you will find spawn-limits: monsters: 70 animals: 15 and several others.  You may lower these numbers to limit the number of entities by type.  Type nano spigot.yml and you will find entity-activation-range and entity-tracking-range.  These control how close you have to be before the server starts making monsters see/track you.
  • Disable the Nether and The End – In server.properties.  In the sample report you will see the Nether uses CPU cycles (we never went there).  When/if your group is ready to go to the Nether you can turn it back on in the properties to re-enable it.  You may disable “The End” in bukkit.yml by setting allow-end: false.
  • Lower the view distance – This should be a last resort but on older Pi hardware or if you want more than a handful of players this is an option.  It will increase performance dramatically because it reduces chunk loading/generation.  Since chunk loading/unloading/generation is very I/O intensive the Pi is not very good at it.  Change it in server.properties and spigot.yml.

Conclusion

The Raspberry Pi performs just fine as a Minecraft server for under 5 players. You can have multiplayer in what feels and runs like a single player experience!

For optimization the most important things you can do are

  • Pick the right storage (SSD or high quality Micro SD) to be able to keep up with block generation
  • Run your timings! This will tell you exactly what is slowing your server down
  • Keep plugins to a minimum to prevent swamping the Raspberry Pi with extra instructions
  • If all else fails lower the view distance

41 thoughts on “Raspberry Pi Minecraft Server 1.13.2 / 1.14.4 Installation Script / Optimization Guide”

  1. Avatar for mouseHYH

    Hello, I’m also thinking about building a Minecraft server for under 5 players on a Pi 4 with 4GB RAM, but I want to deploy a Vanilla server instead of Spigot or Paper as you are using here. I’ve read that Spigot and Paper have optimised performance, and I guess that is a reason why they still run well on a Pi 4 despite of its 1.5GHz CPU frequency. Do you have any experience with Vanilla on a Pi? And do you think with Vanilla I can still get good performance? Thank you.

  2. Avatar for Aidil Mazlan

    I ran into an issue while running the server and everytime I enter a certain place, The server crashes and start spewing this line :
    [21:44:42] [PaperChunkLoader-4/WARN]: java.lang.RuntimeException: Server attempted to load chunk saved with newer version of minecraft! 1968 > 1631
    [21:44:42] [PaperChunkLoader-4/WARN]: at net.minecraft.server.v1_13_R2.ChunkRegionLoader.a(ChunkRegionLoader.java:302)
    [21:44:42] [PaperChunkLoader-4/WARN]: at net.minecraft.server.v1_13_R2.ChunkRegionLoader.loadChunk(ChunkRegionLoader.java:260)
    [21:44:42] [PaperChunkLoader-4/WARN]: at net.minecraft.server.v1_13_R2.PaperAsyncChunkProvider$PendingChunk.loadChunk(PaperAsyncChunkProvider.java:387)
    [21:44:42] [PaperChunkLoader-4/WARN]: at net.minecraft.server.v1_13_R2.PaperAsyncChunkProvider$PendingChunk.run(PaperAsyncChunkProvider.java:579)
    [21:44:42] [PaperChunkLoader-4/WARN]: at com.destroystokyo.paper.util.PriorityQueuedExecutor.lambda$createPendingTask$1(PriorityQueuedExecutor.java:133)
    [21:44:42] [PaperChunkLoader-4/WARN]: at com.destroystokyo.paper.util.PriorityQueuedExecutor$PendingTask.run(PriorityQueuedExecutor.java:273)
    [21:44:42] [PaperChunkLoader-4/WARN]: at com.destroystokyo.paper.util.PriorityQueuedExecutor.processQueues(PriorityQueuedExecutor.java:196)
    [21:44:42] [PaperChunkLoader-4/WARN]: at java.base/java.lang.Thread.run(Thread.java:834)

    and i run the minecraft server on a Raspberry Pi 3 B+ and at the time of the crash i was the only one in the server
    and i dont know to fix it
    Please help

  3. Avatar for Anthony

    My server is pretty laggy. Blocks reappear and mobs freeze and skip around. Could you give me some tips on how I could optimize my settings? Because in one of your answers, you said you’ve heard of 12 people getting on a 3B server. I would like my server to run smoothly with 5 people. (I already set the max to 5)

  4. Avatar for TheRooster13

    Has anyone been able to use more than ~2800MB with a 4GB RPI4? I get errors from Java when I try to use more than that.

    1. Avatar for jamesachambers

      I believe you’re hitting the “3 GB Barrier” RAM application size limitation for 32 bit. 64 bit distributions will let you use all of it but support for 64 bit is shaky right now but will stabilize soon.

      1. Avatar for TheRooster13

        Ah, okay. Are you planning on changing your script to support 64 bit, or a choice between 32 and 64 bit? For now I would have to manually update to 64 bit OpenJDK?

        1. Avatar for jamesachambers

          Welcome back Rooster!

          Right now it installs whichever Java is native to the operating system. So on 32 bit that is 32 bit and on 64 bit OS’s it is already 64 bit. The script doesn’t need any changes for it fortunately and you can already do it by running Ubuntu Server.

          All that being said you can absolutely choose whichever Java version to you run that you want. The script will run whichever the default one is on the system.

          1. Avatar for TheRooster13

            Oh, so the OS is 32 bit.
            So according to your Ubuntu Server article, Ubuntu 64 bit works with RPi4 but only using 1GB of RAM which kinda defeats the whole point of going 64 bit for a Minecraft server. Bummer. So we just wait for a RPi4 compatible 64 bit OS that allows us to use all 4GB of RAM, and hopefully the 64 bit OS will have better performance than the 32 bit OS because it can take full advantage of the 64 bit CPU?

  5. Avatar for TheRooster13

    James, is it easy to set up something like MCMyadmin on your Raspberry Pi 4 server? I like being able to administer my home Minecraft server remotely via a website. Or is there something else you would recommend?

    1. Avatar for jamesachambers

      I honestly haven’t tried MCMyAdmin specifically, but remote management capabilities are something I’m considering in the future to add in depending on interest.

  6. Avatar for Fabian

    Hey James,
    thank you a lot for doing this! I followed your tutorial and its running like a charm! I got myself a raspberry pi 4 with 4GB of Ram. I set the RAM for the server to 2000MB for now, but I would like to know how to change that. I havn’t found any line of code, which could be connected to the RAM.
    I set the RAM while setting up the server for the first time – do I have to do that again, if I want to raise the RAM?`

    Another quick question:
    I’ve got a pretty slow Internet Connection and when I am starting the Server its talking a “long” time to get to 100%. Is this coming from my internet connection or is this a normal thing?

    Thanks in advance!

    Best regards,
    Fabian :3

    1. Avatar for jamesachambers
      jamesachambers

      Hey Fabian, glad to hear it helped!

      To set the server RAM again you can run the Setup script again or just edit start.sh’s very bottom line with nano start.sh.

      Close the server, then cd ~/minecraft and type nano start.sh. Go to the very bottom line:

      screen -dmS minecraft java -jar -Xms400M -Xmx1500M /home/pi/minecraft/paperclip.jar

      Change the Xmx1500M to the amount of megabytes you want to allocate to the server. Now start the server back up!

  7. Avatar for Sahin

    Hey James,
    first of all thanks for sharing you knowledge and work! Especially with your script and detailled information you make it super easy for us guys. I appriciate that.
    Anyway, I run across two problems. Here’s my setup: Server is hostes on my RPi 2B+. Game is played on my RPi 3B+.

    First problem: The server installed with your script is 1.13.2 and I think at the moment 1.12.1 ist the latest running client on my Pi 3. I see two options.
    Option 1: Using your “outdated” manual installation guide to install an older server version. And since in the future I’ll have to wait for people to get the latest MC version running on the Pi, I guess that’s my best option to go for and not beeing dependent on scripts.
    Option 2: Simply getting the 1.13.2 MC client running on my Pi 3.
    Probably I can fix this problem by myself, but some tips are welcome.

    THE REAL PROBLEM: Shortly after starting the server and everything is loaded, I get a bunch of red error lines in the screen window. And even though it states that “THIS IS NOT A BUG OR A CRASH”, none of my friends are able to connect to the server. The error lines are like app//com.majong.datafixers…, java.base@9-Raspbian/java.util…, app//org.bukkit.craftbuild…, app//net.minecraft.server.v1_13_R2…, etc.
    I don’t even know what that means and by consequence how to fix it.
    Can anyone help??

    1. Avatar for jamesachambers

      Hello Sahin,

      I think I can help! The Paper Minecraft server still supports the 1.12.2 branch. My understanding is that 1.13 introduced the new version of LWJGL that hasn’t been ported to ARM yet so if you can upgrade to 1.12.2 there are still supported versions of the server. Check out this link for the downloads: https://papermc.io/downloads#Paper-1.12. You can still use all of the current scripts, you will just replace paperclip.jar with the one from the linked site. Here’s a link of the guy running 1.12.2 on RPI: https://www.raspberrypi.org/forums/viewtopic.php?t=208027

      Now to address the real problem section. A couple of things: Is this a brand new server or is this your 1.12 server now running on the 1.13 server? There are some version compatibility issues between the two. It would also help to see the full error message. There’s actually some useful info buried in the 20+ lines it spits out every time it has an error so pasting a full copy would help as well. From what you posted I see a DataFixer exception. The DataFixer class is the class that helps manage data between different Minecraft versions which would point to my original theory.

      If you go the 1.12.2 route then it would be best to load up a backup from before the 1.13 server ever touched it as moving forward is difficult enough and moving backward is impossible once 1.13.2 put its own data structures in there. Let me know what you think and if this is a new or existing server and paste in some samples of the full error and we should be able to get it straightened!

Leave a Comment

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

Type here..