Save 20% on all Cloud VPS plans — use code HAPPY20 at checkout
99.95% uptime SLA 24/7 support Since 2019 Tier IV · Noida
Client Area
BLOGGame servers

Setting up a Minecraft Paper server on a VPS, with the JVM flags that keep TPS at 20

A Java Minecraft server on Ubuntu using Paper: Java 21, the jar, the start script with Aikar's flags, systemd, the firewall, and the first plugins worth installing.

By URLStart Engineering 3 min read
Setting up a Minecraft Paper server on a VPS, with the JVM flags that keep TPS at 20 — URLStart blog cover
Fig. 01 — Setting up a Minecraft Paper server on a VPS, with the JVM flags that keep TPS at 20 — URLStart blog cover
    TL;DR
  • Paper is the server most public Minecraft servers run: compatible with Spigot plugins, faster than vanilla, actively maintained.
  • Java 21 for Minecraft 1.20.5 and newer; the start script with Aikar's flags and -Xms equal to -Xmx is most of the performance work.
  • 4 GB for a friends server, 8 GB for 20 to 40 players with plugins, 16 GB for modded or large communities.
  • Run it under systemd so it survives reboots, open TCP 25565, and keep backups of the world folder with a cron job.

Vanilla Minecraft's server jar works, but almost every server with more than a few players runs Paper: the same game with a faster engine and plugin support. This is the setup on a fresh Ubuntu VPS, including the start script that does most of the performance work.

Size

A friends server with a handful of players on 4 GB. 20 to 40 players with the usual plugins on 8 GB. Modpacks or 50 or more players on 16 GB and up. Minecraft's tick runs on one thread, so a plan with priority or dedicated vCPU matters as much as the RAM; our Minecraft VPS plans are built that way.

Java and a user

sudo apt update && sudo apt install -y openjdk-21-jre-headless screen
sudo useradd -m -s /bin/bash minecraft
sudo su - minecraft
mkdir server && cd server

Java 21 covers Minecraft 1.20.5 and newer. Older versions need Java 17 (1.17 to 1.20.4) or Java 8 (1.12 and earlier); install the matching package.

The Paper jar

Download the latest build for your Minecraft version from the Paper project's downloads page into the server folder and name it paper.jar. Run it once to generate the files:

java -jar paper.jar --nogui

It stops and asks you to accept the EULA. Edit eula.txt, set eula=true, and carry on.

The start script

Create start.sh in the server folder:

#!/bin/bash
java -Xms6G -Xmx6G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 \
  -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch \
  -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M \
  -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 \
  -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 \
  -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem \
  -XX:MaxTenuringThreshold=1 -jar paper.jar --nogui

These are Aikar's flags, the standard tuning for Paper. Set -Xms and -Xmx to the same figure, about 75% of the plan's RAM: 3G on a 4 GB plan, 6G on 8 GB, 12G on 16 GB. Leaving the rest for the OS is what stops the server swapping. chmod +x start.sh.

systemd

As root, /etc/systemd/system/minecraft.service:

[Unit]
Description=Minecraft Paper
After=network.target

[Service]
User=minecraft
WorkingDirectory=/home/minecraft/server
ExecStart=/home/minecraft/server/start.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target

Then systemctl daemon-reload && systemctl enable --now minecraft. Open the port: ufw allow 25565/tcp. Players connect to the server IP; add a DNS name when you have one.

First plugins

EssentialsX for homes, warps and the basics. LuckPerms for permissions. CoreProtect to roll back griefing. Vault if any plugin needs an economy. Drop the jars in plugins/ and restart. Resist installing thirty plugins on day one; each one costs tick time.

Backups

A cron job as the minecraft user that copies the world folders somewhere else nightly:

0 4 * * * tar czf /home/minecraft/backups/world-$(date +\%F).tgz -C /home/minecraft/server world world_nether world_the_end

Prune old archives, and copy the backups off the server occasionally; a backup on the same disk as the world is half a backup.

Questions we get asked

Paper or Spigot or Fabric? Paper for a plugin server. Fabric or Forge for mods; see the modded Minecraft page.

Can Bedrock players join? With the Geyser and Floodgate plugins, yes, on the same server.

TPS keeps dropping. Why? Usually too many entities or chunks loaded, or a plugin doing something expensive. The /spark profiler plugin shows which. Also check -Xmx is not set above the plan's RAM.

How many players on 8 GB? 20 to 40 with normal plugins and a view distance of 8 to 10.

Do you install it for me? Yes, on request at order time, with the flags above.

Ready to deploy?

Root shell in about a minute. Talk to an engineer first if you'd rather size it together.

✓ 99.95% uptime SLA ✓ Cards · UPI · Net banking · PayPal · Crypto ✓ Cancel anytime