Want to host a Minecraft server for up to 10 players? Want to host the server 24/7 without leaving your PC on? Using a Raspberry Pi to host a small Minecraft server is perfect. The power consumption of a Raspberry Pi is tiny and the performance it can provide will be good for up to 10 friends.
- Raspberry Pi 3B/3B+ recommended
- 8GB MicroSD Card (64GB MicroSD Card recommended – Minecraft server world files can grow rapidly!)
- Ethernet Cable (preferred to WiFi, but WiFi will work too)
If you are using a Raspberry Pi 3 or lower, we recommend that you overclock your Pi in order to grab some extra performance that will be massively beneficial to the way your Minecraft server performs. If you wish to do so, please see our Raspberry Pi 3 Overclocking Guide. We strongly recommend applying the overclock for web servers which sets the GPU memory to 16MB.
You’ll want to use a headless Linux distribution such as Raspbian Stretch Lite. It’s important not to install the graphical version as this will use unnecessary resources. Follow our Headless Raspberry Pi Setup Guide. If you plan to use an Ethernet cable directly to your router to provide internet connectivity as recommended, you can skip the WiFi setup part of the headless guide.
Downloading the Minecraft Server
We will start by updating and upgrading the Raspberry Pi by running the following commands:
sudo apt update && sudo apt install upgrade
If you intend to connect to your Raspberry Pi via SSH, you’ll need to install Screen in order for the Java process for the Minecraft server to continue running when you exit your SSH session.
sudo apt install screen
The next stage is to install the server into a dedicated directory. Make a directory called “minecraft” and use the change directory command to open it:
sudo mkdir /home/minecraft cd /home/minecraft
You’re now ready to download the builder tool from spigotmc.org.
sudo wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
The Spigot server is written in Java. The latest versions of Raspbian Lite have Java built-in. The following command will take around 20 minutes to complete:
sudo java -jar BuildTools.jar
Building the Minecraft Server
After around 20 minutes, the Minecraft server should have been built. It’s time to launch the server. First, use the ls command to find the correct name of the latest spigot.jar file.
This should display a filename similar to spigot-[version].jar. At the time of writing, this was spigot-1.14.1.jar. Launch the server with the following command, making sure you enter the correct version number.
sudo java -Xms512M -Xmx1008M -jar /home/minecraft/spigot-[version].jar nogui
Wait for the server to stop. Open the EULA.
sudo nano eula.txt
Confirm you accept the EULA by changing False to True, then press Ctrl > X to exit and save.
If you’re using SSH, start a screen session.
Next, relaunch the server:
sudo java -Xms512M -Xmx1008M -jar /home/minecraft/spigot-[version].jar nogui
This time, things will take a bit longer as the map is built. We’re talking 3-5 minutes or so, but this is a one-time only delay. Once the map is created, subsequent restarts will only take half a minute or so.
You can exit the screen by pressing Ctrl > A > D.
To resume the screen session to access the console again type:
There should be one attached screen, for example:
3876.pts-0.minecraftpi (28/05/19 17:12:53) (Detached)
In my case, 3876 is the screen session ID. Run the below command:
screen -r 3876 (REPLACE 3876 WITH YOUR SCREEN SESSION ID)
Opening Ports on your Router
You will need to open ports on your router in order for friends outside of your home network to be able to connect to your Minecraft Server. If you will only be playing with people inside your home network, you can skip this step.
This step is largely dependant on your brand of router/internet service provider. We advise you to look up specific instructions online based on your router model/ISP.
Ensure that port 25565 is open both inbound and outbound for your Raspberry Pi’s private IP. If you don’t know your Pi’s IP, you can find it by typing the below on your Pi:
You should get an output similar to this:
pi@minecraftpi:~ $ ifconfig enxb827eb759b13: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether b8:27:eb:75:9b:13 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.80 netmask 255.255.255.0 broadcast 192.168.0.255 inet6 2a02:c7f:83c:9d00:fae:ca56:7482:3ad4 prefixlen 64 scopeid 0x0<global> inet6 fe80::5bc9:f9f:56e9:da6f prefixlen 64 scopeid 0x20<link> inet6 fdf7:9631:2320:0:15ab:5859:12c2:d5b6 prefixlen 64 scopeid 0x0<global> ether b8:27:eb:20:ce:46 txqueuelen 1000 (Ethernet) RX packets 23995 bytes 5033254 (4.8 MiB) RX errors 0 dropped 2997 overruns 0 frame 0 TX packets 4963 bytes 831365 (811.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Although we’re using WiFi through wlan0 for this demo, it should be clear that our private IP is 192.168.0.80.
Test the Connection to your Server
Now try to connect to your server locally – inside your network. On Minecraft, Direct Connect to the IP “127.0.0.1:25565”. This is your localhost IP.
If that was successful. Find your IP here. Add :25565 to the end of your IP and share it with a friend. Ask them to test the connection from outside of your network. If you have set up your port forwarding correctly and your Minecraft Server is running, there should be no issues.
Configure your Minecraft Server for Higher Performance
Once you know the server is setup correctly and on your network, it’s time to configure it. Begin by editing the server properties. This is a text file that can be accessed with the nano text editor:
sudo nano /home/minecraft/server.properties
Various changes are recommended. Whatever you change here, keep in mind that the Pi is a modest device that cannot handle too much processing.
A list of server properties can be found in the Minecraft wiki, but those you should edit straight away are:
You may be good to play with up to 10 players, especially if you have a good overclock with cooling applied, but 5 should be the sweet spot for best performance.
Several other options are available to configure that you might be interested in, such as:
pvp = true
This is for player vs. player action. There’s also a difficulty setting:
difficulty = [integer 0-3]
Here, the easiest setting is 0.
Finally, we strongly recommend installing a plugin called NoSpawnChunks, which is designed to prevent too much RAM being used up by the Minecraft server without affecting performance and gameplay. First, open the /plugins subdirectory:
Next, download the NoSpawnChunks.jar Java object.
sudo wget -O NoSpawnChunks.jar http://ci.dmulloy2.net/job/NoSpawnChunks/
This will help to keep RAM usage low, ensuring the server doesn’t run slow.
Make your Minecraft Server Launch at Boot
If you’re using the Pi as a dedicated Minecraft server, you’ll probably want to have the server running at all times. While there’s bound to be some minor downtime, a startup script will ensure the server can start itself automatically in the event of a restart, power cut or crash/freeze.
Start by creating a startup script:
sudo nano /home/startminecraft.sh
You can call it whatever you like — choose something meaningful though.
Copy the following into your startminecraft.sh file:
#!/bin/bash cd /home/minecraft sudo java -Xms512M -Xmx1008M -jar /home/minecraft/spigot-[version].jar nogui &
You could stop here and just use the startminecraft.sh file to launch the software, after giving it executable permissions:
sudo chmod +x startminecraft.sh
Then, run it with:
However, if you prefer to have the script run at boot, find the rc.local file, and edit it:
sudo nano /etc/rc.local
At the end, before the exit 0 line, add:
Again, use Ctrl > X to exit and save the file.