Skip to content

Instantly share code, notes, and snippets.

@gotcake
Last active April 5, 2020 04:34
Show Gist options
  • Save gotcake/cf8d2c025c0e208a454368af181d4738 to your computer and use it in GitHub Desktop.
Save gotcake/cf8d2c025c0e208a454368af181d4738 to your computer and use it in GitHub Desktop.
Setup script for a mincraft server based on Ubuntu
wget -O minecraft_server_setup.sh https://gist.githubusercontent.com/gotcake/cf8d2c025c0e208a454368af181d4738/raw/1077e9494c0d17e5af4a6839e04b021f598dbee8/mincraft_server_setup.sh
bash minecraft_server_setup.sh
#!/bin/bash
set -ex
# create user
if [ -z "$(cut -d: -f1 /etc/passwd | grep minecraft)" ]; then
useradd -d /minecraft minecraft
usermod -aG sudo minecraft
fi
# install java
if [ -z "$(which java)" ]; then
apt install openjdk-11-jre-headless
fi
# download and install
mkdir -p /minecraft/build
rm -rf /minecraft/build/*
cd /minecraft/build
wget -O BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
java -jar BuildTools.jar --rev latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment