Setting Up a Minecraft Server on Raspberry Pi

  • General Steps: Install the runtime environment –> Install the server panel –> Upload the server files –> Configure –> Start the server

Preparation Materials

Raspberry Pi 4B board
Heat sink (passive cooling is recommended)
Raspberry Pi power supply (Type-C is fine, official recommended)
Ethernet cable (wired connection is recommended, as wireless networks are unstable for hosting)
Card reader
High-speed storage card (32GB or more)
A computer
Software:
Xshell
Win32 Disk Imager
Raspberry Pi official system image

Installing the Server Panel

Installing Java Environment

Update System Sources

1
sudo apt-get update

Install JRE

Official System

The latest official system already includes the Java environment; it is recommended to re-flash the system.

Use the following command to install the Java environment:

1
sudo apt-get install default-jre

Verify Installation

Use the following command:

1
java --version

If you see the version of Java instead of “command not found,” the installation was successful.

Install the Panel

It is recommended to use MCSM.

Install Node.js

1
2
3
4
5
6
7
8
9
10
11
12
13
wget https://nodejs.org/dist/v16.13.2/node-v16.13.2-linux-armv7l.tar.xz # Download Node.js installation package

tar -xvf node-v16.13.2-linux-armv7l.tar.xz # (Extract)

sudo cp -r /home/pi/node-v16.13.2-linux-armv7l /opt/

sudo ln -s /opt/node-v16.13.2-linux-armv7l/bin/node /usr/bin/node # (Create symlink)

sudo ln -s /opt/node-v16.13.2-linux-armv7l/bin/npm /usr/bin/npm # (Create symlink)

sudo ln -s /opt/node-v16.13.2-linux-armv7l/bin/node /usr/local/bin/node # (Create symlink)

sudo ln -s /opt/node-v16.13.2-linux-armv7l/bin/npm /usr/local/bin/npm # (Create symlink)

Restart Raspberry Pi

After restarting, use node -v and npm -v to check if Node.js is installed successfully.

Main Panel Installation, Startup, and Login

1
2
3
cd /opt/

sudo git clone https://github.com/MCSManager/MCSManager.git # (Clone repository)
  • Currently, MCSM has been updated to version 9.x, which does not support Raspberry Pi. Use the following command for installation:
1
2
3
4
5
6
7
git clone -b v8.7.0 https://github.com/MCSManager/MCSManager.git

cd MCSManager/ # (Enter directory)

sudo npm install # (Install dependencies)

sudo npm start # (Start the panel)

Open your browser (Google Chrome is recommended) and enter http://your_fixed_IP_of_Raspberry_Pi:23333 in the address bar to access the panel.

  • Default Username: master
  • Default Password: 123456
  1. After logging in, click “Server Management” –> “Create New Instance” –> “Bootstrap Creation.”
  2. You can modify the instance name; the project location can be left as default. Click “Next.”
  3. When you see the “Upload Server” text, click the “Select Upload File” button to upload your server files (Spigot, Bukkit, Bungeecord, Paper, etc.).
  4. After uploading, click “Next.”
  5. When you see “Creating,” you can leave the memory parameters and other settings as default for beginners (especially memory settings); you can look up parameters you are interested in.
  6. After completing, click “Confirm and Create.” You will return to the “Server Management” interface.
  7. Click on the server instance you just created, then click on the Server.Properties file under Configuration to make the necessary changes, and click “Update Configuration” when done.
  8. Click on “Start Server” on the left, and wait a moment.
  9. Open Minecraft, click on Multiplayer, click “Add Server,” and enter your_fixed_IP_of_Raspberry_Pi:25565 to join the game.
  10. The MCSManager server management panel has a command console, which serves as the command input for the server. You can input server commands here.

Installing Intranet Penetration

If your server has a public IP, you can skip this step.

Install Ngrok

1
2
3
4
5
6
7
8
9
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm64.tgz

tar -xvf ngrok-stable-linux-arm64.tgz

sudo cp /home/pi/ngrok /opt/

sudo ln -s /opt/ngrok /usr/local/bin/ngrok # (Create symlink)

sudo ln -s /opt/ngrok /usr/bin/ngrok # (Create symlink)

Open https://ngrok.com/, click “Sign Up” in the top right corner, and register using your email.

After registering and logging in, open https://dashboard.ngrok.com/login.

You will see “Connect Your Account” under the second step with “ngrok authtoken your_token.” Copy it.

In the terminal, enter sudo ngrok authtoken your_token.

Your account will be logged in.

In the terminal, enter ngrok tcp 25565.

Find the “Forwarding” section; to the right, you will see tcp://?.tcp.ngrok.io:? -> localhost:25565 (the numbers next to the ? are random).

tcp://?.tcp.ngrok.io:? is your public address.

Send tcp://?.tcp.ngrok.io:? to your friends!

In the future, when starting the server, run:

1
2
cd /opt/MCSManager/
sudo npm start

In the terminal, create a new link:

1
ngrok tcp 25565

Then you can happily play Minecraft with your friends using Raspberry Pi!

Note:

Ngrok and the MCSManager panel must be running simultaneously; you can copy the tab in Xshell by right-clicking.

The Ngrok domain changes every time; you need to send it to your friends every time you start the server.

Both Ngrok and the MCSManager panel can be exited by pressing Ctrl+C.

If an error appears while running Ngrok, stating that it cannot execute the binary file,

you will need to switch to a 64-bit kernel.

1
sudo nano /boot/config.txt

Add the following line at the end of the file:

1
arm_64bit=1

Press Ctrl+X, then press Y to save and exit, and restart Raspberry Pi:

1
sudo reboot