Update setup_minecraft_lxc.sh
Script cleaned up: uniform language, bug fixes, better structure
This commit is contained in:
parent
a0c105aab1
commit
0de3e97b56
1 changed files with 13 additions and 13 deletions
|
|
@ -1,33 +1,33 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Minecraft Server Installer für LXC-Container auf Proxmox
|
# Minecraft Server Installer for LXC containers on Proxmox
|
||||||
# Getestet auf Debian 11/12 und Ubuntu 24.04
|
# Tested on Debian 11/12 and Ubuntu 24.04
|
||||||
# Autor: TimInTech
|
# Author: TimInTech
|
||||||
|
|
||||||
# Installation der Abhängigkeiten
|
# Update package lists and install required dependencies
|
||||||
apt update && apt upgrade -y
|
apt update && apt upgrade -y
|
||||||
apt install -y openjdk-17-jre-headless screen wget curl jq
|
apt install -y openjdk-17-jre-headless screen wget curl jq
|
||||||
|
|
||||||
# Erstellen des Minecraft Server Verzeichnisses
|
# Create directory for the Minecraft server
|
||||||
mkdir -p /opt/minecraft && cd /opt/minecraft
|
mkdir -p /opt/minecraft && cd /opt/minecraft
|
||||||
|
|
||||||
# Holen der neuesten PaperMC-Version
|
# Fetch the latest PaperMC version
|
||||||
LATEST_VERSION=$(curl -s https://api.papermc.io/v2/projects/paper | jq -r '.versions | last')
|
LATEST_VERSION=$(curl -s https://api.papermc.io/v2/projects/paper | jq -r '.versions | last')
|
||||||
LATEST_BUILD=$(curl -s https://api.papermc.io/v2/projects/paper/versions/$LATEST_VERSION | jq -r '.builds | last')
|
LATEST_BUILD=$(curl -s https://api.papermc.io/v2/projects/paper/versions/$LATEST_VERSION | jq -r '.builds | last')
|
||||||
|
|
||||||
# Prüfen, ob Version und Build existieren
|
# Validate if version and build numbers were retrieved
|
||||||
if [[ -z "$LATEST_VERSION" || -z "$LATEST_BUILD" ]]; then
|
if [[ -z "$LATEST_VERSION" || -z "$LATEST_BUILD" ]]; then
|
||||||
echo "❌ FEHLER: Konnte die neueste PaperMC-Version nicht abrufen. Bitte überprüfe https://papermc.io/downloads"
|
echo "❌ ERROR: Unable to fetch the latest PaperMC version. Check https://papermc.io/downloads"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "⬇️ Herunterladen von PaperMC Version: $LATEST_VERSION, Build: $LATEST_BUILD"
|
echo "📥 Downloading PaperMC - Version: $LATEST_VERSION, Build: $LATEST_BUILD"
|
||||||
wget -O server.jar "https://api.papermc.io/v2/projects/paper/versions/$LATEST_VERSION/builds/$LATEST_BUILD/downloads/paper-$LATEST_VERSION-$LATEST_BUILD.jar"
|
wget -O server.jar "https://api.papermc.io/v2/projects/paper/versions/$LATEST_VERSION/builds/$LATEST_BUILD/downloads/paper-$LATEST_VERSION-$LATEST_BUILD.jar"
|
||||||
|
|
||||||
# Akzeptieren der EULA
|
# Accept the Minecraft EULA
|
||||||
echo "eula=true" > eula.txt
|
echo "eula=true" > eula.txt
|
||||||
|
|
||||||
# Erstellen eines Start-Skripts
|
# Create start script
|
||||||
cat <<EOF > start.sh
|
cat <<EOF > start.sh
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
java -Xms2G -Xmx4G -jar server.jar nogui
|
java -Xms2G -Xmx4G -jar server.jar nogui
|
||||||
|
|
@ -35,7 +35,7 @@ EOF
|
||||||
|
|
||||||
chmod +x start.sh
|
chmod +x start.sh
|
||||||
|
|
||||||
# Starten des Servers in einer Screen-Session
|
# Start the server in a detached screen session
|
||||||
screen -dmS minecraft ./start.sh
|
screen -dmS minecraft ./start.sh
|
||||||
|
|
||||||
echo "✅ Minecraft Server erfolgreich eingerichtet! Verwende 'screen -r minecraft', um auf die Konsole zuzugreifen."
|
echo "✅ Setup complete! Use 'screen -r minecraft' to access the console."
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue