This started as a 2020 setup note for running Spigot on CentOS 7. CentOS Linux 7 reached end of life on June 30, 2024. For a fresh server, use a supported Linux distribution. If you have an existing world, stop the old server and back up its entire server directory, including world folders, configuration, player data, and any plugins.
1. Prepare the server
Install the Java runtime required by your chosen Minecraft or Spigot release, then verify it with java -version. Create a dedicated system account called minecraft using your distribution’s account tools, and give it ownership of /srv/minecraft. Download the official Java Edition server JAR, or follow Spigot’s BuildTools instructions for your chosen version. Save the selected JAR as /srv/minecraft/server.jar.
2. Start it once before creating the service
Run the initial command as the dedicated account from the server directory:
cd /srv/minecraft
sudo -u minecraft java -Xms1G -Xmx2G -jar server.jar nogui
Adjust the example heap sizes to leave memory for the OS. Read the Minecraft EULA and set eula=true in the generated eula.txt if you agree. Run the command again, check that the world loads, and type stop at the server console before enabling the service.
3. Keep it running with systemd
Save this unit as /etc/systemd/system/minecraft.service. Adjust the Java path if your installation uses a different one.
[Unit]
Description=Minecraft Java Edition server
After=network.target
[Service]
User=minecraft
Group=minecraft
WorkingDirectory=/srv/minecraft
ExecStart=/usr/bin/java -Xms1G -Xmx2G -jar server.jar nogui
TimeoutStopSec=120
Restart=on-failure
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now minecraft
sudo journalctl -u minecraft -f
Test a connection on your local network first. The default Java Edition server port is TCP 25565. Restrict access to intended players where practical, keep the whitelist enabled for a private server, and leave RCON disabled unless you specifically need it. Test that a service stop saves the world cleanly. Before upgrading, take a stopped-server backup and test the new version and plugins on a copy of the world.
See the CentOS lifecycle information and Minecraft’s Java server setup guide.
Discover more from Juzhax Technology
Subscribe to get the latest posts sent to your email.
