Building a Minecraft Server on an Idle Raspberry Pi
A walkthrough of setting up a Raspberry Pi Minecraft server from scratch and exposing it to the internet using FRP port forwarding.
Hardware Prerequisites
One idle Raspberry Pi, and one VPS server with a public IP address.
Setting Up the Raspberry Pi
Flash the Raspberry Pi OS image, set up your username and password, then power it on.
Assign a Static IP to the Raspberry Pi
Open your router's settings panel and find the DHCP static IP allocation section. Assign a fixed IP to your Raspberry Pi. If you've forgotten the current IP, you can check it with:
$ hostname -I # Example output: 192.168.2.102Enable VNC Remote Desktop
Log in via SSH and open the configuration panel:
$ sudo raspi-config- Select Interface Options
- Select VNC
- When asked Would you like the VNC Server to be enabled?, select YES
Open a VNC client on your computer and log in with your username and password to access the virtual desktop.
Install Java
$ sudo -i # Temporarily gain admin privileges
$ cd /usr/localOpen the Raspberry Pi browser and download the JDK. The file will be in /home/<your-username>/Downloads/.
$ mkdir java
$ mv /home/<your-username>/Downloads/* /usr/local/java/
$ cd java
$ tar -zxvf jdk-21_linux-aarch64_bin.tar.gz
# Some log output will appearConfigure environment variables:
$ nano /etc/profileAdd the following at the end of the file:
# Adjust the JDK version number as needed
export JAVA_HOME=/usr/local/java/jdk-21.0.8
export CLASSPATH=.:$JAVA_HOME/lib/
export PATH=.:$JAVA_HOME/bin:$PATH
# To exit: Ctrl+O, Enter, Ctrl+XReload the file:
$ source /etc/profileVerify the installation:
$ java -version
# Success looks like this:
java version "21.0.8" 2025-07-15 LTS
Java(TM) SE Runtime Environment (build 21.0.8+12-LTS-250)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.8+12-LTS-250, mixed mode, sharing)Download the Minecraft Server Jar
Open the browser and download the server jar. I'm using the Fabric server loader.
$ cd .. # Should return to /usr/local/
$ mkdir minecraft
$ mv /home/<your-username>/Downloads/* /usr/local/minecraftThe first run will fail because you haven't agreed to the EULA yet:
# My Pi has 8 GB RAM, so I'm allocating 4 GB here
# Note: the jar name will differ depending on the version you downloaded
$ java -Xmx4G -jar fabric-server-mc.1.21.1-loader.0.17.0-launcher.1.1.0.jarAccept the EULA:
$ nano eula.txt # Change eula=false to eula=true
$ # To exit: Ctrl+O, Enter, Ctrl+XConfigure FRP
The Raspberry Pi uses the ARM architecture. Download frp — the latest version at the time of writing is 0.63.0.
$ cd .. # Should be in /usr/local/java
$ wget https://github.com/fatedier/frp/releases/download/v0.63.0/frp_0.63.0_linux_arm64.tar.gz
# Some log output will appear
$ tar -zxvf frp_0.63.0_linux_arm64.tar.gz
# Some log output will appear
$ mv frp_0.63.0_linux_arm64 frp # Rename for convenienceEdit the configuration:
$ cd frp
$ nano frpc.toml # 'c' in frpc stands for clientEdit frpc.toml:
serverAddr = "Your VPS public IP"
serverPort = 7000 # Default value
auth.method = "token"
auth.token = "set a password here"
[[proxies]]
name = "choose a service name"
type = "tcp"
localIP = "192.168.2.102" # Raspberry Pi IP
localPort = 25565 # MC server default port
remotePort = 25565 # MC server default port
## To exit: Ctrl+O, Enter, Ctrl+XInstall tmux
This guide uses tmux for session management. You could also use screen, but I prefer tmux.
$ apt install tmuxSetting Up the VPS
Log in via SSH using the root credentials from your provider's welcome email.
Configure FRP
Install frp on the VPS:
$ cd /usr/local
$ wget https://github.com/fatedier/frp/releases/download/v0.63.0/frp_0.63.0_linux_amd64.tar.gz
$ # Some log output will appear
$ tar -zxvf frp_0.63.0_linux_amd64.tar.gz
$ # Some log output will appear
$ mv frp_0.63.0_linux_amd64 frp # Rename for convenienceEdit the configuration:
$ cd frp
$ nano frps.toml # 's' in frps stands for serverEdit frps.toml:
bindPort = 7000
auth.method = "token"
auth.token = "same password as on the Raspberry Pi"
[webServer] # Optional dashboard — remove if not needed
addr = "127.0.0.1" # Not exposed publicly; access via SSH tunnel. Use "0.0.0.0" to expose publicly
port = 7500
user = "?"
password = "********"Run FRP in the Background
Same process as on the Raspberry Pi:
$ apt install tmuxOpen the required ports:
$ ufw allow 7000/tcp
$ ufw allow 25565/tcpStart frp in a tmux session:
$ tmux new -s <service-name>
$ cd /usr/local/frp
$ ./frps -c frps.toml
# Press Ctrl+B then D to detachRe-attach to the session later:
$ tmux attach -t <service-name>Verify everything is running:
$ tmux ls
# frp: 1 windows (created <timestamp>)
$ ss -tlnp | grep 7000
# Output here means frp is workingStarting the Server on the Raspberry Pi
Write a Start Script
$ cd /usr/local/minecraft
$ nano start.shSet the contents of start.sh to:
#!/bin/bash
java -Xmx4G -jar fabric-server-mc.1.21.1-loader.0.17.0-launcher.1.1.0.jar noguiMake it executable:
$ chmod +x start.shRun FRP and the Server
Run FRP
$ tmux new -s frp
$ cd /usr/local/frp
$ ./frpc -c frpc.toml
# Press Ctrl+B then D to detachRun the Server
$ tmux new -s mcserver
$ cd /usr/local/minecraft
$ ./start.sh
# Press Ctrl+B then D to detachVerify both are running:
$ tmux ls
# frp: 1 windows (created <timestamp>)
# mcserver: 1 windows (created <timestamp>)(Optional) Configure a Domain Name
At this point you can already connect to the game using your VPS's public IP:
?.?.?.?:25565 # VPS public IPIf you have your own domain, log in to the Cloudflare dashboard and add a DNS record:
| Type | A |
| Name (required) | rasp |
| IPv4 address (required) | <VPS public IP> |
| Proxy status | DNS only |
Then you can connect using your domain:
rasp.<your-domain>:25565贡献者
最近更新
Involution Hell© 2026 byCommunityunderCC BY-NC-SA 4.0