Skip to content

Instantly share code, notes, and snippets.

@PttCodingMan
Last active June 21, 2021 06:05
Show Gist options
  • Save PttCodingMan/a6622b8234ea23daafdb8f711d3a7bf3 to your computer and use it in GitHub Desktop.
Save PttCodingMan/a6622b8234ea23daafdb8f711d3a7bf3 to your computer and use it in GitHub Desktop.
init Minecraft server in debian or ubuntu
# set your java installer here, must with tar.gz
java_installer=https://cdn.azul.com/zulu/bin/zulu16.30.15-ca-jre16.0.1-linux_x64.tar.gz
installer_name_full="$(basename -- $java_installer)"
installer_name="${installer_name_full%.*}"
installer_name="${installer_name%.*}"
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get -y install git
curl -O $java_installer
tar -xf $installer_name_full
# put your github private key here
sudo chmod 600 ./github
eval `ssh-agent -s`
ssh-add -q ./github
cd ..
# clone your minecraft server repo
git clone git@github.com:rock-mc/server.git
cd server
cp startup.sh startup.sh.back
# replace java path in startup.sh
sed -i "s/THIS_VALUE_WILL_REPLACE_WITH_JAVA_PATH/$installer_name/" startup.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment