#Minecraft Server Service
Minecraft service and helper scripts for running a vanilla Minecraft server. Greatly inspired/copied by: http://wellsie.net/p/349/
Create a minecraft service user
sudo adduser --system --group --shell /bin/bash minecraft
Switch to the new minecraft user
sudo su minecraft
Drop run_bakup.sh
into /home/minecraft/ and chmod u+x /home/minecraft/run_backup.sh
Make the backup dir
mkdir backups
Install the backup cron crontab -e
@hourly /home/minecraft/run_backup.sh > /home/minecraft/last_backup_log.txt
Make the minecraft server dir and cd into it
mkdir minecraft_server && cd $_
Download the minecraft server jar. All scripts in this gist expect the jar to be labled minecraft_server.1.8.9.jar
.
Should prob symlink this later, but whatever, pull the jar down.
wget https://s3.amazonaws.com/Minecraft.Download/versions/1.8.9/minecraft_server.1.8.9.jar
If you want your current user to be able to play with server files, run the next 3 commands
- Make everything easier and let the group play with everything
cd .. && chown -R minecraft:minecraft . && chmod -R g=u .
- logout of the minecraft user
exit
- If you want to make life easier, add yourself to the minecraft group
sudo usermod -a -G minecraft $(whoami)
else
logout of the minecraft user
exit
put minecraft_shell.sh
into your home dir. Make it executable chmod u+x ~/minecraft_shell.sh
When you run ./minecraft_shell.sh
you must do it as sudo. Once youre in the screen, press Ctrl+a d
to detatch/exit.
put minecraft.conf
in /etc/init/
and set it to executable chmod u+x /etc/init/minecraft.conf
Start the server
sudo service minecraft start
TODO: could probably make this an auto-install script.