Raspberry Pi Minecraft Server Setup Script w/ Startup Service

Minecraft 1.16 Nether Update
Minecraft 1.16 Nether Update

Minecraft 1.16 (Nether Update) is here! This script and guide are written to help you get a great performing Raspberry Pi Minecraft server up and running in only a few minutes.


  • Sets up fully operational Minecraft server in a couple of minutes
  • Raspbian / Ubuntu / Debian distributions supported
  • Installs and configures OpenJDK 11 (or higher if available)
  • Sets up Minecraft as a system service with option to autostart at boot
  • Automatic backups to minecraft/backups when server restarts
  • Updates automatically to the latest version when server is started
  • Easy control of server with start.sh, stop.sh and restart.sh scripts
  • Optional scheduled daily restart of Pi using cron
  • Optional configuration of video memory to 16MB (default 64MB) and overclocking MicroSD reader to 100Hz (default 50Hz) for maximum performance


  • Raspberry Pi model with 1 GB of RAM or higher. Basically a Raspberry Pi 2B or higher. (No Zero unfortunately, 512MB is not enough RAM to do this, I’ve tried!)
  • Headless Linux distribution such as Raspbian Buster Lite, Ubuntu Server 18.04.2, or any Debian based distribution (GUI distros can be used at the expense of available RAM and server performance)
  • Solid state drive highly recommended but not required.
    You can get a SSD setup on a Pi for less than most Micro SD cards cost. See my article here for details
  • If using MicroSD you want to be using a high range card otherwise you will really be hurting on IO when the server is reading/writing chunks of terrain! Click here for MicroSD card benchmarks/recommendations.

Recommended Gear

Minecraft Java for PC / Mac / Linux*

Raspberry Pi 4
Raspberry Pi 4

The Raspberry Pi 4 is available in different memory configurations all the way up to 8 GB. It’s about the size of a credit card and uses an extremely low amount of power making it ideal for all sorts of projects and ideas!

Links: AliExpress.com*, Amazon.ae*, Amazon.ca*, Amazon.com*, Amazon.com.au*, Amazon.com.mx*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.in*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.sa*, Amazon.se*, Amazon.sg*

Kingston A400 2.5″ SATA SSD

The Kingston A400 has been a great drive to use with the Pi for years. It’s reliable, widely available around the world, has low power requirements and performs very well. It’s also very affordable. This drive has been benchmarked over 1000 times at storage.jamesachambers.com and is the #1 most popular SSD among the Pi community!

Links: AliExpress.com*, Amazon.ae*, Amazon.ca*, Amazon.com*, Amazon.com.au*, Amazon.com.mx*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.in*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.sa*, Amazon.se*, Amazon.sg*

StarTech 2.5" SATA to USB 3.0/3.1 Adapter
StarTech 2.5″ SATA to USB 3.0/3.1 Adapter

Both the USB 3.0 and USB 3.1 variants of the StarTech 2.5″ SATA adapter work well with the Pi 4. I’ve used the 3.0 variant with my Pi 4 since launch and it has always worked well. I later bought the 3.1 variant and had the same positive experience. These two adapter variants are my go to adapters for all my Pi related projects that need a fast and easy 2.5″ SATA SSD!

Links: AliExpress.com*, Amazon.ae*, Amazon.ca*, Amazon.cn, Amazon.com*, Amazon.com.au*, Amazon.com.mx*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.in*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.sa*, Amazon.se*, Amazon.sg*

Or for a compact setup:

SanDisk Extreme Pro SSD

The SanDisk Extreme Pro USB SSD is a true solid state drive. This is different than a typical “flash drive” which uses extremely cheap memory and has very low random I/O performance/throughput compared to a real solid state drive. I’ve used both the USB 3.1 and USB 3.2 variants with the Pi successfully and they benchmark very well!

Links: AliExpress.com*, Amazon.ae*, Amazon.ca*, Amazon.com*, Amazon.com.au*, Amazon.com.mx*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.in,* Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.sa*, Amazon.se*, Amazon.sg*

SD Card Setup:

SanDisk Extreme A1 SD Card

The SanDisk Extreme A1-A2 SD card has the best scoring SD card on storage.jamesachambers.com for years and is second in popularity only to the SanDisk Ultra (often included in combo kits). The application class (A1) means random I/O speeds (very important when running an OS) have to meet a higher standard. There’s no benefit on the Pi for A2 right now so get whichever is cheaper/available.

Links: AliExpress.com*, Amazon.ae*, Amazon.ca*, Amazon.com*, Amazon.com.au*, Amazon.com.mx*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.in*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.sa*, Amazon.se*, Amazon.sg*

Choosing a Linux Distribution

The most important consideration when choosing which flavor of Linux to run the server on is simple: available RAM. Headless Linux distributions such as Raspbian Lite that don’t have a built in GUI have

Our biggest obstacle when running a Minecraft server on the Pi is available RAM since 1 GB is extremely low for this type of server. To have a playable experience you should not be running anything else on the Pi so all memory is available to be used.

After testing on many different distros I am finding Raspbian Lite and Ubuntu Server 18.04.4 32-bit to be the best choices. These distributions come with very few background processes and have rock solid support and performance.

64-bit vs 32-bit

There’s a lot of discussion in the Pi world about the up and coming aarch64 64-bit distributions vs. armhf 32-bit distributions. They have been and continue to improve dramatically. There are already use cases where 64-bit is far superior such as video encoding, advanced compression, etc.

So how about for running a Minecraft server? I have been testing extensively with Ubuntu Server 18.04 64-bit and the Debian Buster 64-bit. I have consistently had worse performance and stability than on 32-bit versions of the exact same distros.

But how can that be? It’s certainly true that Minecraft servers benefit in CPU performance from 64-bit versions of Java. The answer is actually incredibly simple: memory. The server running on a 64-bit Java Virtual Machine uses a minimum of about 100 MB more memory. This makes perfect sense because 64 bits > 32 bits by definition!

The Raspberry Pi’s 1 GB of memory has been the biggest obstacle for this project since the very beginning. Back when I first went into the Paper Minecraft developer IRC room and told them what I was trying to do I was practically laughed out of the chat room for even thinking of trying this. Most Minecraft server branches including vanilla can’t even start on the Pi because of the limited memory.

For a dedicated Minecraft server on the Pi I very highly recommend staying 32-bit. You will have more available memory which means it will be much faster and more stable. Since memory is our bottleneck the increased CPU throughput does not help us and losing *any* of our memory is disastrous!

If the Raspberry Pi 4 has more memory like we all expect it to this recommendation will change completely. Even 2 GB of memory would make the extra memory that 64-bit uses a non-issue and the CPU throughput performance gains very desirable. For now though stay 32-bit for a Minecraft server!

Tested Distributions

Raspbian Lite – It’s Raspbian. It has very low memory usage and is the official distribution of the Raspberry Pi. The server runs very well on this. It’s overall the best choice. The Buster release has made OpenJDK 11 available on it so it’s no longer behind the rest of the distros.

Ubuntu Server 18.04.3 – Ubuntu Server is my favorite Linux distro. I use it for nearly all of my projects. The performance of the 32-bit armhf version is on par with Raspbian. It’s a great choice! Click here for my Ubuntu setup guide for Raspberry Pi. The 64-bit version is not a fantastic choice and not recommended because of the higher memory usage. Stick with 32-bit and you’ll be a happy camper with Ubuntu Server.

Debian Buster 64-bit – Debian is the distribution Raspbian is based on. This version is a preview of Debian “Buster” which is the successor to Stretch and will be the next version of Raspbian when it is released. I like this distribution but it is currently still unofficial and unsupported. Performance and stability was less than Ubuntu and Raspbian.

Benchmark Your Storage

Make sure your storage is running fast enough to be an effective Minecraft server. I wrote a benchmark for this purpose to make this extremely easy. To get accurate results make sure nothing is running when the benchmarking is taking place.

Run the benchmark by pasting/typing:

sudo systemctl stop minecraft
sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash 

Ideally you will score around 1000 for a good quality Micro SD card (and much higher for solid state storage). A low score (< 700) here indicates here that it is probably time to upgrade to a solid state drive or a faster Micro SD card. Click here to view all the existing benchmarks.

You can still run the server if you’d like with a low storage score but be advised when operations like saving the server’s blocks take place the people online may experience quite a big of lag!


SSH into your Raspberry Pi and paste the following commands:

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

The script will setup the Minecraft sever and ask you some questions on how to configure it. I’ll explain here what they mean.

“Enter amount of memory in megabytes to dedicate to the Minecraft server” – The amount of memory that will be dedicated to the Minecraft server. The more the better, but you must leave some room for the operating system background processes.

If you exceed the total available memory either the server will crash or the Pi will get incredibly slow to the point where your SSH session will start timing out. The setup script will make a recommendation to you which is your available memory – 10% for headroom. If you aren’t sure what to put just go with the recommended amount.

Note for Raspberry Pi 4: Currently on 32-bit Raspbian 2700 MB is the maximum that Linux will let us allocate in a 32 bit environment. The script has been updated to check for this as the server will not start if it is set over 2700M on a 32 bit server. 64 bit operating systems will be able to allocate all available memory as Pi 4 support rolls out for them.

“Start Minecraft server at startup automatically (y/n)?” – This will set the Minecraft service to start automatically when your Pi boots. This is great because whenever you want to play you can just plug it in and go without having to SSH in.

“Automatically reboot Pi and update server at 4am daily (y/n)?” – This will add a cron job to the server that reboots the Pi every day at 4am. This is great because every time the server restarts it backs up the server and updates to the latest version. See the “Scheduled Daily Reboots” section below for information on how to customize the time or remove the reboot.

That is it for the setup script. The server will finish configuring and start!

Check Java Version

Sometimes if you have multiple versions of Java installed the wrong version of Java will be selected as the default. If the server didn’t start check that the right version of Java is selected with this command:

sudo update-alternatives --config java

If you get the message “update-alternatives: error: no alternatives for java” then you only have one version of Java installed and can skip to the next section.

If you are presented with a list of choices then your machine has multiple versions of Java installed. It will look like this:

update-alternatives: warning: /etc/alternatives/java has been changed (manually or by a script); switching to manual updates only
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1101      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1101      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

You will usually want to just select the newest version of OpenJDK that is listed so you would type 0 and press enter. In some cases on some platforms you may want to switch to the official Oracle JDK although I strongly recommend sticking with OpenJDK!

First Run

The first time you run the server it will take a little longer to start since it is generating all the server data. If you try to log in before it fully starts you will get a connection timeout error. Watch for the line: “Timings Reset”. This is the last line that prints when the server is ready to rock and roll. At this point you will be able to connect successfully.

The very first time you log into the server it will be slow for about 1-2 minutes. This is because since nobody has logged in before the server has to scramble to generate all the chunks within your view distance (10 by default) and send them to you/store them. During this time you may not be able to see very far and if you try to destroy blocks there will be noticeable lag from when they break to when they actually disappear.

Don’t panic! This will go away within a couple of minutes as the Pi catches up with all the first time login stuff it needs to do. Performance stabilizes and it will feel very much like the offline experience after that.

If you are hosting for a few friends I’d recommend logging in for the first time right after you set up the server instead of having several people nail a blank server at first startup. This gets it out of the way and when everyone is ready to log in the starting area chunks will be fully fleshed out and the Pi just has to read them. It’s an order of magnitude faster for the Pi to read chunks than to generate and store chunks.

In my experience after the initial login exploring new parts of the server doesn’t cause any lag even though new chunks are being generated. The reason for this is that when you’re walking it’s really only having to generate a new chunk as you get close to the border instead of a huge square area of chunks in all directions and all at the same time like during the first login.

Changing Minecraft Server Version

If you want to change which version your Minecraft server is running it can be changed by opening SetupMinecraft.sh with any text editor (example: nano SetupMinecraft.sh).

Change the line Version=”1.15.1″ to whichever Minecraft server version you want to run. Note that that version must already exist for Paper Minecraft. You can view all available versions at the following URL:


Changing Minecraft Client Version

If you are wisely running the “stable” branch instead of the “development” branch there will be times where you need to select the version of Minecraft to run otherwise you will get an error message that your client is outdated when you try to log in.

Fortunately this is very easy. Open up the Minecraft launcher and instead of hitting “Play” choose “Launch Options” in the menu at the top of the window. It will look like this:

Minecraft launch options
Minecraft Launcher “Launch Options” Tab

Click the “Add new” button and pick which version you want to add. You can optionally gave it a name or just click save.

Now when you go back to the “News” tab you will see a dropdown arrow where you can select which version of Minecraft you want to play!

Start, Stop and Restart Server

The server can be started, stopped and restarted two different ways. You can use the provided scripts in the Minecraft folder or you can use systemctl. Here are the commands:

cd ~/minecraft


sudo systemctl start minecraft
sudo systemctl stop minecraft
sudo systemctl restart minecraft

Automatic Backups

The server backs up each time it starts. This helps you recover easily if something goes wrong. This system works best if you configured the server to restart daily since it means you will have a backup every day.

To access these backups type:

cd ~/minecraft/backups

When a backup is made the filename will be the date and time the backup was taken. If you need to restore a backup it’s very easy. Substitute the timestamp in my example to the backup you want to roll back to. Type:

cd ~/minecraft
rm -rf world world_nether world_the_end
tar -xf backups/2019.

Your world has now been restored! It’s a good idea to download these backups off the Pi periodically just in case the Pi’s storage fails.

Scheduled Daily Reboots

The daily reboots are scheduled using cron. It’s very easy to customize the time your server restarts.

To change the time that the server restarts type: crontab -e

This will open a window that will ask you to select a text editor (I find nano to be the easiest) and will show the cronjobs scheduled on the Pi. The Minecraft one will look like the following:

0 4 * * * /home/ubuntu/minecraft/restart.sh
cron options

There are 5 fields here. The default restart time is set to reboot at 0 minutes of the 4th hour of the day (4 AM). The other 3 fields are left as * to represent every day of every month. Make any desired changes here and press Ctrl+X to exit nano and update the cronjob.

To remove the daily reboot simply delete the line and save.

Installing Plugins

The server supports plugins that are compatible with Bukkit / Spigot / Paper. A popular place that you can get plugins is at where there are thousands of them!

To install a plugin you simply download the .jar to the minecraft/plugins folder and restart the server. For example, WorldGuard is a very popular plugin that lets you add protection to different areas of your server.

To install this plugin on our Minecraft server we would use the following commands:

cd ~/minecraft/plugins
wget https://dev.bukkit.org/projects/worldguard/files/latest
sudo systemctl restart minecraft

The server will restart and the plugin will be installed. It’s that simple! To use the plugin refer to the documentation on the plugin download page to find out which commands you use to configure/interact with it.

Warning: be advised that plugins are the #1 issue for performance degradation on Minecraft servers. This isn’t because all plugins are bad. Some plugins are coded very inefficiently or perform features that require a lot of hooks in the code.

You should be careful about what plugins you install on the server and if you start having bad performance disable your plugins one by one until you find the culprit!

Reconfigure / Update Scripts

The scripts can always be reconfigured and updated by downloading the latest SetupMinecraft.sh and running the installer again. It will update all of the scripts in the Minecraft directory and reinstall the startup service for you.

Running SetupMinecraft.sh again will also give you a chance to reconfigure options such as the memory dedicated to the server, daily reboots, starting the server on boot, etc.

This will not overwrite your world or any other data so it is safe to run!

Port Forwarding

If everyone on your server is on the same LAN or WiFi network as you then you don’t need to do this. If you want people to connect from outside your local network then you need to set up port forwarding on your router.

The process for this is different for every router so the best thing to do is just look at your router and find the model # and put that in google with port forwarding for easy instructions on how to do it for your specific router.

You want to forward port 25565. The type of connection is TCP if your router asks. Once you do this people will be able to connect to your Minecraft server through your public IP address. This is different than your local IP which is usually a 192.x.x.x or 10.x.x.x. If you don’t know what that is just go to google and type “what’s my ip” and Google will kindly tell you!

Wired vs. Wireless

Going with an ethernet (wired) connection is going to be faster and more reliable. There’s so much wireless traffic and other interference in the air that running your server on WiFi is not recommended.

Even if it is working great 99% of the time it can ruin your experience very quickly if the WiFi drops for a couple of seconds and you get blown up by a creeper!

All that being said, the server works fine on wireless. The script will work fine as is with a wireless connection.


PLEASE BACK UP YOUR SERVER FIRST! The server makes automated backups by default for you in the backups folder but I recommend you back up the entire server folder yourself (basically the entire minecraft folder) any time you attempt to upgrade or downgrade. If you need to roll back to older versions it won’t work without a backup from that version or older!

The easiest way to upgrade an installation is to download the latest SetupMinecraft.sh and run it. This will automatically upgrade you to the latest version.

Upgrading and downgrading to versions that aren’t the default the script chooses is pretty simple. Simply change the Version line at the top in the SetupMinecraft.sh script:

# Minecraft Server Installation Script - James A. Chambers - https://jamesachambers.com
# More information at https://jamesachambers.com/raspberry-pi-minecraft-server-script-with-startup-service/
# GitHub Repository: https://github.com/TheRemote/RaspberryPiMinecraft

# Minecraft server version

Edit this file in your favorite text editor (you can use nano or vi on the Pi like nano SetupMinecraft.sh) and change the Minecraft version to what you want.



If you are having problems on a newer version of Minecraft and want to downgrade you can do so using a complete backup of your server before you ran it on a newer version.

The reason you can’t take server data that has been touched by a version such as 1.16.1 and go back to 1.15 is that the new version adds all sorts of new data types/structures for the new content into your server data files. If you try to roll back the old versions of the Minecraft server will not understand these data types since they didn’t exist in that version and will crash.

As long as you use a backup for your server files from that version (or older) it’s as simple as changing the version in SetupMinecraft.sh just like I show in the “Upgrading” section.

You can upgrade any old version of Minecraft to any version, but again make sure you have a backup first as it is a one way street and you will need that backup if you want to roll back!

Version History

To view the version history check out the GitHub README here:


584 thoughts on “Raspberry Pi Minecraft Server Setup Script w/ Startup Service”

  1. Avatar for Paul

    MARCH 20, 2021 AT 1:49 AM
    First, thank you for your aswesome Support.
    But I have a problem: my home directory is at a SD-Card while the server is on a SSD (/mnt/mc/HERE). I already have changed the location of the java paperclip command (the cmd which runs the paperclip) but I dont know how to place the updated paperclip.jar in the right folder. And the server keeps crashing…

    I hope you unsterstand what I’m trying to say.


    1. Avatar for jamesachambers

      Hey Paul,

      You could probably honestly just do a Find and Replace for the ~ symbol in the different scripts and change it to /mnt/mmc/here. The ~ just means home directory.

      All the files will need to be together. Your whole “minecraft” folder needs to be with the server since it depends on pretty much all the files in there and will crash otherwise. If the server is crashing that wouldn’t be script related (it won’t start at all if your scripts are broken). It likely can’t find what it needs.

      You’d need to do every single file to set a custom directory and use the find and replace function of your text editor and replace ~ with your SD card’s folder. Maybe even SetupMinecraft.sh itself as well as start.sh, stop.sh, restart.sh, etc. so it sets it up to go to the right folder. People have done it before though so if this is the configuration you need to use then we can definitely get it working!

      I wouldn’t worry about moving paperclip or anything else. The script will download and update that for you. You just need to point it to the right folder. If you don’t want to use your home folder replace all ~ with your custom folder and let me know how it goes!

  2. Avatar for MIchael

    I have installed your script on a raspberry PI4 8GB and the server is all working however it crashes every 10 to 15 mins due to a Java memory shortage

    There is insufficient memory for the Java Runtime Environment to continue.
    # Native memory allocation (malloc) failed to allocate 131080 bytes for Chunk::

    I have checked the start script and its set to allocate the max memory

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

    Would anyone have any ideas on what else i could check.


    1. Avatar for jamesachambers

      Hey Michael,

      Turn it down. You have it too high! There’s not enough memory for the other processes on your Pi.

      I’ve never seen someone have a memory crash from not having enough memory since like the Raspberry Pi 1 where we made it work on incredibly tiny amounts of memory. It’s always too much and not enough for everything else.

      The recommended usage is too high. I just updated the script to add 200MB of breathing room so I would try with the latest update or you can set yours to 2500 or maybe lower and it will stop crashing but that should get you taken care of!

  3. Avatar for Benjamin

    Hi James ps. sorry if this is my second comment couldn’t find my last reply

    first i just wan’t to say damn good work i really appriciate the work you’ve put into this! impressive.

    background info:

    raspberry pi 4 4gb model running raspbian with DE(desktop enviroment), allocated 2700mb(recomended) ram to the server, scored over 1000 in micro sd card test.

    so i’ve run this server for a little week now and i’ve noticed a problem: i ran the server where me and two of my friends joined and it worked really stunning, but however the server crashed because of a memory error it did gave me a hs log file and sometimes it gives a crashreport aswell. I later tried debugging to find out when and why it happened, so i fired up ‘htop’ a command line tool which monitors memory usage and ran the server (please check background info to see what im running the server on). when i ran the server and connected the htop tool reported that i was using 730mb ram, i stayed in the spawn for the chuncks to load proberly and then began to ‘stress’ the server. I switched to creative and began flying around to force load chunks and i could se that htop was reporting an increase of ram to about 790mb where it crashed. the wierd thing is that htop reported that there was a little over 2.8gb of free ram. and the server still crashed because of a memory error. what should i do? run raspbian lite? decrease the server ram?

    really hope you have any idea of what i should do. i can send you the crashreports aswell as the other log files (hs, replay) if that would help, please ask any questions, thanks!:)

    1. Avatar for jamesachambers

      Hey Benjamin,

      No worries about the other replies, I was able to see the right one!

      I think you’re really close. I definitely think you do need to decrease the memory slightly. The type of memory crash you’re describing sounds like we need to try reducing the memory usage first.

      I think I may need to lower the recommended memory because you are not the first one who has gone with the default and ended up with too much allocated (or another way to say it is too little memory left for everything else to run, so the OS kills the server to prevent from crashing).

      Before we try anything else try running SetupMinecraft.sh again and try setting the memory limit to something like 2300 or maybe even 2000 just for a test. Then what you want to do is get on it and fly around exactly the same way. If it’s still having issues we can definitely examine some log files as well!

      1. Avatar for Benjamin

        it works so much better now did a whole tnt test and it didn’t crash at all thank you!
        would you recomend using a 64 bit os for the pi 4 4gb model, and will i then be able to use more ram?

        1. Avatar for jamesachambers

          Hey Benjamin,

          You actually can use more RAM if it’s available using the 64 bit version!

          I’d say it’s definitely more worth it if you have something like the 8 GB Pi but I have had other people tell me here in the comments in the past that they did take their 4GB to 64 bit and were able to allocate more than 2700 without crashing! You have to disable almost every system process though and definitely use a “lite” or “server” distro that has pretty much nothing running. It does remove that limit since that’s a 32 bit thing and you can allocate more than 2700 MB if it’s available.

          I’d give it a try in the current configuration and see if you’re experiencing any problems. If you have a lot of people playing or are experiencing lag then it may be worth the trouble! The thing to watch out for though is that 64 bit won’t make a difference if all the resources are already being used up and there’s nothing free available extra to use. Hopefully that helps!

          1. Avatar for Benjamin

            hi james thanks for the replies!

            i did a pretty stupid thing i was trying to make a new save by moving the world/ worl_nether/ world_the_end/ to a folder called other_saves. But i already had a world in the “other_saves” folder so i tried removing them before moving my current world to the folder… but i thought i changed directory to the “other_saves” folder and ran ‘rm -rf *’ but i realised i typed:
            ls other_saves
            rm -rf *

            and i thought i was in that directory , but i ended up removing the entire minecraft folder aswell as the backups. are there any other backup locations or any way of redoing ‘rm -rf *’ ? damn if i just took 1 second to think before just deleting..

            1. Avatar for jamesachambers

              Hey Benjamin,

              So I have actually done this before too believe it or not! It’s actually incredibly easy to do so I wouldn’t be too hard on yourself.

              Linux doesn’t really have a recycle bin for the console commands unfortunately. It is possible to recover from a rm -rf but for the best chance of success you pretty much have to disconnect/remove the drive/SD card immediately and not write anything further to it (at all preferably) until you can attempt a recovery. This is because once the files are deleted that space is marked available as “free” space so the next time your drive tries to write something that space is fair game to start writing new stuff to. Typically for a Minecraft server your files will be scattered all over the available space as they aren’t all created at once. As your map expands totally new files are created and other stuff from your OS/activities will have filled the gaps in the mean time since the last files were written.

              One command is ‘extundelete’ but it usually isn’t installed by default and can be installed with apt-get install extundelete (but don’t do this on the drive with the files deleted preferably). Normally you would want to put the drive into a different computer and install extdelete on that one (so you don’t have apt overwrite the files you are trying to recover since they are marked as free space). Check out https://www.linuxquestions.org/questions/showthread.php?s=1c17365a0c41a378bda6eaafd5e1c439&p=5841412#post5841412 for some more background on this if you want to attempt this as well as some other utilities (check the second to last reply in the thread) that can help.

              I did not successfully recover my server when I accidentally removed my whole minecraft folder as there was pretty much nothing else on the Pi except for the server and the files were almost immediately overwritten by logs and other system utilities damaging some of them. Fortunately I did have a backup from a few weeks earlier but tons and tons was lost. I’ve tried to think of ways to deal with this in the script but haven’t had a clear answer. Maybe in the home directory the backups could be placed into something like mcbackups? I’m not sure how to totally prevent it but I myself have done it!

              Hopefully all that helps and best of luck, you may yet succeed where I failed if the files happened to be at the end of the drive or something and nothing has been overwritten on the disk yet!

              1. Avatar for Benjamin

                Thank you so much for the replies, apriciate it alot!

                I think i would maybe set a crontab to move the bsckups to another folder, or possibly maybe change the scripts path to outside the mc folder
                Thanks again!

              2. Avatar for Lukas

                Hi James,
                Is there available raspberry pi OS 64bit? I have 8gb Pi and I searched the official web and there is available only beta version of 64bit OS. And also many users are complainig about lots of bugs.

                Thanks for headsup with too much RAM. I’m facing a lot of crashing. I will try to adjust as you mentioned in previous comment, thanks for that!

  4. Avatar for Paul

    it’s me again to troubleshoot my problems (mentioned in an earlier post) i wanted to install multiple servers in differnt directories. (Don’t wanted to run multiple at the same time.) But then I noticed the path problems, this is creating. Could you please help me with this? (maybe contact me trough email?)


    1. Avatar for jamesachambers

      Hey Paul,

      Welcome back!

      There’s a few different ways to deal with this. Some people have opened the start.sh script and changed the paths for just those folders. This is really common when people actually do want to run multiple servers.

      In your case there is an easier solution. The way I like to do it is to just have a separate “minecraft” folder for each server and rename the entire thing. For example in your home directory you have the “minecraft” folder by default.

      If you wanted to switch servers you would stop the server completely first and then rename the “minecraft” folder to something like “survivalserver” or something that describes the server you were previously running. Now you would rename a different minecraft folder you already have, like “newfortserver” back to the default “minecraft” folder name.

      This leaves all startup services intact and all folder paths across every one of your servers exactly what they should be without having to fight with editing any files or really complex solutions. You can basically just “drop” a new server in after stopping it and then starting it back up!

      This prevents you from having to mess with the /etc/system/system services which is likely the problem you are running into. You can sidestep all of that by just stopping the server and renaming the whole “minecraft” folder and then swapping a new one in. Hopefully that helps!

      1. Avatar for Paul

        First, thank you for your aswesome Support.
        But I have a problem: my home directory is at a SD-Card while the server is on a SSD (/mnt/mc/HERE). I already have changed the location of the java paperclip command (the cmd which runs the paperclip) but I dont know how to place the updated paperclip.jar in the right folder.

        I hope you unsterstand what I’m trying to say.


  5. Avatar for I. Leath

    How do you edit world permissions and other things after stopping and restarting the server? I just set this up over ssh but I can’t get back to the server shell to do those things. Is this done in another place after first shutdown? Also, how would I port forward and set up a custom dns address for this? Thanks.

    1. Avatar for jamesachambers

      Hey I,

      Great questions! So the way to get in and out of the server console is like this:

      screen -r
      screen -r minecraft

      will get you back into the console using the “screen” application. To get back out of the console to the SSH command line press “Ctrl+A” followed quickly by “Ctrl+D”. This will send the screen instance back to the background so you can use the normal CLI.

      For your second question the port forwarding will depend completely on your router. Usually just looking at your router and finding the model # and giving that a quick Google search will bring up instructions for your specific router. For custom DNS you can use one of the free dynamic DNS providers such as dyndns (and some routers have this built in too) or you can purchase a domain name. I’m guessing you meant the former and that you want one of the dynamic IP address forwarding services!

    1. Avatar for jamesachambers

      Hey Paul,

      Great question. So yes it will, but if the world has already been upgraded you can’t generally go back. It will crash since it will encounter new data structures it doesn’t understand from the new version.

      If you are restoring from a backup though you can totally just set it to an older version that matches the version from when that backup is from. Hopefully that helps!

      1. Avatar for Richard H Smith

        I have a 8gb rpi4 running as a 64 bit Minecraft Multiverse server with several large worlds available, but only used one at a time. The problem that I am having is that world backups eat up all my ssd storage in about 3-4 weeks. Once this happens the server acts weirdly or fails to boot and I need to go in with FileZilla and delete most of the backup files that are around 1.5gb each. Other than not saving the backups, I wish there was a way like a file FIFO (first in first out) to limit the number of backups that are stored. Thanks for any suggestions. Dick

        1. Avatar for jamesachambers

          Hey Richard,

          Thanks for letting me know your experience! I thought I added backup rotation to this like I did for my Bedrock version of the script but I just looked through the source code and I surely do not see it anywhere!

          I’m actually adding it in right now. It’s going to keep the last 10 backups like Bedrock by default but you can easily modify this if your backups are getting really large (it sounds like they’re getting up there).

          I’ve committed the update to GitHub if you want to try the latest version which should add this for you!

            1. Avatar for jamesachambers

              No problem Richard, let me know how it is working! I’ve been waiting for 1.17 to get closer here to jump back in so I haven’t been actively testing the server script as much but I definitely need this in.

              This exact issue actually crashed my last server because I left it for a few weeks and it got full! That seemed like a bit like the cure being worse than the disease for backups so the script definitely needs the backup rotation. Cheers!

  6. Avatar for Paul

    I’ve been using this script to set up all of my servers of the past year.
    Now I have a problem with the Performance in 1.16.5. Everytime a user joins the mspt (milliseconds per tick) goes through the roof.
    Do you have any idea where this comes from?
    The 1.16.4 has run perfect, so I’m thinking about simply rolling back. I’ve read your charpter about rolling back, but wouldn’t it be easier (of cource after a backup 😉 ) to simply change the link in the start.sh? Or would there be any problems?
    Thanks in advance


    1. Avatar for jamesachambers

      Hey Paul,

      It probably is something with 1.16.5. I’m not totally sure if the data structures will have changed from 1.16.5 to 1.16.4 but I doubt it. You may need to restore a backup from that time period if you are experiencing crashes after rolling back but that is so close and since it is just a minor revision I am guessing your existing file will work just fine! Make sure you have backups of everything before you try anything or make any changes just in case.

      The Paper Minecraft server is frequently updated to fix things like this so I am guessing that it will fix itself on it’s own over the next few days/couple of weeks. I think what you are trying should work for the mean time though!

  7. Avatar for Zarkon

    Thanks for the excellent tutorial, James.

    One question. In my install, everything works except the cron job for restart.sh.

    If I run restart.sh manually in the command line, it works. If I let cron handle it, it closes the server correctly, but it doesn’t reboot the machine.

    Any thoughts? I am stumped.

        1. Avatar for Zarkon

          Hi James,

          Confirmed. I see it in crontab and I know it at least partially runs. It goes all the way through the shutting down of the server, but then it seems to hang as the last echo isn’t output to the command line.

          Strangely, if I run it manually (./restart.sh in the command line), it all works fine.

          1. Avatar for jamesachambers

            Hey Zarkon,

            That is very strange! I do have one idea you can try. Try putting the restart.sh crontab line in the user crontab file instead of the superuser’s. You can access this by typing “crontab -e” without the sudo part as the user you want to edit. I’m not sure if it will work or not yet but it seems like it’s not happy about something with our cron setup and this is one way to change it up while still accomplishing the same task. Since you added this user to the sudo group they should have permissions to restart it!

            I believe there is one minor difference in syntax between the system crontab and the user crontab (an extra field) so you may need to adjust the line slightly (make it match the examples at the top of the file). I think you’ll remove one field which is either the username or an asterisk if I remember correctly.

            1. Avatar for stizn


              I had the same issue on Ubuntu 20.10.

              To fix it, I added 1 line to the crontab file:
              @reboot /home/ubuntu/minecraft/start.sh

              greetings stizn

  8. Avatar for Alberto

    Hi! Great tutorial! Thank you!
    But I have a problem.. When the server starts, it writes 4 times “Preparing spawn area: 0%” for 4 times and then “Loaded 0 spawn chunks for world world”. The same with world_nether and world_the_end.

    What can I do? I have a Raspberry PI4 8gb RAM. Thank you very much!

    1. Avatar for jamesachambers

      Hey Alberto,

      Have you checked the server window or log files to see if there are any errors? If not then it may actually be stuck writing to the storage. Do you have a different SD card you could try with as a test?

      Checking those two things should lead us to some answers!

      1. Avatar for Alberto

        Hi James! Thanks for the reply!
        I just tried with another 16GB SD Card but it doesn’t work, same problem. And I check the log file and and there seems to be no errors. If you want I write you on Messenger and I send you the log file. My name is Alberto Filippi! Thank you very much!

      2. Avatar for Alberto

        Hi James! I found that Paper doesn’t work, if I download BuildTools for Spigot it works! Is there a way to edit your script for Buildtools (Spigot) instead of Paper? Thank you!

  9. Avatar for Dominik

    Hi James,

    thank you for the setup script. Worked nice on my 3B+ 🙂

    I was wondering what kind of accessories you a using with your Pi (especially if you a using some kind of cooling)?
    Also, did you evertry to max out your server? Roughly how many people can play at one time before the lag gets to bad?

    1. Avatar for jamesachambers

      Hey Dominik,

      Great question! About 3-4 months ago I recently played a survival server with 3 friends over the internet + myself for a total of 4. We did not experience any lag on a 8 GB Pi 4 on a SSD which was fantastic!

      Some people have let me know here in the comments that they’ve had more like 5-6 without too much trouble. One thing that can lag it is if people are “flying” at a very high speed and constantly generating new chunks in a new area, but other than extreme cases it works quite well!

      I’d be very curious if someone ever tried something extreme like 10+ more players on there but I haven’t heard of anything that high yet. Hopefully that helps and thanks for the kind words!

  10. Avatar for Anon

    Thanks for this guide, when I found that server software for bedrock either only works on x86 or has no mob support, I had the idea to use a java server with gesyer, I was expecting it to be an unbearable lagfest but it works surprisingly well on a RPI 3B, this guide and script made setting the server up easy!

    1. Avatar for jamesachambers

      Hey Anon,

      That’s awesome! I’m glad it’s been helpful. It definitely used to be an unbearable lagfest a couple of years ago when I first tried it but I think the QEMU emulation software/Pi hardware and firmware is improving to the point where it may be fast enough. Thanks for letting us know your experience!

  11. Avatar for J.D. Goodson

    Hey James,

    I hope you have been doing good, just wanted to give you an update about the bungee server.
    Everything works perfectly. No issues at all. Reboots daily and makes backups and all the servers start on reboot.

    Thank you again for your help and such a great setup script!

    I also wanted to share this with you, thought you might like it!

    Have a great day/evening/night!

    1. Avatar for jamesachambers

      Hey JD,

      Welcome back again! That is fantastic that the bungee server is working. Other people have also expressed interest in setting one of these up and I have been letting them know your success story and that you had done it before successfully!

      That is an amazingly cool Minecraft ore case! I love it, thanks for sharing it!

    1. Avatar for jamesachambers

      Hey Suhk,

      No problem! Go ahead and close the server by using “sudo systemctl stop minecraft” or opening the server console and typing “stop”. Once it has closed completely delete the “world” folder that is inside ~/minecraft.

      As long as you haven’t specified a seed in server.properties your server will generate with a new one. By default this is blank so if you didn’t put in a seed previously that is all you should need to do!

Leave a Reply to Sukh Singh Oberoi Cancel Reply

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

Type here..