/RaspberryPiMinecraft

Configuration files and performance testing scripts to setup and optimize a dedicated Minecraft (PC Java version) server

Primary LanguageShell

This script will automatically download and configure the Paper Minecraft 1.16.1 server on your Raspberry Pi!
For the full article and guide visit https://www.jamesachambers.com/raspberry-pi-minecraft-server-script-with-startup-service-1-13/

Installation Instructions

To get started type:
wget https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/SetupMinecraft.sh
chmod +x SetupMinecraft.sh
./SetupMinecraft.sh

Getting Help

To get help you may open an issue here or visit my web site at https://jamesachambers.com/raspberry-pi-minecraft-server-script-with-startup-service/ which contains lots of comments from myself and users helping each other out!

Check Java Version

Sometimes if you have multiple versions of Java installed the wrong version of Java will be selected as the default. If the server didn't start check that the right version of Java is selected with this command:

If you get the message "update-alternatives: error: no alternatives for java" then you only have one version of Java installed and can skip to the next section.

If you are presented with a list of choices then your machine has multiple versions of Java installed. It will look like this:

update-alternatives: warning: /etc/alternatives/java has been changed (manually or by a script); switching to manual updates only
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1101      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1101      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

You will usually want to just select the newest version of OpenJDK that is listed so you would type 0 and press enter. In some cases on some platforms you may want to switch to the official Oracle JDK although I strongly recommend sticking with OpenJDK!

Tested Distributions

  • Raspbian / Raspian Lite Buster/Stretch
  • Ubuntu / Ubuntu Server 20.04 / 18.04
  • Debian 9 Buster
  • Armbian 9 Stretch
  • Arch Linux
  • TinkerOS Stretch

Update History

July 4th 2020

  • Update to 1.16.1

January 25th 2020

  • Update to 1.15.2

December 28th 2019

  • Backup system now takes a backup of your entire server folder (minus logs and cache) instead of just the world folders. This mean it now backs up things like server.properties and other worlds if you are running a multiverse setup.

December 20th 2019

  • Updated to version 1.15.1
  • Added more information to script installation warnings to help with initial configuration
  • Added warning to 2700MB limit on 32 bit operating systems explaining that you can lift the 3 GB limit by using a 64 bit Pi distribution
  • Cleaned up Java installation in setup script

August 26th 2019

  • Fixed a silly bug causing recommended memory to be stuck at 2700

August 25th 2019

  • Improved server startup detection after running SetupMinecraft
  • Added terminal colors to improve visibility
  • Cleaned up script substantially by breaking out duplicate code to functions
  • Fixed issue where when reconfiguring an existing server you would not be prompted to configure daily reboots
  • Removed /boot/config.txt tweaks as they are no longer compatible with Pi 4

August 24th 2019

  • To prevent startup failure on 32bit ARM the maximum memory for the Minecraft server is capped at 2700MB. This is a per process limitation of 32 bit on ARM and Linux. This restriction can be lifted by using a 64 bit operating system.

July 19th 2019

  • Updated development version to 1.14.4
  • Added OpenJDK 13 support

July 2nd 2019

  • Removed bc dependency to improve portability

June 30th 2019

  • Raspberry Pi 4 support (all memory sizes)
  • Updated development version to 1.14.3
  • Fixed issue that could cause 1.13.2 servers to crash when going to the Nether

June 1st 2019

  • Added option to select stable or development version
  • Current stable version of the Paper Minecraft server is 1.13.2
  • If you want to install 1.14.2 you may select to do so during installation
  • Be aware that 1.14.2 continues to have severe performance issues for the entire Minecraft server/hosting community. After playing on it myself and talking to the Paper developers I can personally state that performance on 1.14.2 is really bad right now and highly recommend sticking with the stable version.

May 31st 2019

  • OpenJDK 12 and OpenJDK 10 package checks added into the script
  • Script will attempt to install OpenJDK 10 from package on Raspbian if it isn't in apt
  • Added many paper.yml, bukkit.yml and spigot.yml changes to server config files to help with the ongoing lag affecting all Minecraft servers in 1.14
  • To configure them open start.sh in nano after running SetupMinecraft and you will see the different options and what they do
  • Updated Java certificates installer link
  • Fixed bug where changing GPU memory wasn't being applied

May 30th 2019

  • Updated to 1.14.2

May 19th 2019

  • Updated to 1.14.1

April 18th 2019

  • Changed StopChecks++ to StopChecks=$((StopChecks+1)) to improve portability (thanks Jason B.)
  • Added TimeoutStartSec=600 to server to prevent it being killed if taking longer than usual to download paperclip

March 31st 2019

  • Added x86_64 support

March 9th 2019

  • Changed Paper download URL to use API (Issue #7 Fix)
  • Added \n to beginning of printf to config.txt to prevent adding our line to the end of another config line

March 7th 2019

  • Added support for OpenJDK 8 to improve portability
  • Added Armbian support
  • Tinkerboard platform now supported. Other Armbian capable boards should also work
  • Added ca
  • certificates
  • java OpenJDK 11 fix for a broken package on some platforms
  • Added checks for paper.yml and world backup folders before attempting to back up
  • Fixed portability issue with route vs /sbin/route

March 4th 2019

  • Shared GPU memory reduction and MicroSD overclock now supported on distros that use /boot/firmware/config.txt such as Ubuntu Server and Debian
  • Removed vcgencmd usage for portability to other distros
  • Added check for sudo for compatibility with more distros
  • Improved MicroSD clock detection
  • Setup now sets paper.yml option for watchdog warnings to wait until 120 seconds after the server starts to suppress excessive warnings

March 2nd 2019

  • Added a configuration option for memory to dedicate to the Minecraft server (along with a recommended amount)
  • Added support for Debian and Ubuntu Server Raspberry Pi distros
  • Server now installs OpenJDK
  • 11
  • jre
  • headless if it is available, otherwise OpenJDK 9 will be selected
  • Improved CPU architecture detection
  • Added sudo, net
  • tools, wget to server dependencies to improve portability
  • Removed absolute paths from scripts to improve portability
  • MicroSD overclock and GPU memory split config are now split if vcgencmd is not present (non
  • Raspbian systems)

February 18th 2019

  • The SetupMinecraft.sh script will now update all of your scripts to the latest version when ran and reinstall the startup service
  • Implemented a workaround for Java 9 installation since the ca
  • certificates
  • java package broke in Raspbian on the 16th

February 15th 2019

  • Server now starts correctly on Raspbian Full (Raspbian Lite still highly recommended due to more available memory)
  • Added network connectivity check before attempting to update server
  • skips update if no connection available to prevent .jar corruption
  • Service now waits up to 20 seconds for network connectivity before starting up to prevent service starting before server gets an IP address
  • Fixed typo in stop.sh that was causing server to say it wasn't running when it was
  • Removed unnecessary sleep time on stop.sh script so it returns as soon as the minecraft server closes
  • Added automatic backups performed when server starts (located in minecraft/backups)

February 9th 2019

  • Added check to make sure service isn't already running when started

February 3rd 2019

  • Added optional service configuration to start minecraft automatically on boot
  • Added optional daily reboot configuration via Cron in setup script
  • Added a check in the installer to make sure Java was installed properly before continuing
  • Installer script now goes into the started screen window after installation
  • Server now checks for updates to the server on startup

February 2nd 2019

  • Script now checks to make sure we are running on the ARMv7 CPU architecture with 1024MB of RAM to ensure Java 9 works
  • Script helps you overclock SD card and change gpu_mem to 16MB
  • Increased memory usage of server from 800MB to 850MB due to gpu_mem tweak
  • Improved reliability and validation checks on setup script