• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

TheRemote/RaspberryPiMinecraft: Configuration files and performance testing scri ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

TheRemote/RaspberryPiMinecraft

开源软件地址(OpenSource Url):

https://github.com/TheRemote/RaspberryPiMinecraft

开源编程语言(OpenSource Language):

Shell 100.0%

开源软件介绍(OpenSource Introduction):

This script will automatically download and configure the Paper Minecraft server!
For the full article and guide visit https://jamesachambers.com/raspberry-pi-minecraft-server-script-with-startup-service/

Installation Instructions

To get started / install the server type:
curl https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/SetupMinecraft.sh | bash

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!

Changing Minecraft Server Versions

If a new version of Minecraft is out and the script hasn't been updated yet you can change it in the SetupMinecraft.sh script. If you use the command nano SetupMinecraft.sh it will be the first line in the file like this:

Version="1.18.1"
AllowLocalCopy="1"

Make sure to change AllowLocalCopy="1" to tell the script you want to actually run the local copy instead of the latest version.
Note that for this to work the Paper Minecraft server must also have released the latest version or the download will fail. You can check here: https://papermc.io/downloads

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

  • Raspberry Pi OS - Bullseye/Buster/Stretch
  • Ubuntu / Ubuntu Server 21.10 / 20.04 (LTS)
  • Debian 11 Bullseye / Debian 10 Buster / Debian 9 Stretch
  • Arch Linux
  • TinkerOS Stretch

Buy A Coffee / Donate

People have expressed some interest in this (you are all saints, thank you, truly)

  • PayPal: 05jchambers@gmail.com
  • Venmo: @JamesAChambers
  • CashApp: $theremote
  • Bitcoin (BTC): 3H6wkPnL1Kvne7dJQS8h7wB4vndB9KxZP7

Update History

August 10th 2022

  • Moved custom directories to the top of SetupMinecraft.sh to eliminate confusion about how to use the feature (and almost nobody should unless you are storing your server on a separate drive)
  • Improve JRE update detection in SetupMinecraft.sh

August 6th 2022

  • Upgrade to 1.19.2

August 4th 2022

  • Script now removes non-alphanumeric characters from the servername variable (to prevent using quotes and other symbols that will break it)

August 2nd 2022

  • Fix ARM link for Adoptium OpenJDK (thanks zqigolden, PR #42
  • OpenJDK will now detect if you have an older version than SetupMinecraft is installing (or a broken Java install) and reinstall the newest version

July 31st 2022

  • Upgrade Adoptium OpenJDK to 18.0.2 -- if you want to upgrade your Adoptium you can remove the ~/minecraft/jre folder and run SetupMinecraft.sh again to upgrade to the latest one

July 27th 2022

  • Update to 1.19.1 (always make sure you've copied some backups out of the backups folder first!)

June 15th 2022

  • Fix Paper 1.19 version upgrades (thanks Meganium97, issue #41)

June 11th 2022

  • Update to Paper experimental 1.19 release as default installation
  • Make sure you have backups of your server from your "backups" folder stored separately before upgrading
  • If you have problems with 1.19 you need to restore a backup to go back to 1.18 as it will not take your server data files on 1.18 once the 1.19 structures/data have been added
  • Change update.sh to /bin/bash instead of /bin/sh
  • Add PATH variable to update.sh

May 22nd 2022

  • Update OpenJDK installation paths

May 21st 2022

  • Switched from JDK to JRE to save space
  • Added Adoptium OpenJDK support for s390x and ppc64le architectures

May 16th 2022

  • Add -DPaper.IgnoreJavaVersion=true to allow OpenJDK 17 to run the older Paper Minecraft versions (thanks NotMick, issue #39)

May 15th 2022

  • Added screen -wipe to beginning of start.sh to prevent a startup issue that could occur if there was a "dead" screen instance (thanks grimholme)

May 11th 2022

  • Fix Adoptium arm and aarch64 OpenJDK links (thanks 407pilot, issue #38

May 10th 2022

  • Update Adoptium OpenJDK version
  • Add safety check for backups to make sure folder exists before pruning

May 8th 2022

  • Fixed a problem with restart.sh having a #!/bin/sh at the top which could cause restart.sh to run in a POSIX shell that doesn't recognize the [[ operator (thanks jmswan, issue #37

May 4th 2022

  • Fixed "route" command used to detect internet access to be compatible with Debian

April 24th 2022

  • Fixed mistake in new multicore compression (thanks pmcmorris) and related mistake in SetupMinecraft.sh dependency check

April 16th 2022

  • Remove "jre" folder if JDK installation fails so it will attempt to download a fresh copy upon running SetupMinecraft.sh again
  • Added support for the tar command to use multiple CPU cores instead of a single core. This should speed up backups and reduce instances of when it takes longer to back up than the server's startup time (thanks SudosFTW, issue #36)

April 6th 2022

  • Fixed issue that prevented detecting a broken OpenJDK installation
  • Added language headers to OpenJDK download

March 24th 2022

  • Dedicated OpenJDK 17 install is now used (stored in your server's directory) to avoid apt / snap issues
  • Create "logs" folder for new servers to avoid harmless error messages (cleanup)
  • Add new "jre" folder to backup command's ignore list to avoid bloated backups

March 23rd 2022

  • Removed snapd installation as the snapd repository will only install OpenJDK 18 or higher which won't work with Paper
  • Paper still does not support OpenJDK 18 and will give errors using a version that high
  • Working on a new more reliable method to install OpenJDK 17

March 23rd 2022

  • Removed obsolete requirement not allowing OpenJDK versions above 17 as Paper now supports this

March 5th 2022

  • Update to 1.18.2 -- make sure you have backups first if you are upgrading from an existing server!

December 12th 2021

  • Update to 1.18.1 -- make sure you have backups first if you are upgrading from an existing server!
Update_Sudoers

November 30th 2021

  • Update to 1.18 -- make sure you have backups first if you are upgrading from an existing server!

September 15th 2021

  • Update to allow OpenJDK 17 which is now the default "snap"

September 2nd 2021

  • Update to Paper Minecraft Server API v2

August 1st 2021

  • Fixed a missing -A parameter for a curl command (thanks davie2000, issue #27)

July 27th 2021

  • Added PATH variable to scripts to improve compatibility on some distros
  • Server now fixes permissions upon startup

July 21st 2021

  • Switched from wget to curl to fix spacing issues experienced by some users
  • Added error redirection to crontab line to help diagnose failures during scheduled restarts

July 19th 2021

  • Fixed an issue where SetupMinecraft.sh could throw an error if no Java version was installed

July 17th 2021

  • Fixed server name prompt
  • Added username missing to fix service issue
  • Reduced memory recommendation by 100MB to allow more space for the OS / other processes since newer versions of Minecraft are requiring more memory. Remember, if you don't leave enough memory for other things the Minecraft server will crash for memory issues, but it's because you set it too high (counterintuitive I know) and didn't leave enough for the OS and it killed your Minecraft server to prevent the entire OS from crashing.
  • Added in check to ensure start.sh and other scripts are not being ran as root. If this happens you have to use sudo screen -r to find the screen and the permissions will be wrong since root isn't the owner of the server files
  • If you know you ran the script/server as root (which starts creating files owned by root instead of the regular user) and your server won't start/is wonky run the fixpermissions script from your server folder with ./fixpermissions.sh and it will correct them for you!

July 15th 2021

  • Added safety check for path to server -- please use the default path of ~ if you aren't familiar with fully qualified Linux paths/directories -- you really don't want to change the safe defaults unless you have a really specific need.

July 14th 2021

  • Fixed a issue that was causing backups to not rotate (it should only keep 10). Thanks Olli

July 8th 2021

  • Update to 1.17.1
  • Update documentation to explain new AllowLocalCopy="1" flag. This flag tells the script not to run the latest online version and to run the local copy. You want to use this if you are changing the version or making any modifications to the script itself before running it.
  • Added update.sh convenience script that calls the latest version of SetupMinecraft.sh
  • Fixed a bug where having an OpenJDK greater than 16 was not triggering the snap configuration (usually only seen on the cutting edge Ubuntu flavors)

July 5th 2021

  • Fixed an issue with SetupMinecraft.sh saving scripts to the home folder instead of the minecraft folder (thanks Ryan A J.)

July 3rd 2021

  • Add option to choose a custom directory instead of forcing the home path

June 24th 2021

  • Removed installation of OpenJDK above OpenJDK 16 as the Paper Minecraft server is not working with versions higher than 16
  • If you have a higher version of Java installed use the following command: sudo update-alternatives –config java and select OpenJDK 16

June 19th 2021

  • 1.17 Release
  • Make sure you have backups and take copies of your backups and place them outside the Minecraft folder to be 100% safe
  • Once running the new version you can't go back to the old one without restoring a backup because it writes new stuff in your server the old version doesn't understand and crashes on
  • As long as you have backups you should be okay!

June 16th 2021

  • Raised minimum OpenJDK requirement to 16 in preparation for the 1.17 Paper Minecraft server release
  • If a new enough OpenJDK is not available in apt (Raspberry Pi OS is on OpenJDK 11 for example) it will be installed via snapd
  • If snapd is not installed it will ask you if you want to install it (reboot required) or abort
  • After the reboot run SetupMinecraft.sh again and it will finish installing OpenJDK 16! Be patient, it can take some time, even 10-15 minutes on a good connection and longer on a bad one
  • Sorry for the inconvenience, there isn't an easier way to get it until the Raspberry Pi OS apt repositories are updated!

June 12th 2021

  • Fixed syntax error (thanks aruthir!)

June 10th 2021

  • Added OpenJDK 17 and 18 placeholders for prerequisite installations
  • Added a fallback to the non-headless JRE for platforms that don't offer that metapackage
  • Paper Minecraft 1.17 is not yet available but should be soon. If you go to https://papermc.io/api/v1/paper/ and see 1.17 in the list it's available and you can change the version variable at the very top of SetupMinecraft.sh otherwise it hasn't been released yet. Should be soon!

March 22nd 2021

  • Lowered amount of recommended memory by a flat 200MB due to so many people having "Out of Memory" errors
  • Note: Nobody has ever really been "out of memory" on the Pi since like the Pi 1. The problem is you're using TOO MUCH.
  • If you're getting memory related crashes you need to turn your memory DOWN. The server will recommend lower amounts going forward.

March 16th 2021

  • Added backup rotation - server keeps the last 10 backups by default
  • If you want to change the amount of backups held it is located in the "start.sh" script with a comment of '# Rotate backups -- keep most recent 10'
  • This adds a little responsibility for saving really old backups but fixes the issue I and many others have had of the server getting filled with backups and crashing

January 31st 2021

  • Update to 1.16.5
  • Server now takes ownership of server files on each start to prevent folks a whole heap of trouble and heartache when restoring backups/moving files/etc.
  • Added check to make sure script isn't being ran as sudo to prevent installing to the /root folder

December 5th 2020

  • Update to 1.16.4
  • Fixed a bug where if your username on the Pi was Minecraft it would cause the script to break (thanks Minecraftschurli, pull request #20)
  • Fixed a bug that could cause OpenJDK 10 to try to be installed even if OpenJDK 11 installation was successful

September 25th 2020

  • Update to 1.16.3

August 28th 2020

  • Update to 1.16.2

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

热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap