The Minecraft Vanilla (Java) server on your VPS runs as the minecraft user and is managed by a systemd service called minecraft.service. You can control it easily from the command line and tune its memory usage in the service file.
Start, stop, and check the Minecraft server
Use these commands to control the server:
sudo systemctl start minecraft.service \
sudo systemctl status minecraft.service \
sudo systemctl stop minecraft.service
status shows whether the server is running and provides recent log output if you need to debug issues.
Change the RAM allocation for Minecraft
The Java heap size is often controlled with -Xmx (max) and -Xms (min) flags inside the service file.
Open the unit file:
sudo nano /etc/systemd/system/minecraft.service
Find the line that starts the Java process and adjust:
-Xmxto set the maximum RAM for the server-Xmsto set the minimum RAM
After you save the file, reload systemd and restart the service:
sudo systemctl daemon-reload
sudo systemctl restart minecraft.service
The Minecraft server will now start using the updated RAM limits.
