Scott Hanselman

How to use a Raspberry Pi 4 as a Minecraft Java Server

September 07, 2020 Comment on this post [13] Posted in Gaming
Sponsored By

imageMy 14 year old got tired of paying $7.99 for Minecraft Realm so he could host his friends in their world. He was just hosting on his laptop and then forwarding a port but that means his friends can't connect unless he's actively running. I was running a Minecraft Server in a Docker container on my Synology NAS but I thought teaching him how to run Minecraft Server on a Raspberry Pi 4 we had lying around would be a good learning moment.

First, set up your Raspberry Pi. I like NOOBS as it's super easy to setup. If you want to make things faster for setup and possibly set up your Pi without having to connect a monitor, mouse, or keyboard, mount your SSD card and create a new empty file named ssh, without any extension, inside the boot directory to enable ssh on boot. Remember the default user name is pi and the password is raspberry.

SSH over to your Raspberry Pi. You can use Putty, but I like using Windows 10's built-in SSH. Do your standard update stuff, and also install a JDK:

sudo apt update
sudo apt upgrade
sudo apt install default-jdk

There are other Minecraft 3rd party Java Servers you can use, the most popular being Spigot, but the easiest server you can run is the one from Minecraft themselves.

Go to in a browser. It'll say something like "Download minecraft_server.1.16.2.jar and run it with the following command." That version number and URL will change in the future. Right-click and copy link into your clipboard We are going to PASTE it (right click with your mouse) after the "wget" below. So we'll make a folder, download the server.jar, then run it.

cd ~
mkdir MinecraftServer
cd MinecraftServer
java -Xmx2500M -Xms2500M -jar server.jar nogui

You'll get a warning that you didn't accept the EULA, so now open "pico eula.txt" and set eula=true, then hit Ctrl-X and Yes to save the new file. Press the up key and run your command again.

java -Xmx2500M -Xms2500M -jar server.jar nogui

You could also make a text file with pico then chmod +x to make it an easier single command way to start your server. Since I have a Raspberry Pi 4 with 4g gigs of RAM and it'll be doing just this one server, I felt 2500 megs of RAM was a sweet spot. Java ran out of memory at 3 gigs.

You can then run ifconfig at and command line and get your Pi's IP address, or type hostname to get its name. Then you can connect to your world with that name or ip.

Running Minecraft Servers

Performance Issues with Complex Worlds

With very large Minecraft worlds or worlds like my son's with 500+ Iron Golems and Chickens, you may get an error like

[Server Watchdog/FATAL]: A single server tick took 60.00 seconds (should be max 0.05)

You can workaround this in a few ways. You can gently overclock your Pi4 if it has a fan by adding this to the end of your /boot/config.txt (read articles on overclocking a Pi to be safe)


And/or you can disable the Minecraft internal watchdog for ticks by setting max-tick-time to -1 in your server's file.

We solved our issue by killing about 480+ Iron Golems with

/kill @e[type=minecraft:iron_golem]

but that's up to you. Just be aware that the Pi is fast but not thousands of moving entities in Minecraft fast. For us this works great though and is teaching my kids about the command line, editing text files, and ssh'ing into things.

Sponsor: Never miss a beat with Seq. Live application logs and health checks. Download the Windows installer or pull the Docker image now.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
September 08, 2020 0:31
Thanks for this timely post. My son, 9, is really starting to get into Minecraft and I've been interested in hosting a server for him. I was thinking of trying it on a Synology, but may try a Pi instead.
September 08, 2020 10:30
You have really good point,..all your given information is so accurate and helpful. When any academic subject stands as a breaker between your academic success for often you end up pondering over whether there's, and you think, “Now Who Can Help Me Out ?”, will answers your all assignment barriers. online assignment help
September 08, 2020 14:04
Good morning! If you do not have a proper support in writing your assignments, then you need to ask it at this fantastic online writing agency. I highly recommend it from my own cooperation with this super company for the last four years of my students life!!!
September 08, 2020 14:18
14!? It seems like you were blogging about baby sign language not that long ago...
September 08, 2020 16:08
We had a spare PC and we installed Ubuntu on it and Minecraft Server Manager. It has given my (also 14 year old) son a reason to learn the terminal to ssh into the server, use scp to copy files to the server, navigate the file system from the terminal, unzip, sudo, edit the eula file (using nano), etc. Using msm, he has been able to setup several worlds for him to play with friends and also his little brother to play with his friends. I just have to do the port forwarding on the Eero (I wish they had range port forwarding ... I have asked).
September 08, 2020 18:25
Scott, as ususal, you are one point with a blog post or pod cast. Reasonable software engineer here but honestly, my 11 yo knows 25x more about Minecraft than I do. If I follow your suggestion, does that require that everyone runs the Java version of Minecraft? I was hoping to setup a server for my daughter and 6 of her friends but they are all on PC and XBox. The Realms Plus looks OK but as you pointed out, that requires that she is active. I don't mind paying a bit to make this work. Thanks!
September 09, 2020 20:30
Andrew, Minecraft provides an official version of the Bedrock server, which is currently in alpha, but should work with both PC and Xbox game clients: Minecraft Bedrock Server (alpha release) Scott, have you tried the Bedrock server on the Raspberry Pi?
September 10, 2020 3:45
Really useful post, been trying to host a server on my pi4 for some time now and this comes really handy, thank you!
September 15, 2020 8:06
A Minecraft server on a Raspberry Pi, another fine example of the possibilities of this nanocomputer. Recently, I replaced my desktop PC by a Raspberry and set up a website analysis tool with this mini server. Good idea, I'm going to surprise my children with a local Minecraft server like yours!
September 15, 2020 13:05
Nice post!
September 17, 2020 16:01
Really cool project. Didn't think you can do it on Raspberry Pi.
October 12, 2020 11:27
Up front, I work for balena - but this is a community project, not a balena one:

(will show your gravatar icon)
Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.