Skip to content

Instantly share code, notes, and snippets.

@vemacs
Last active December 18, 2015 02:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vemacs/5711031 to your computer and use it in GitHub Desktop.
Save vemacs/5711031 to your computer and use it in GitHub Desktop.
A fully functioning Minecraft server in 2 minutes on a clean Ubuntu Server 12.04 setup
#!/bin/bash
echo Instacraft for Ubuntu 12.04 by vemacs
echo THIS SCRIPT IS NOT SUPPORTED, AND IF IT BREAKS, TOO BAD
echo Please use the guide instead: https://gist.github.com/vemacs/5663144
currentuser=$UID
if [ $currentuser != 0 ]
then
echo "You need to be root to run this. "
echo "Try running sudo -i first, and then download this script again."
exit
fi
read -p "Please enter the username to be created: " username
read -s -p "Enter password for user: " password
echo $'\n' && echo The username chosen is $username. Starting user creation...
pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)
useradd -m -p $pass $username
usermod -a -G sudo $username
echo "Updating server"
echo "if you see a GRUB2 warning, select your boot drive using [space], and then press [enter]."
apt-get update
apt-get dist-upgrade
echo "updated. applying tweaks..."
apt-get install nano
sed -i 's/set historylog/# set historylog/g' /etc/default/nano
passwd -l root
sed -i 's/\#?PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config
service ssh restart
echo "installing dependencies..."
apt-get install python-dev python-twisted-core python-twisted-web python-twisted-words libssl-dev python-pip git
add-apt-repository -y ppa:webupd8team/java
apt-get update
echo "installing Java"
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
apt-get install oracle-java7-installer oracle-java7-set-default
echo "installing mark2"
pip install urwid feedparser psutil
cd /usr
git clone git://github.com/mcdevs/mark2.git /usr/local/share/mark2
ln -s /usr/local/share/mark2/mark2 /usr/local/bin/mark2
mkdir /etc/mark2
cd /etc/mark2
touch mark2.properties
chmod 644 /etc/mark2/mark2.properties
locale-gen en_US.UTF-8
update-locale LANG=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
echo "mark2 installed, setting up a Spigot server"
cd /home/$username
touch .hushlogin
mkdir spigot
cd spigot
wget http://ci.md-5.net/job/Spigot/lastSuccessfulBuild/artifact/Spigot-Server/target/spigot.jar
wget https://gist.github.com/vemacs/5711006/raw/dfa226845e67149451b7894e25d5473dfab7bd7b/mark2.properties
wget https://gist.github.com/vemacs/5711015/raw/13a695a65ffbacbed361950ac2bb114e05eb9e98/scripts.txt
echo "Setup complete!"
echo logout, and log back in using user $username and password $password
echo once inside, run \"cd spigot\" and \"mark2 start\"
echo have a nice day!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment