Update setup_minecraft_lxc.sh
This commit is contained in:
parent
03272fe6db
commit
de0303d21c
1 changed files with 8 additions and 8 deletions
|
|
@ -1,30 +1,30 @@
|
||||||
#!/bin/bash
|
#!/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
|
# Tested on Debian 11/12 and Ubuntu 24.04
|
||||||
# Author: TimInTech
|
# Author: TimInTech
|
||||||
|
|
||||||
# Update package lists and install required dependencies
|
# 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-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
|
mkdir -p /opt/minecraft && cd /opt/minecraft
|
||||||
|
|
||||||
# Fetch the latest 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')
|
||||||
|
|
||||||
# Validate if version and build numbers were retrieved
|
# Validate if the version and build exist
|
||||||
if [[ -z "$LATEST_VERSION" || -z "$LATEST_BUILD" ]]; then
|
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
|
exit 1
|
||||||
fi
|
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"
|
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
|
echo "eula=true" > eula.txt
|
||||||
|
|
||||||
# Create start script
|
# Create start script
|
||||||
|
|
@ -38,4 +38,4 @@ chmod +x start.sh
|
||||||
# Start the server in a detached screen session
|
# Start the server in a detached screen session
|
||||||
screen -dmS minecraft ./start.sh
|
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."
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue