Update setup_minecraft_lxc.sh

This commit is contained in:
==TIM.©.B == 2025-03-16 19:18:30 +01:00 committed by GitHub
parent 03272fe6db
commit de0303d21c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,30 +1,30 @@
#!/bin/bash
# Minecraft Server Installer for LXC containers on Proxmox
# Minecraft Server Installer for LXC Containers on Proxmox
# Tested on Debian 11/12 and Ubuntu 24.04
# Author: TimInTech
# Update package lists and install required dependencies
apt update && apt upgrade -y
apt install -y openjdk-17-jre-headless screen wget curl jq
apt install -y openjdk-21-jre-headless screen wget curl jq unzip
# Create directory for the Minecraft server
# Create the Minecraft server directory
mkdir -p /opt/minecraft && cd /opt/minecraft
# Fetch the latest PaperMC version
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')
# Validate if version and build numbers were retrieved
# Validate if the version and build exist
if [[ -z "$LATEST_VERSION" || -z "$LATEST_BUILD" ]]; then
echo "❌ ERROR: Unable to fetch the latest PaperMC version. Check https://papermc.io/downloads"
echo "ERROR: Couldn't retrieve the latest PaperMC version. Check https://papermc.io/downloads"
exit 1
fi
echo "📥 Downloading 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"
# Accept the Minecraft EULA
# Accept the EULA
echo "eula=true" > eula.txt
# Create start script
@ -38,4 +38,4 @@ chmod +x start.sh
# Start the server in a detached screen session
screen -dmS minecraft ./start.sh
echo "✅ Setup complete! Use 'screen -r minecraft' to access the console."
echo "✅ Minecraft Server setup complete! Use 'screen -r minecraft' to access the console."