A VPS keeps your world online around the clock and avoids port forwarding at home. This guide uses Ubuntu and Minecraft Java Edition.
1. Choose the right size
- 2 to 4 GB RAM for a few friends on vanilla.
- 6 to 8 GB RAM for ten or more players or plugins and mods.
- A fast CPU core matters more than many cores, because the main game loop uses one thread.
- NVMe storage speeds up world loading and saves.
2. Install Java and create a user
sudo apt update && sudo apt install -y openjdk-21-jre-headless
sudo adduser --system --group --home /srv/minecraft minecraft
Use the Java version your Minecraft version requires. Recent versions need Java 21.
3. Download the server
Get server.jar from the official Minecraft download page (or from Paper for a faster, plugin-friendly server) and put it in /srv/minecraft. Run it once to create the files, then accept the licence:
cd /srv/minecraft
sudo -u minecraft java -Xms2G -Xmx2G -jar server.jar nogui
sudo -u minecraft sed -i 's/eula=false/eula=true/' eula.txt
4. Run it as a service
[Unit]
Description=Minecraft server
After=network.target
[Service]
User=minecraft
WorkingDirectory=/srv/minecraft
ExecStart=/usr/bin/java -Xms2G -Xmx2G -jar server.jar nogui
Restart=on-failure
[Install]
WantedBy=multi-user.target
Save it as /etc/systemd/system/minecraft.service, then sudo systemctl enable --now minecraft.
5. Open the port
sudo ufw allow 25565/tcp
Players connect with your server IP address. Set white-list=true in server.properties if you want only invited players.
Tune the server
- Lower
view-distanceandsimulation-distanceinserver.properties. It is the fastest way to reduce load. - Set
-Xmsand-Xmxto the same value, and leave some RAM for the system. Do not give Java all the memory of the VPS. - Paper and similar servers add settings that reduce lag compared with the vanilla jar.
- Set
max-playersto what your plan can handle.
Manage and update
To change something, stop the service with sudo systemctl stop minecraft, edit the files and start it again. When a new Minecraft version comes out, back up the world first, replace server.jar and check that your plugins support the new version.
Read the logs
Watch the live log with sudo journalctl -u minecraft -f. If the server stops at start, the log usually names the cause, for example a wrong Java version or an unaccepted licence.
6. Back up the world
Stop saving, copy the world folder, then resume. See how to back up a VPS. Protect the server with the steps in securing a new VPS.
Frequently asked questions
How much RAM does a Minecraft server need?
2 to 4 GB for a few friends on vanilla, and 6 to 8 GB for ten or more players or plugins.
Which port does Minecraft use?
TCP 25565 by default.
Should I use Paper instead of the vanilla jar?
Paper is faster and supports plugins. Vanilla matches the official game exactly.
How do I keep the server running after I log out?
Run it as a systemd service, which also restarts it after a crash or reboot.
Can I host Bedrock Edition too?
Bedrock uses a different server and a different port, so it needs its own setup. This guide covers Java Edition.
Why do players lag even with enough RAM?
The main game loop uses a single thread, so a fast CPU core and a lower view distance help more than extra RAM.