Systemd service file to start/stop/enable a minecraft server. If you want to connect to the server console later, use the "with screen" solution.
- user "minecraft"
- member of group "minecraft" (
groupadd -r minecraft
) - home at /var/minecraft/ (
useradd -r -g minecraft -d "/var/minecraft" -s "/bin/bash" minecraft
) - ownes /var/minecraft/server (
chown minecraft.minecraft -R /var/minecraft/
)
- member of group "minecraft" (
- server.jar at /var/minecraft/server/server.jar
- Write the minecraft.service file in /etc/systemd/system/
- Run
systemctl daemon-reload
- Use normal systemd commands to start/stop/enable the minecraft server. (https://wiki.ubuntuusers.de/systemd/systemctl/)
- Use the files provided in the "with_screen" directory of this repository.
- Write the minecraft.service file in /etc/systemd/system/
- Write the start-server.sh script in /var/minecraft/server/
- Run
systemctl daemon-reload
- Use normal systemd commands to start/stop/enable the minecraft server. (https://wiki.ubuntuusers.de/systemd/systemctl/)
- Switch to user "minecraft" (
sudo su minecraft
) - Run
screen -r minecraft
- Disconnect using
ctrl + a
followed byd
(https://wiki.ubuntuusers.de/Screen/)