Raspberry Pi offers an affordable and easy way to set up your very own Minecraft server. With its low power consumption and versatility, it’s an excellent option for hosting a Minecraft world for you and your friends to enjoy. In this guide, we’ll show you how to turn your Raspberry Pi into a Minecraft server so you can play and create on your own custom world without the need for expensive hardware or cloud hosting.
🛠️ What You’ll Need
Before you begin, make sure you have the following components:
- Raspberry Pi 4 (with at least 2GB RAM for better performance, although 4GB or 8GB models are recommended for larger servers)
- MicroSD card (at least 16GB, but 32GB or more is recommended)
- Power supply for the Raspberry Pi
- Internet connection (Wi-Fi or Ethernet cable)
- Keyboard, mouse, and monitor (for initial setup, though you can also use SSH for headless setup)
- External storage (optional, for larger worlds or more space)
🌐 Step 1: Set Up the Raspberry Pi
The first step is to set up your Raspberry Pi with Raspberry Pi OS, as it provides a stable base for the Minecraft server. Here’s how to get started:
- Download Raspberry Pi OS from the official Raspberry Pi website.
- Use an image-writing tool like balenaEtcher to write the Raspberry Pi OS image to your microSD card.
- Insert the microSD card into your Raspberry Pi, and boot it up. Follow the on-screen instructions to set up the system, including connecting to Wi-Fi (or Ethernet).
- Once the OS is set up, update the system by running the following commands in the terminal:
sudo apt update && sudo apt upgrade
🔧 Step 2: Install Java
Minecraft requires Java to run, so you need to install the appropriate version for your Raspberry Pi. To install Java, follow these steps:
- Open the terminal on your Raspberry Pi.
- Run the following command to install OpenJDK 11, which is compatible with Minecraft:
sudo apt install openjdk-11-jdk
- Verify the installation by checking the Java version:
java -version
- If you see the version of Java, the installation was successful.
🎮 Step 3: Download Minecraft Server Files
Next, you need to download the official Minecraft server files to run on your Raspberry Pi. Follow these steps:
- Navigate to the official Minecraft server download page: Minecraft Server Download.
- Right-click on the “Minecraft server .jar” file and copy the link address.
- In your terminal on the Raspberry Pi, use the following command to download the server file:
wget [server-link]
- Once the download is complete, create a directory for the Minecraft server by running:
mkdir minecraft_server && cd minecraft_server
🖥️ Step 4: Configure the Minecraft Server
After downloading the Minecraft server, you’ll need to configure it to run smoothly on your Raspberry Pi. To do this:
- Create a
start.sh
script to run the server by typing:
nano start.sh
- Paste the following command to start the server with optimal memory settings:
#!/bin/bash
java -Xms512M -Xmx1024M -jar minecraft_server.jar nogui - Save the file (press Ctrl + X, then Y to confirm) and make it executable by running:
chmod +x start.sh
- Next, you’ll need to accept the Minecraft EULA. Open the
eula.txt
file:
nano eula.txt
- Change
eula=false
toeula=true
to accept the End User License Agreement. - Save the file and exit the editor.
🚀 Step 5: Start the Server
Now that everything is set up, it’s time to start the Minecraft server. In the terminal, run the following command to start the server:
- Execute:
./start.sh
- The server will begin to load. It may take a few minutes, depending on the Raspberry Pi’s model and specifications.
Once the server is running, you can join it by launching Minecraft on your PC or mobile device and entering your Raspberry Pi’s IP address.
🔧 Step 6: Optimize the Minecraft Server (Optional)
For better performance, you may want to tweak the server’s settings. Here are a few optimizations:
- Reduce the world size by adjusting
view-distance
in theserver.properties
file. - Limit the number of players connected at once in the
max-players
setting in theserver.properties
file. - Adjust the
ram
usage by modifying the-Xms
and-Xmx
parameters in thestart.sh
script. - Disable unused features such as “mob-spawning” or “entity-collision” to reduce server load.
🌍 Step 7: Remote Access to Your Minecraft Server
If you want to allow friends to join your Minecraft server remotely, you’ll need to set up port forwarding on your router. Forward port 25565 (the default Minecraft port) to your Raspberry Pi’s IP address.
You can also use a dynamic DNS (DDNS) service to give your server a domain name that can be accessed from anywhere.