A self-hosted Minecraft server beats every commercial Minecraft hosting service for the same money — you get more RAM, more CPU, no artificial player limits, and full control over plugins and mods. This guide walks through Paper (the optimized server fork most people actually run in 2026), Java tuning with Aikar's flags, systemd auto-restart, and daily world backups. Should be playing in fifteen minutes flat.

📋

Prerequisites: Ubuntu 22.04+ VPS, dedicated CPU cores (very important for Minecraft — see our game server guide), 2GB RAM minimum for vanilla / 4-8GB for plugins / 12GB+ for modded. OliveVPS Pro at $7.99/mo handles small/medium servers comfortably.

Steps in this guide

  1. Install Java 21
  2. Create a dedicated minecraft user
  3. Download Paper (the better server)
  4. First boot and accept EULA
  5. Configure server.properties
  6. Aikar's flags for performance
  7. Run as a systemd service
  8. Open the firewall
  9. Daily backups
  10. Performance tips that actually matter
  11. FAQ

Step 1: Install Java 21

Modern Minecraft (1.20.5+) requires Java 21. Older versions of Minecraft can run on Java 17. Pick the right one.

sudo apt update
sudo apt install -y openjdk-21-jre-headless

Verify:

java -version

Should report 21.x.x. The -headless variant skips the GUI components — they're useless on a server and waste RAM.

Step 2: Create a dedicated minecraft user

Don't run the server as root or as your sudo user — make a dedicated unprivileged user.

sudo useradd -r -m -U -d /opt/minecraft -s /bin/bash minecraft
sudo mkdir -p /opt/minecraft/server
sudo chown -R minecraft:minecraft /opt/minecraft

Step 3: Download Paper (the better server)

Vanilla Minecraft server works but performs poorly compared to optimized forks. Paper is the standard choice — same Vanilla gameplay, dramatically better performance, supports Spigot/Bukkit plugins. We strongly recommend it over the official server jar.

Switch to the minecraft user:

sudo -iu minecraft
cd /opt/minecraft/server

Download the latest Paper build. Visit papermc.io/downloads/paper for the current version URL. As of writing, for Minecraft 1.21:

curl -o paper.jar \
  https://api.papermc.io/v2/projects/paper/versions/1.21/builds/latest/downloads/paper-1.21-LATEST.jar

(Replace with the actual current build URL from the Paper site — they don't keep "latest" symlinks.)

Step 4: First boot and accept EULA

Run the server once to generate config files:

java -Xms2G -Xmx2G -jar paper.jar nogui

It'll exit immediately complaining about the EULA. Accept it:

sed -i 's/eula=false/eula=true/' eula.txt

(By doing this you agree to Mojang's EULA.)

Step 5: Configure server.properties

Open server.properties and set the important values:

nano server.properties

Key settings to consider:

motd=A new Minecraft server 🐾
max-players=20
view-distance=10              # default; lower this if performance is poor
simulation-distance=8         # how far entities/redstone simulate
spawn-protection=16
difficulty=normal
gamemode=survival
online-mode=true              # NEVER set false unless you really know why
white-list=false              # set to true once you have your friend list
enforce-secure-profile=true

Don't disable online-mode unless you have a specific reason. Cracked/offline servers attract griefers and can't authenticate Mojang accounts safely.

Step 6: Aikar's flags for performance

The default JVM settings are written for "average" Java apps. Minecraft is not an average Java app — it allocates and frees memory in patterns that the default G1 garbage collector handles poorly. Aikar's flags are the community standard for tuning the JVM specifically for Minecraft. They reduce TPS jitter dramatically, especially on servers with multiple players.

Create a start.sh script in /opt/minecraft/server:

#!/bin/bash
cd /opt/minecraft/server

# Adjust -Xms/-Xmx to match your VPS RAM (leave 1-2GB for OS)
java -Xms4G -Xmx4G \
  -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 \
  -Dusing.aikars.flags=https://mcflags.emc.gs \
  -Daikars.new.flags=true \
  -jar paper.jar nogui

Make it executable:

chmod +x start.sh

Set -Xms and -Xmx to the same value (here 4G) to prevent the JVM from expanding/contracting the heap. Leave 1-2GB for the OS. On a 6GB VPS, use -Xms4G -Xmx4G; on an 8GB VPS, -Xms6G -Xmx6G.

Step 7: Run as a systemd service

Don't run Minecraft in a screen session — use systemd properly. Exit the minecraft user:

exit

Create the service file:

sudo nano /etc/systemd/system/minecraft.service

Paste:

[Unit]
Description=Minecraft Server (Paper)
After=network.target

[Service]
Type=simple
User=minecraft
Group=minecraft
WorkingDirectory=/opt/minecraft/server
ExecStart=/opt/minecraft/server/start.sh
Restart=on-failure
RestartSec=15
StandardInput=null
StandardOutput=journal
StandardError=journal

# Security hardening
ProtectSystem=strict
ReadWritePaths=/opt/minecraft/server
ProtectHome=true
NoNewPrivileges=true
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl daemon-reload
sudo systemctl enable --now minecraft
sudo systemctl status minecraft

Tail the logs:

sudo journalctl -u minecraft -f

You'll see Paper starting up, generating the world if it's a fresh server, and finally "Done" — the server is online.

Step 8: Open the firewall

sudo ufw allow 25565/tcp
sudo ufw reload

From your Minecraft client, connect to your-vps-ip:25565 (or just your-vps-ip since 25565 is default). You should be in.

Minecraft servers that actually purr

Dedicated CPU cores (essential for stable TPS), NVMe storage (faster world saves), 20 regions to put your server close to your players. Free 10 Gbps DDoS protection. Starting at $3.99/mo.

See VPS Plans →

Daily backups

A corrupted world file ruins a server's community in one bad day. Set up daily backups now, before you need them.

Create a backup script at /opt/minecraft/backup.sh:

#!/bin/bash
BACKUP_DIR=/opt/minecraft/backups
WORLD_DIR=/opt/minecraft/server
DATE=$(date +%Y%m%d-%H%M)

mkdir -p $BACKUP_DIR

# Tell server to flush world to disk
/usr/bin/screen -S minecraft -p 0 -X stuff "save-all flush$(printf '\r')" 2>/dev/null || true
sleep 5

# Create backup
cd /opt/minecraft
tar czf $BACKUP_DIR/world-$DATE.tar.gz \
  -C $WORLD_DIR world world_nether world_the_end

# Keep last 7 days
find $BACKUP_DIR -name 'world-*.tar.gz' -mtime +7 -delete

Make it executable and add to cron:

sudo chmod +x /opt/minecraft/backup.sh
sudo crontab -e -u minecraft

Add the line:

0 4 * * * /opt/minecraft/backup.sh

Now you have daily 4am backups, retained for 7 days. Critical: ship copies offsite (rsync to another server, restic to S3-compatible storage, etc.) — backups on the same VPS are not real backups. Our backup strategies guide covers this.

Performance tips that actually matter

Lower view-distance and simulation-distance

The single biggest performance setting on a Minecraft server. Default is 10; many busy servers run 6-8 with no noticeable player impact and dramatic TPS gains. Set both view-distance and simulation-distance.

Limit entities aggressively

Mob farms are TPS killers. In spigot.yml, lower entity-activation-range values for monsters and animals. Limits how far away entities tick — distant entities being inactive helps a lot.

Pregenerate the world

World generation is the most expensive thing the server does. Use a plugin like Chunky to pregenerate a 5000×5000 area at server creation; players exploring won't trigger lag spikes from chunk generation.

Daily restarts

Add a cron job that restarts the server at 4am. The JVM accumulates fragmentation over time; a fresh start each day keeps performance consistent. Most production servers do this.

0 4 * * * systemctl restart minecraft

Skip Bedrock unless you need it

Geyser/Floodgate let Bedrock players join your Java server, but they cost performance and complicate setup. Add them only if you have actual Bedrock players who want to join.

FAQ

How much RAM does a Minecraft server actually need?

Vanilla 1.21 with 5 players: 2-3GB heap, comfortable on a 4GB VPS. Vanilla with 20 players: 4GB heap, 6GB VPS recommended. Plugins (Essentials + WorldGuard + 5-6 others) double the requirements. Modpacks (50+ mods, FTB packs): 8-16GB heap minimum.

Why do I have low TPS even with low CPU usage?

Minecraft's main thread is single-threaded. htop showing 25% on a 4-core VPS could mean one core is at 100% (the main thread is saturated) while three sit idle. Use a Spark profiler plugin to identify which entities/chunks are eating tick time. Often the answer is reducing view-distance or limiting mob farms.

Should I use Vanilla, Paper, Spigot, or Forge?

For 99% of players: Paper. Vanilla performance is too poor at scale. Spigot is older, less optimized than Paper. Forge is for modded gameplay (full mods, not just plugins) and uses much more RAM. Start with Paper unless you're specifically running mods.

Can I run Minecraft and other things on the same VPS?

Yes, but be careful with sizing. Minecraft is greedy — a 4GB Minecraft server plus a few small services (Pi-hole, WireGuard, a website) wants a 6-8GB VPS to run well. Don't undersize.

How do I update Paper to a new version?

Stop the server (sudo systemctl stop minecraft), download the new paper.jar, replace the old one, start the server. Always back up your world before major version updates. World format changes between major versions are usually one-way — you can't downgrade easily.

🐱
The OliveVPS Team

We host Minecraft servers for fun and at work. Aikar's flags have saved us many hours of debugging.