01
Before you start
You need a VPS running Ubuntu 24.04 or Debian 13, SSH access with a user that has sudo rights, and enough memory: count what the server needs (see the guide how much RAM for a Minecraft server), plus 1 to 2 GB for the system.
Minecraft relies above all on one fast core: the game's main loop runs on a single thread. A recent high-frequency processor matters more than a large number of cores.
If you would rather not administer anything, a Minecraft plan does all this for you: the guide VPS or game plan helps you choose.
02
Installing Java and preparing the folder
Recent Minecraft versions require Java 21. Install it, then create a dedicated user, without admin rights, to run the server:
sudo apt update && sudo apt install -y openjdk-21-jre-headless
java -version
sudo useradd -r -m -d /opt/minecraft -s /bin/bash minecraft
sudo -u minecraft mkdir -p /opt/minecraft/serveur
Never run a game server as root: a flaw in a plugin would then give control over the whole machine.
03
Downloading Paper and accepting the EULA
Paper is the most used server software: compatible with Bukkit and Spigot plugins, and clearly faster than the official server. Download the latest stable version from papermc.io into /opt/minecraft/serveur, named paper.jar, then run it a first time:
sudo -iu minecraft
cd /opt/minecraft/serveur
java -Xms4G -Xmx4G -jar paper.jar --nogui
The server stops immediately and creates eula.txt: open it and replace eula=false with eula=true to accept Minecraft's licence agreement. Start again: the world generates, then type stop.
-Xms and -Xmx set the server's memory. Give both the same value, and always leave headroom for the system.
04
A service that starts and restarts by itself
For the server to start with the machine and come back if it crashes, create the service /etc/systemd/system/minecraft.service:
[Unit]
Description=Serveur Minecraft
After=network-online.target
[Service]
User=minecraft
WorkingDirectory=/opt/minecraft/serveur
ExecStart=/usr/bin/java -Xms4G -Xmx4G -jar paper.jar --nogui
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now minecraft
journalctl -u minecraft -f
On stop (sudo systemctl stop minecraft), the server receives a clean shutdown signal and saves the world before shutting down.
05
Opening the port and keeping the console
- Firewall:
sudo ufw allow 25565/tcp, in addition to SSH. If you add Geyser for Bedrock players, also open 19132/udp.
- Console: a service has no interactive console. Enable RCON in
server.properties (enable-rcon=true, a long rcon.password), and use an RCON client from the VPS itself. Never open the RCON port (25575) in the firewall.
- Address: players connect with the VPS's IP address, or better, a domain name pointing to it.
06
Backing up the world
A Minecraft world copies badly while it is being written. The safe method: over RCON, save-off then save-all, copy the world folder (world, and for Paper world_nether and world_the_end), then save-on. Automate it with a systemd timer, and send the copies off the VPS: a backup on the same machine does not protect against a mistake on that machine.
Think about updates too: system (sudo apt upgrade), Paper and plugins, always after a backup, and checking that your plugins support the new game version.
07
On a CloudFive VPS
Our Ryzen VPS runs on Ryzen 9 9950X, one of the fastest processors per core, which matters most for Minecraft, with DDR5 memory, NVMe storage and anti-DDoS protection included. For a public server, the game-specific filter is available as an option. Before opening the server, also follow the guide securing a Linux VPS.
08
Frequently asked questions
Which Java version for a Minecraft server?
Java 21 for recent Minecraft versions. On Ubuntu 24.04 or Debian 13, the openjdk-21-jre-headless package is enough.
How much RAM to give a Minecraft server on a VPS?
What the server needs depending on players, plugins and mods, plus 1 to 2 GB for the system. The guide on Minecraft server RAM gives benchmarks.
How do I keep a Minecraft server running permanently on a VPS?
With a systemd service: it starts the server with the machine, restarts it if it crashes, and stops it cleanly while saving the world.
Which port should be opened for a Minecraft server?
Port 25565 in TCP for Minecraft Java, and 19132 in UDP if Bedrock players come in through Geyser. The RCON port must never be open to the Internet.