Introduction: Raspberry Pi 5 Minecraft Server

In order to play Minecraft with physically-distant others, without requiring that you pay a monthly fee beyond what you are already paying for internet, you may want to create a Minecraft server which hosts your game. This can be accomplished using a Raspberry Pi 5.

Supplies

Raspberry Pi 5 - 16GB RAM

https://www.adafruit.com/product/6125

Raspberry Pi 27W USB-C power supply

https://www.adafruit.com/product/5814

Raspberry Pi 5 active cooler

https://www.adafruit.com/product/5815

Raspberry Pi 5 case

https://www.adafruit.com/product/5816

Micro HDMI to HDMI cable

https://www.adafruit.com/product/1322

512GB microSD card

https://www.amazon.com/dp/B0CF7QBT92

Ethernet cable

USB keyboard

USB mouse

USB microSD card reader

Personal computer

Router and ISP (internet service provider) that allow port forwarding

HDMI-compatible monitor

Step 1: Physically Assemble the Raspberry Pi

The active cooler for the Raspberry Pi takes up the space used by the cooling fan and translucent piece in the official plastic case, so you'll have to remove it. Beyond that, the physical assembly steps are simple -- peel the protective paper off of the active cooler, and snap it into the holes in the Raspberry Pi PCB. Plug the cooling fan on the active cooler into the port on the Raspberry Pi (mine had a little plastic protector on that port that required removal before the cooling fan could be attached), put the Raspberry Pi and active cooler into the case, and snap the case closed. Attach the little rubber feet to the bottom of the case.

Step 2: Flash the Raspberry Pi OS Image to the MicroSD Card

Download the Raspberry Pi Imager from

https://www.raspberrypi.com/software/

and insert the microSD card into the USB microSD card reader; put this assembly into one of your computer's USB ports. Run the imager, selecting "Raspberry Pi 5" for the model and "Raspberry Pi OS (64-bit)" for the desired operating system. Select the microSD card as the memory device the OS will be burned to, press next, and confirm that the card will be wiped. After the Raspberry Pi Imager confirms that your microSD card can be removed from the system, remove the card, and insert the card into the Raspberry Pi.

Step 3: Boot the Raspberry Pi

Plug the microHDMI-to-HDMI cable into the Raspberry Pi and an HDMI-compatible monitor. Plug in a USB-compatible mouse and keyboard. Attach the power supply to the Raspberry Pi and plug it into an outlet. The Raspberry Pi should boot, as any other computer. (If this does not occur, try pressing the power button on the Raspberry Pi case. If that doesn't work, check the cable connections to ensure the Raspberry Pi is connected to the monitor and receiving power.)

Note also that many monitors intended for use as televisions have overscan enabled, which slightly zooms in the picture and cuts off the edges of the screen. This can be changed in your television or monitor's settings menu. Yes, it's in a different place in the settings for every manufacturer. Why wouldn't it be?

The Raspberry Pi OS will now instruct you to set your region, language, and timezone, select your default browser, and connect to an available WiFi network. You can avoid WiFi entirely if you want to use a direct ethernet connection the entire time, but in my case it was easier to use WiFi for the preliminary setup adventures.

Step 4: Setting Up the Minecraft Server, Part 1

The majority of these instructions are a straightforward replica of "Raspberry Pi as Minecraft Server"

https://linuxconfig.org/raspberry-pi-as-minecraft-server

from LinuxConfig.org. However, there were some minor changes required to get those instructions to work, which is why I am writing these down for your benefit, dear reader, in the hope of sparing you any frustration.

Open the console (it's shown by a little window with >_ in it on the top toolbar).

Type

sudo apt update

and press enter

then type

sudo apt upgrade

and press enter.

These commands pull the most up-to-date versions of all of the Raspberry Pi OS system components and install them.

Step 5: Setting Up the Minecraft Server, Part 2

The instructions on LinuxConfig.org say the next command to enter is

sudo apt install wget screen openjdk-17-jdk nmap

but if you do this you will get the error "Unable to locate package openjdk-17-jdk". This error breaks installation of *all* of the requested packages, as the "screen" command doesn't work either. So after some noodling around I found a -different- set of installation instructions on the Raspberry Pi support forum at

https://forums.raspberrypi.com/viewtopic.php?t=368195

that said I needed to run the command

sudo apt install default-jre-headless

prior to attempting the install of openjdk-17-jdk.


Step 6: Setting Up the Minecraft Server, Part 3

I would like to mention, dear reader, that I'm not sure exactly which of these steps are truly required, but as this process ultimately resulted in having a working Minecraft server, I am documenting the entire process I followed in the hope that it might spare you some hassle. Needless to say, at this point attempting to install openjdk-17-jdk still did not work. So I found yet another set of instructions, these ones from raspberrypitips.com

https://raspberrytips.com/minecraft-server-raspberry-pi/

which mentioned the use of an open-source version of the Java 21 runtime -- not the Java 17 runtime. Searching the dusty limits at the fringes of my memory, I vaguely recalled that to the best of my knowledge Java versions are backwards-compatible (e.g. Java 21 will run anything written for Java 17). In this process I also ran across the "default-jdk" install command, which I executed:

sudo apt install default-jdk

After that, I was able to modify the previous command that kept failing and execute it as:

sudo apt install wget screen openjdk-21-jdk nmap

This finally worked.

Step 7: Setting Up the Minecraft Server, Part 4

Now I was back to following the instructions at LinuxConfig.org

https://linuxconfig.org/raspberry-pi-as-minecraft-server

by executing the commands

sudo useradd -m -r -d /opt/minecraft minecraft

and defining a password with

sudo passwd minecraft

then creating a folder for the Minecraft server using

sudo mkdir /opt/minecraft/myserver

Which worked properly.

Step 8: Setting Up the Minecraft Server, Part 5

I was finally ready to actually download the Minecraft server itself from

https://www.minecraft.net/en-us/download/server

which is accomplished using the command

sudo wget -O /opt/minecraft/myserver/minecraft_server.jar https://piston-data.mojang.com/v1/objects/64bb6d763bed0a9f1d632ec347938594144943ed/server.jar

which you will note is only up-to-date as of 2026-01-14; you will need to go to the website and copy the new link for an updated version, replacing the "https://piston-data.mojang..." part of the command listed above if you want a more modern server than the one I installed.

Step 9: Setting Up the Minecraft Server, Part 6

Next you must agree to the Minecraft server EULA with the command

sudo bash -c "echo eula=true > /opt/minecraft/myserver/eula.txt"

and then give the minecraft account (the one we just made on the Raspberry Pi) ownership of the server using

sudo chown -R minecraft /opt/minecraft/myserver/

which I found no problems executing.

Step 10: Setting Up the Minecraft Server, Part 7

Now we need to make a file that commands the Minecraft server to turn on automatically. This is done with the command

sudo nano /etc/systemd/system/minecraft@.service

which creates and opens the described file with the "nano" text editor. Into this file we paste the following content:

[Unit]
Description=Minecraft Server: %i
After=network.target

[Service]
WorkingDirectory=/opt/minecraft/%i

User=minecraft
Group=minecraft

Restart=always

ExecStart=/usr/bin/screen -DmS mc-%i /usr/bin/java -Xmx14G -jar minecraft_server.jar nogui

ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "say SERVER SHUTTING DOWN IN 5 SECONDS. SAVING ALL MAPS..."\015'
ExecStop=/bin/sleep 5
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "save-all"\015'
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "stop"\015'


[Install]
WantedBy=multi-user.target

Note that this is almost identical to the instructions found at LinuxConfig.org

https://linuxconfig.org/raspberry-pi-as-minecraft-server

with one key change: -Xmx2G has been replaced with -Xmx14G -- this tells the server it can use up to 14GB of RAM instead of just 2GB. This is because the Raspberry Pi 5 16GB has 16GB of RAM and the task manager says that 1.5 GB of RAM was being used when I checked (Yes, with some Firefox tabs open. Yes, you could probably squeeze a bit more headroom out. I'm being conservative when setting these limits.). Key point is, if you're using a Raspberry Pi 5 with less than 16GB of memory, you'll need to change that number so the server won't try to use more memory than the Raspberry Pi 5 has. I'm not sure exactly what happens if that occurs, but I can't imagine it would be good for your system stability.

The instructions linked above used nano as the text editor for this, so I did so as well. Right-click > paste works to insert the text. Ctrl-o then [enter] saves, Ctrl-x closes nano.

Step 11: Setting Up the Minecraft Server, Part 8

You should now be able to manually start the Minecraft server using the command

sudo systemctl start minecraft@myserver

and verify that it is running with

sudo systemctl status minecraft@myserver

Do note that the status display occupies the terminal window you use, such that closing and reopening the window is the easiest way to proceed with the commands given in following steps.

Step 12: Setting Up the Minecraft Server, Part 9

You will almost certainly want the Minecraft server to auto-start. Otherwise, you'll have to manually restart it if you experience a brief power outage. This is accomplished with the command

sudo systemctl enable minecraft@myserver

next, verify that the server is receptive to incoming connections using the command

nmap -p 25565 localhost

which should show

PORT:25565/tcp

STATE:open

Step 13: Physically Configuring the Server

At this point, your new Minecraft server can live in its "forever home", such as on the shelf next to the router with a nice, hardwired ethernet connection.

Step 14: IP Adventures, Part 1

Now you're ready to start figuring out your IP address. The command

ip a

will (kind of) show your Raspberry Pi 5's IP address. NOT IN A PUBLIC SENSE, HOWEVER! More on that later. At this point you should be able to open Minecraft on a different computer connected to your local network and log into your server by entering the IP address given from the "ip a" command, in my case 192.168.1.139:25565 for local WiFi and 192.168.1.138:25565 for local ethernet, depending on which way the Raspberry Pi 5 is currently connected (the :25565 specifies the port that the Minecraft server is associated with). THIS WILL NOT WORK FOR USERS OUTSIDE YOUR NETWORK!

Step 15: IP Adventures, Part 2

This is the part where you get to figure out port forwarding on your router! Note that not all ISPs allow port forwarding.

On my router, ports may be forwarded in the NAT Forwarding > Port Forwarding menu, in which one may click "+ Add" and define a new port to be forwarded. To get this to work, you'll need to forward external port 25565 to internal port 25565. Your router should list your actual IP address as well.


Step 16: Logging in for Real This Time

For testing purposes, you may want to connect the computer you have Minecraft installed on to a different network, such as your phone's mobile hotspot. This will allow you to determine if outside connections to your server are actually working.

Within the "Add Server" menu in Minecraft, enter [YOUR ACTUAL IP ADDRESS]:25565

You should be able to log in.

Step 17: Becoming OP

To become an operator on your server, so that you can change the game mode, difficulty, and execute commands, add yourself to the ops.json file on the Raspberry Pi as shown. There's a tool available to get your UUID on the Minecraft wiki here:

https://minecraft.wiki/w/UUID

Note that you'll use the "UUID", and not the "Offline UUID", to give yourself operator permissions.

Enjoy your server!