An auto-updating Minecraft server (eg. for Raspberry Pi) The code of the updater is from this repo: eclair4151/MinecraftUpdater
This is a small tutorial for setting up a Minecraft server on a Raspberry Pi with the code from this repository.
Note that if your intend is to use the server, I recommend using a Raspberry Pi 4 with at least 2GB of RAM or better.
-
Install Raspberry Pi OS (previously called raspbian), you can use the Raspberry Pi Imager for that.
-
Activate SSH on your Raspi
-
Setup a static IP-address for your Raspi. I recommend just doing so on the configuration page of your router, since it's very simple to do so. However, you can try doing it on the Pi. Look here for example.
-
Connect to your Pi via SSH (recommended) or have a keyboard and display connected to your Pi
-
Install java on your Pi:
sudo apt install default-jdk
-
Install screen on your Pi:
apt-get install screen
-
Get the code from this repository to your Pi. For example, you could paste it here:
/home/pi/minecraft-server
You could can use SSH or git for that. If you're a fan of VS Code, I recommend using the Remote Development Extension Pack. It allows you to work on your pi as you would on your local computer - via SSH -
Copy the .service and .timer files to /etc/systemd/system/ with
sudo cp auto_updater/*.{service,timer} /etc/systemd/system/
You have to be in theminecraft-server
directory to run that command. To start the server when the pi boots, enable the timer withsudo systemctl enable minecraft-server.timer
-
Restart your Pi:
sudo reboot
-
Verify that everything is working: In the syslog, you should find some outputs from the auto-updater.
sudo tail -f /var/log/syslog
You can open the full file, if there were too many new lines. Also, you can use thetop
command to verify that java is running. -
You can connect to the server in Minecraft using the static IP address of your Pi. You can access the server logs / server console with
screen -r minecraft
while connected to your Pi via SSH -
(optional) If you want to quickly access your server console in the future, I recommend using a Profile in Windows Terminal. To do so, in Windows Terminal open settings and paste this profile under the existing ones:
{
"guid": "{3ddeae53-7f92-4457-a6ca-c9eaa6e237b2}",
"name": "SSH Raspi MC",
"commandline": "ssh -t pi@123.456.7.890 \"screen -r minecraft \"",
"hidden": false
}
Don't forget to change the IP address to the one of you Pi.
- The server starts automatically when your Pi is starting
- You can manually start and stop the server using
python _start-server.py
andpython _stop-server.py
while you are in yourminecraft-server
directory
- You can do so in the java-starter.py file
- Note that Raspberry Pi OS is typically a 32-bit system. In my experience, you should not allow more RAM than 2500M
-Xms1G
defines that the server should start with 1GB of RAM-Xmx2500M
defines that the server should use ~2.5GB of RAM at max
- At the moment, you can only connect to your server while you are in the same network as your Pi. Your friends can't join from their homes. Let's change that!
- This will be amended soon