Skip to content

Instantly share code, notes, and snippets.

@thetrav
Created February 1, 2026 04:29
Show Gist options
  • Select an option

  • Save thetrav/0e06c05bb876084d9e047f0e90aeb457 to your computer and use it in GitHub Desktop.

Select an option

Save thetrav/0e06c05bb876084d9e047f0e90aeb457 to your computer and use it in GitHub Desktop.
Minecraft server config

put minecraft.service in /etc/systemd/system/

do these to get it in the daemon

sudo systemctl daemon-reexec sudo systemctl daemon-reload sudo systemctl enable minecraft

these are useful for operations

sudo systemctl start minecraft sudo systemctl stop minecraft sudo systemctl restart minecraft sudo systemctl status minecraft sudo journalctl -u minecraft -f

[Unit]
Description=Minecraft Server
After=network.target
[Service]
# ---- CHANGE THESE TO MATCH YOUR SERVER ----
User=minecraft
WorkingDirectory=/opt/minecraft
ExecStart=/usr/bin/java -Xmx4G -Xms2G -jar server.jar nogui
# ---- DO NOT CHANGE THESE (they make it reliable) ----
Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment