If you want to create a private Minecraft world that you can share with your friends online, you need a place to host that experience. You can pay $7.99 per month for Minecraft Realms (opens in a new tab)which is easy to use but doesn’t have all the customization options or you can rent a Minecraft server from a paid hosting service like Shockbyte (opens in a new tab). Or you can set up your own Minecraft server on a Raspberry Pi and have it hosted right from your living room for free.
Note that you’ll need a Raspberry Pi 3 or 4, preferably a 4 with at least 2 GB of RAM. And all traffic on the server will be going in and out through your home internet service, so if you plan on having a ton of users all the time, it can eat up some bandwidth. But if you’re just planning to play with a few friends, creating a Raspberry Pi Minecraft server is easy, cheap, and fun.
Next, we will show you how to set up a Minecraft server on your Raspberry Pi, make sure the server starts on boot and allows connections from outside your local network. We will also explain how to login to that server from Minecraft Java Edition. Please note that we are using a standard Minecraft server and Java Edition, with no mods. However, once you’ve mastered these instructions, you can install server-side mods or different server builds.
How to set up a Raspberry Pi Minecraft server
1. Set up a Raspberry Pi if you don’t have one already. See our stories on how to set up a Raspberry Pi or how to set up a headless Raspberry Pi (if you want to control it remotely).
two. Open a terminal window on the Pi or an SSH connection to the Raspberry Pi.
3. Make sure your Raspberry Pi is up to daterunning the latest update commands.
sudo apt update
sudo apt upgrade -y
Four. Install JDK and git. The Java Development Kit (JDK) is the basis for Minecraft Java Edition. Without the JDK Minecraft would not work.
sudo apt install default-jdk
5. create a directory to store files and go into that directory. we will call our own mcserver.
mkdir mcserver
cd mcserver
6. On your PC, navigate to the Minecraft.net server download page Y copy the address from the latest jar file on the server.
7. Enter wget
wget https://piston-data.mojang.com/v1/objects/f69c284232d7c7580bd89a5a4931c3581eae1378/server.jar
8. launch the server using the following command. This will allocate 1GB of RAM to the server and then run the downloaded .jar file.
java -Xmx1024M -Xms1024M -jar server.jar
Add nogui to the end if you want to boot without an interface. You will receive an error message indicating that you must accept the EULA.
9. Open eula.txt to edit it. It is easier to use nano.
nano eula.txt
10 Change eula=false to eula=true in the file and press CTRL + X then press Y and Enter to save and exit.
eleven Start the server again.
java -Xmx1024M -Xms1024M -jar server.jar
It will take several minutes to start as it spawns a world and prepares a spawn area. You will see a percentage as you go.
Now your server should be running and you can login to it. However, if you ran the server from an SSH window, it will exit the moment you close the window (unless you put “nohup” before the load server command). And, even if you run it from a terminal window on the Pi (or via VNC), the server is not set to restart in case you need to reboot the Raspberry Pi.
Next, we’ll show you how to create a script that will start the Minecraft server every time you start the Raspberry Pi and should also restart the Minecraft server if it crashes but the Pi itself doesn’t.
How to start the Raspberry Pi Minecraft server on boot
1. Create a new file called mcstart.sh in the same folder as the server files (in our case, mcserver). You can create and open the file with nano.
nano mcstart.sh
two. Enter the following code to your bash script.
#!/bin/bash
cd ~/mcserver
while true
do
java -Xmx1024M -Xms1024M -jar server.jar
sleep 10
done
What we’re doing here is changing to the directory where the server is and then running an endless loop that starts the server and then if it ever stops, waits 10 seconds and starts it again. If the server never fails, it will never get to the “sleep 10” part of the loop.
If the path to your Minecraft server is not /mcserver on your Raspberry Pi, be sure to change that part of the script.
3. Save and exit the file by pressing CTRL + X.
Four. Set the mcstart.sh file to be executable for all users.
chmod a+x mcstart.sh
So now you can just run the mcstart command from the command line, but that won’t do you much good unless the system runs it automatically on boot.
5. Open the crontab editor.
crontab -e
If this is your first time opening crontab on this Raspberry Pi, you will be prompted to select an editor. Select nano if you have the option.
6. Enter @reboot Y the path to mcstart.sh at the bottom of the crontab file and Save it pressing CTRL + X. In our case, the line looked like this, but yours may vary depending on the path to your home directory and the name you gave your server directory.
@reboot /home/pi/mcserver/mcstart.sh
7. Reboot your raspberry pi and see if it works.
How to put the Raspberry Minecraft server on the Internet
If you installed a Minecraft server on your Raspberry Pi and set it to run every time you start, you and anyone on your local network can now log in. However, unless everyone you want to play with is at home, you’ll want that server to be available on the Internet.
1. Configure the Raspberry Pi to use a static IP Address. If you don’t know how to do this, check out our tutorial on how to make the Raspberry Pi use a static IP address. A static IP benefits you, because you want to make sure your local v4 IP number is the same even if you reboot it.
two. Set a port forwarding rule on your router which forwards port 25565 to the internal IP address of your Raspberry Pi Minecraft server. The process will differ slightly on each router. You need to go into the admin panel, find the port forwarding menu, and then create a rule.
3. Determine your public IP v4 Address. The easiest way is to navigate to whatismyipaddress.com (opens in a new tab). Googling “what’s my IP address” usually works, but sometimes you only get the v6 IP address that way.
Now you can give this address to your friends and they can use it to login to your server. However, unless you’re paying your ISP extra for a fixed IP address, you can’t count on this IP address staying the same. If you unplug your modem, temporarily lose power, or experience something that takes your home offline, you may have a different IP when you turn it back on and have to search for it again.
If you’re satisfied with giving your friends your IP address every time they want to log in, you can stop here. Otherwise, consider the next step.
Four. Use without IPa dynamic DNS service, to create a hostname which routes traffic directly to whatever your current home IP address is. The service has a free tier that you can sign up for at noip.com (opens in a new tab) The company also has instructions for installing the corresponding software on your Pi. (opens in a new tab) .
Log in to a Raspberry Pi Minecraft server
1. Start the Java edition of Minecraft on the computer you want to play from.
two. Select Multiplayer.
3. Click Add Server.
5. Enter the hostname or IP address of the server and give it a name (or leave it as “A Minecraft Server”. That name is for your benefit only. Click Done when I finish.
The server will appear in your server list.
6. Click on the icon for the server to enter.
And that should allow you to play on your local Minecraft Raspberry Pi server.