Ir al contenido
VPS y servidores · 7 min

Minecraft server on a VPS: Paper, systemd and RAM sizing

To host a Minecraft Java server on a VPS, install Java, download Paper, start it under its own user as a systemd service and open TCP port 25565. Memory is what you size first: for a group of up to ten friends, a plan with 4 GB of RAM is the practical starting point, and every extra gigabyte buys roughly five more players.

What you need

  • A VPS with Ubuntu 24.04 or Debian 12 and root access over SSH (see Connecting over SSH).
  • Enough RAM. Leave about 1 GB for the system and JVM overhead and give the rest to the heap (-Xmx):
Players (Paper, light plugins) Plan Heap
up to 5 Pulse — 2 vCPU, 2 GB, $10/month -Xmx1G
5–10 Drive — 2 vCPU, 4 GB, $15/month -Xmx3G
10–20 Forge — 4 vCPU, 8 GB, $22/month -Xmx6G
20–30 Titan — 8 vCPU, 12 GB, $32/month -Xmx10G

Heavy modpacks or 30+ players belong on a dedicated server. Watch the disk too: Drive has 20 GB, and a world that players explore freely grows by gigabytes, so set a world border early. More on sizing in How to choose a VPS plan.

1. Install Java

Paper for Minecraft 1.21.x needs Java 21; newer releases may need Java 25, and the Paper download page says which. The Adoptium repository has both for Ubuntu 24.04 and Debian 12:

apt update && apt install -y wget gpg
wget -qO- https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor -o /usr/share/keyrings/adoptium.gpg
echo "deb [signed-by=/usr/share/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb $(. /etc/os-release; echo $VERSION_CODENAME) main" > /etc/apt/sources.list.d/adoptium.list
apt update && apt install -y temurin-21-jre
java -version

2. User, Paper and first start

Copy the download link for the latest build from papermc.io/downloads/paper and paste it below:

useradd -r -m -d /opt/minecraft -s /usr/sbin/nologin minecraft
cd /opt/minecraft
runuser -u minecraft -- wget -O paper.jar "<link to the Paper build>"
runuser -u minecraft -- java -Xmx1G -jar paper.jar --nogui
sed -i 's/eula=false/eula=true/' eula.txt
runuser -u minecraft -- java -Xmx1G -jar paper.jar --nogui

The first run only creates eula.txt and exits. The second generates the world. When the console shows Done, type op YourNick, whitelist add YourNick and stop. For a private server, set these in server.properties:

white-list=true
enforce-whitelist=true
max-players=10
view-distance=8
simulation-distance=6

3. systemd service

/etc/systemd/system/minecraft.service (the heap below is for Drive; take yours from the table):

[Unit]
Description=Minecraft Paper server
After=network-online.target
Wants=network-online.target

[Service]
User=minecraft
WorkingDirectory=/opt/minecraft
ExecStart=/usr/bin/java -Xms3G -Xmx3G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -jar paper.jar --nogui
Restart=on-failure
RestartSec=10
SuccessExitStatus=0 143
TimeoutStopSec=90

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable --now minecraft
journalctl -u minecraft -f

systemctl stop minecraft sends SIGTERM, and Paper saves the world before it exits. The server also comes back after a reboot.

4. Firewall: port 25565

apt install -y ufw
ufw allow OpenSSH
ufw allow 25565/tcp
ufw enable

Players add the server by its IP address; 25565 is the default port, so they don't need to type it.

Common mistakes

  • UnsupportedClassVersionError on start: the Java version is too old for this Paper build. Install the one the download page names.
  • The server dies without an error in its log: the kernel killed it for lack of memory. journalctl -k | grep -i "out of memory" confirms it. Lower -Xmx or move to a larger plan; plan changes are done on request, usually without a reinstall.
  • Lag with few players: lower view-distance, pre-generate the world inside the border, and find what eats the tick with the built-in /spark profiler.
  • Nobody can connect: check ss -tlnp | grep 25565 and ufw status.
  • No backups: they're your job. Stop the server, archive the worlds and copy the archive off the VPS:
systemctl stop minecraft
tar czf /root/world-$(date +%F).tar.gz -C /opt/minecraft world world_nether world_the_end
systemctl start minecraft

Order Drive

Minecraft server on a VPS: Paper, systemd and RAM sizing · dedisrv