Log inSign up

Host your own Minecraft Java Edition world on a VPS

Install the Java release that the current Minecraft version asks for, download server.jar from the official version manifest, accept the EULA and start it with java -Xms3G -Xmx3G -jar server.jar nogui under a dedicated minecraft user. Wrap that command in a systemd unit, allow TCP 25565 in the firewall, and players can join at 198.51.100.24 within minutes.

Topic: Game and voice servers · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13, Rocky Linux 9, AlmaLinux 9 · Updated 2026-12-03

Which server size suits a Minecraft world?

A High Frequency plan is the right family, because the Minecraft main loop runs on one thread and clock speed decides how many entities and chunks it can process every 50 ms tick. For a vanilla world with a handful of friends, F2-4 (2 vCPU, 4 GB RAM, 128 GB NVMe) leaves 3 GB for the Java heap and 1 GB for the system. Bigger groups, wide view distances or modded play are happier on F3-8, and public servers with many players start at F4-16.

The game servers overview compares the lines in more detail. Pick a city close to most of your players, since round trip time is what people feel as rubber banding. Our plans cannot be resized in place, so if the world outgrows the box later you deploy a larger plan and copy the world folder across, as described in moving to a larger plan.

How should the server be prepared first?

Start from Ubuntu 24.04, Debian 12 or 13, Rocky Linux 9 or AlmaLinux 9, log in over SSH as a sudo user (see creating a sudo user) and bring packages up to date. The tools curl and jq are used below to read the official download manifest.

# Ubuntu and Debian
sudo apt update && sudo apt upgrade -y
sudo apt install -y curl jq wget gpg

# Rocky Linux and AlmaLinux
sudo dnf upgrade -y
sudo dnf install -y curl jq wget

Next create a system account that owns the world and nothing else. The game never needs root, and if a plugin or the server itself is ever compromised, the damage stays inside /opt/minecraft.

sudo useradd --system --create-home --home-dir /opt/minecraft --shell /usr/sbin/nologin minecraft
sudo -u minecraft mkdir -p /opt/minecraft/server

Which Java version does the server need?

Each Minecraft release declares its required Java major version inside its version JSON, so read it from there instead of guessing. The script below asks the manifest for the newest release, follows the link to that version, and prints both the jar URL and the Java version:

MANIFEST=https://piston-meta.mojang.com/mc/game/version_manifest_v2.json
VER=$(curl -s $MANIFEST | jq -r .latest.release)
VJSON=$(curl -s $MANIFEST | jq -r --arg v "$VER" ".versions[] | select(.id == \$v) | .url")
curl -s "$VJSON" | jq -r ".downloads.server.url, .javaVersion.majorVersion"
echo "Release: $VER"

Recent 1.21 releases report 21; newer releases may report a higher number such as 25. Install that runtime from the Eclipse Temurin repository, which ships the same builds for every distribution covered here. Replace 21 with the number you got.

# Ubuntu and Debian
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | sudo tee /etc/apt/keyrings/adoptium.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb $(. /etc/os-release; echo $VERSION_CODENAME) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
sudo apt update && sudo apt install -y temurin-21-jre

# Rocky Linux and AlmaLinux
sudo tee /etc/yum.repos.d/adoptium.repo <<EOF
[Adoptium]
name=Adoptium
baseurl=https://packages.adoptium.net/artifactory/rpm/rhel/\$releasever/\$basearch
enabled=1
gpgcheck=1
gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public
EOF
sudo dnf install -y temurin-21-jre

java -version

Ubuntu 24.04, Debian 13 and the Rocky and Alma AppStream also carry an OpenJDK 21 package (openjdk-21-jre-headless or java-21-openjdk-headless), which is fine when 21 is what the manifest asks for. Debian 12 does not, so Temurin is the simple route there.

How do I download the jar and accept the EULA?

Save the jar into the server folder as the minecraft user, run it once so it writes its default files, then agree to the end user license. The first run stops by itself because the EULA is not yet accepted.

cd /opt/minecraft/server
JAR=$(curl -s "$VJSON" | jq -r .downloads.server.url)
sudo -u minecraft curl -o server.jar "$JAR"
sudo -u minecraft java -Xmx1G -jar server.jar nogui
sudo -u minecraft sed -i "s/eula=false/eula=true/" eula.txt

Read the license at minecraft.net before you flip that switch. After this step the folder holds server.properties, eula.txt and a few JSON files for operators, bans and the whitelist.

Which settings in server.properties matter most?

Only a few lines change how the server feels on day one. Open the file with sudo -u minecraft nano /opt/minecraft/server/server.properties and review these:

  • motd: the line shown in the multiplayer list.
  • white-list=true and enforce-whitelist=true: only invited players join, which stops random scanners from wandering in.
  • view-distance=10 and simulation-distance=8: lower values reduce CPU and memory per player.
  • max-players, difficulty and gamemode: gameplay basics.
  • online-mode=true: keep it on so accounts are verified against the official login service.

Leave enable-rcon off unless you need remote admin tools, and never open the RCON port to the internet.

How do I run Minecraft as a systemd service?

A service unit starts the world at boot, restarts it after a crash and sends its output to the journal. Pairing it with a FIFO socket also gives you a way to type console commands without attaching to a terminal.

sudo tee /etc/systemd/system/minecraft.socket <<EOF
[Unit]
PartOf=minecraft.service

[Socket]
ListenFIFO=/run/minecraft.stdin
SocketUser=minecraft
SocketMode=0660
RemoveOnStop=true
EOF

sudo tee /etc/systemd/system/minecraft.service <<EOF
[Unit]
Description=Minecraft Java server
After=network-online.target
Wants=network-online.target

[Service]
User=minecraft
WorkingDirectory=/opt/minecraft/server
Sockets=minecraft.socket
StandardInput=socket
StandardOutput=journal
StandardError=journal
ExecStart=/usr/bin/java -Xms3G -Xmx3G -jar server.jar nogui
Restart=on-failure
TimeoutStopSec=120

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now minecraft.service
systemctl status minecraft --no-pager

Set -Xmx about 1 GB below the plan RAM. When systemd stops the unit it sends SIGTERM, and the server saves every loaded world before it exits. To run a console command, write it into the FIFO, then read the reply in the log:

echo "whitelist add Steve" | sudo tee /run/minecraft.stdin
echo "op Steve" | sudo tee /run/minecraft.stdin
sudo journalctl -u minecraft -n 20 --no-pager

Which ports must the firewall allow?

Java Edition uses TCP 25565, and that is the only port players need. Open it next to SSH and keep everything else closed. Our servers have no provider firewall in front of them, so the rules inside the OS are the real gate; the firewall tutorial explains the defaults.

# Ubuntu and Debian with ufw
sudo ufw allow OpenSSH
sudo ufw allow 25565/tcp
sudo ufw enable

# Rocky Linux and AlmaLinux with firewalld
sudo firewall-cmd --permanent --add-port=25565/tcp
sudo firewall-cmd --reload

sudo ss -tlnp | grep 25565

The ss line should show Java listening on *:25565. In the game, choose Multiplayer, Add Server and enter 198.51.100.24. With a DNS record such as mc.example.net pointing at the server (see DNS records), players can use the name instead.

How do I back up and update the world?

Copy the world while the server holds no half written chunks. The cleanest way is a short pause in saving, a compressed archive, then saving switched back on:

sudo -u minecraft mkdir -p /opt/minecraft/backups
echo "save-off" | sudo tee /run/minecraft.stdin
echo "save-all flush" | sudo tee /run/minecraft.stdin
sleep 10
sudo -u minecraft tar -czf /opt/minecraft/backups/world-$(date +%F).tar.gz -C /opt/minecraft/server world
echo "save-on" | sudo tee /run/minecraft.stdin

Put those lines in a root cron job (see cron jobs) and copy archives off the server now and then. The optional daily backups add-on from the console covers the whole disk as a second layer; restores are requested through a support ticket.

To update, stop the service, keep a copy of the old jar, download the new one with the manifest script, check whether the Java major changed, and start again. Minecraft upgrades worlds forward only, so take a backup first; an upgraded world cannot be opened by an older version.

What if players cannot connect?

Work from the inside out. First confirm the process is alive with systemctl status minecraft and read the last lines with journalctl -u minecraft -n 50. A line such as Failed to bind to port means another copy is already running. Next test the port from your own computer with nc -vz 198.51.100.24 25565; a timeout points at the firewall. The message Failed to verify username appears when online-mode is on and the client is not signed in. If the log shows OutOfMemoryError, lower view distance or move to a plan with more RAM.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
F2-4vanilla or Paper world for a group of friends2 vCPU, 4 GB RAM, 128 GB NVMe$14.40/mo$43.20 for 3 months
F3-8larger groups or light modpacks3 vCPU, 8 GB RAM, 256 GB NVMe$28.80/mo$86.40 for 3 months
F4-16public servers and heavy modpacks4 vCPU, 16 GB RAM, 384 GB NVMe$57.60/mo$57.60 for 1 month

Questions about Minecraft Java server

How many players fit on F2-4?

A vanilla or Paper world with roughly ten active players usually runs smoothly there. Exploration heavy play and farms with many entities cost more than player count, so watch tick time rather than the number of people online.

Should I use Paper instead of the vanilla jar?

Paper is a drop-in replacement that runs the same worlds with better performance and adds plugin support. The Spigot and Paper guide covers the switch.

Can Bedrock players join this server?

Not directly; Bedrock uses a different protocol on UDP 19132. A proxy plugin such as Geyser on a Paper server can translate between them.

Why run the server as a separate user?

It limits damage. If the game process or a plugin misbehaves, it can only touch files owned by the minecraft account, not the rest of the system.

How do I set a fixed world seed?

Stop the server, set level-seed= in server.properties, rename or remove the old world folder, then start again so a new world is generated.

Is Java Edition traffic heavy on the monthly transfer?

Rarely. Normal play moves modest amounts of data per player; large resource packs downloaded from your server are what make the counter jump.