A basic startup script for minecraft-server
- This script has been tested on Amazon Linux AMI but should work on any Red Hat Enterprise Linux (RHEL) compatible distro, eg: CentOS
- You should have minecraft-server installed in
WORKDIR
(default:/usr/local/minecraft-server
)
- Simply drop the
minecraft-server
file into/etc/init.d
- Adjust the following variables at the top of the file to match your system's capabilities:
WORKDIR
- path where minecraft-server is installedMIN_MEMORY_ALLOCATION
- Initial memory allocation pool for JVMMAX_MEMORY_ALLOCATION
- Maximum memory allocation pool for JVMJAVA_FLAGS
- By default this script uses Java flags recommended by Aikar. Adjust as needed for your system.
- Start Minecraft Server:
service minecraft-server start
- Stop Minecraft Server:
service minecraft-server stop
- Restart Minecraft Server:
service minecraft-server restart
- Get Minecraft Server Status:
service minecraft-server status
- The service will start in the background and ignore the HUP signal.
- stderr/stdout will be routed to
$WORKDIR/service.log
[TODO]
See https://minecraft.gamepedia.com/Tutorials/Setting_up_a_server#Linux_instructions
Assuming you already have Minecraft Server installed, you can easily upgrade to a new version like so:
wget https://launcher.mojang.com/mc/game/X.YY.Z/server/abcdefg12345/server.jar -O /usr/local/minecraft-server/minecraft_server.X.YY.Z.jar
chown minecraft-server.daemon /usr/local/minecraft-server/minecraft_server.X.YY.Z.jar
ln -sf /usr/local/minecraft-server/minecraft_server.X.YY.Z.jar /usr/local/minecraft-server/server.jar
service minecraft-server restart
sudo tail --lines=500 -f /usr/local/minecraft-server/logs/latest.log
- Edit
/usr/local/minecraft-server/server.properties
and set enforcement of whitelist:enforce-whitelist=true
- Restart the server:
service minecraft-server restart
- Find the user's UUID from one of these sites:
- Edit
/usr/local/minecraft-server/whitelist.json
and add them:[ { "uuid": "d56f5713-fb33-4b2c-ab22-725cb362542d", "name": "SomeUser" }, { "uuid": "034b1c1c-4a1c-463b-b70e-1c0c53737efd", "name": "AnotherUser" }, ]
- The
name
attribute is freeform, not the actual username, so make it descriptive so that you know who it is! Users can change their names over time so use this to know who it is.
- The
- Restart the server:
service minecraft-server restart