How to Host a Minecraft Server (2026): VPS Self-Host Guide

The short version: To self-host a Minecraft Java server, rent a 4 GB VPS like the Hetzner CX22, install Java 21, download Paper (faster than vanilla), accept the EULA, and run it as a systemd service so it restarts on crash. Tune the heap with Aikar's JVM flags, open TCP port 25565 in UFW, and add a nightly backup cron job. Total time: about 30 minutes.

I run Minecraft servers the same way I run every other production service: on a plain Linux VPS, as a managed background process, with backups I can trust. This guide is the exact sequence I use on a fresh Hetzner box. It targets a Paper-based Java server on Ubuntu 24.04 LTS, which is the right default for 95% of communities. Every command below is copy-pasteable.

If you would rather click a button than type commands, skip to the managed option near the bottom. There is no shame in it, and for a lot of people it is the right call.

What you need

RAM sizing by player count

RAM is the number that decides everything. Minecraft is memory-hungry because it keeps loaded chunks and entities in the heap. The rule of thumb is about 1 GB per 4 to 6 Paper players, plus 1 GB left for the operating system (so the JVM heap is always smaller than the total VPS RAM). Never give Java 100% of the box, the OS needs room or the kernel will start killing processes.

VPS RAM JVM heap (-Xmx) Players Notes
1 GB 768 MB 1 to 4 Tiny survival world for you and a friend. No plugins.
2 GB 1.5 GB 5 to 10 Small Paper SMP with a few light plugins.
4 GB (CX22) 3 GB 10 to 20 The sweet spot for most communities. Plugins, larger render distance.
8 GB 6 GB 20 to 40 Busy public Paper server or a small modded pack.
16 GB 12 GB 40+ or heavy modpack Large modded Forge/Fabric pack or a high-population network.

Modded servers (Forge or Fabric with a big mod list) break these numbers. A 150-mod pack can want 8 GB for six players. If you are running a CurseForge modpack, read its recommended RAM and double it for any real player count.

1. Pick and size the VPS

For most communities, a 4 GB plan is the sweet spot. We run our test server on the Hetzner CX22 (4 GB RAM, 2 shared vCPU, 40 GB NVMe) at about EUR 4.50/mo, which carries 10 to 20 players on Paper with a normal plugin set. Single-thread CPU speed matters more than core count for vanilla and Paper, because the main game loop runs on one thread, so do not over-index on vCPU count.

Put the server in a datacenter close to most of your players. A European group should pick Falkenstein or Helsinki, a US group should pick Ashburn or Hillsboro. Latency is what players feel as block lag, and you cannot fix distance with more RAM.

2. Create a dedicated minecraft user

Never run a game server as root. Create a locked-down system user that owns the server files and nothing else. SSH into the box first, then:

sudo adduser --system --group --home /opt/minecraft minecraft
sudo mkdir -p /opt/minecraft/server
sudo chown -R minecraft:minecraft /opt/minecraft

Everything from here lives in /opt/minecraft/server and is owned by the minecraft user. If the server is ever exploited, the blast radius is one unprivileged account.

3. Install Java 21 (Temurin)

Minecraft 1.21 and current Paper builds require Java 21. We use Eclipse Temurin from Adoptium because it is a clean, well-maintained OpenJDK build. Add the repo and install the headless JRE:

sudo apt update && sudo apt install -y wget apt-transport-https gnupg
sudo mkdir -p /etc/apt/keyrings
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public \
  | sudo gpg --dearmor -o /etc/apt/keyrings/adoptium.gpg
echo "deb [signed-by=/etc/apt/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb \
  $(awk -F= '/VERSION_CODENAME/{print$2}' /etc/os-release) main" \
  | sudo tee /etc/apt/sources.list.d/adoptium.list
sudo apt update && sudo apt install -y temurin-21-jre

Confirm it worked. java -version should report a 21.x build:

java -version

4. Download Paper and accept the EULA

Paper is a high-performance fork of the vanilla server. It is a drop-in replacement that runs Bukkit and Spigot plugins and fixes a long list of vanilla lag sources. We recommend it over the vanilla JAR for every self-hosted server. Grab the latest 1.21.x build from the PaperMC download API into the server directory:

sudo -u minecraft bash
cd /opt/minecraft/server

# Fetch the latest stable Paper build for 1.21.4 (adjust the version as needed)
VERSION="1.21.4"
BUILD=$(curl -s "https://api.papermc.io/v2/projects/paper/versions/$VERSION/builds" \
  | grep -o '"build":[0-9]*' | tail -1 | cut -d: -f2)
curl -o server.jar \
  "https://api.papermc.io/v2/projects/paper/versions/$VERSION/builds/$BUILD/downloads/paper-$VERSION-$BUILD.jar"

Run it once. The first launch fails on purpose because you have not accepted Mojang's license yet, but it generates eula.txt and the config files:

java -Xms1G -Xmx1G -jar server.jar nogui
# It stops with an EULA notice. Accept the license:
sed -i 's/eula=false/eula=true/' eula.txt

Setting eula=true means you agree to the Minecraft EULA. Read it once if you plan to charge players for anything, the EULA restricts what you may sell.

5. Create a start script with Aikar's JVM flags

Default Java garbage collection causes periodic tick stutter on a Minecraft server. Aikar's flags retune the G1 collector for short, frequent pauses instead of long ones. They are the community standard. Set -Xms and -Xmx to the same value (the heap size from the table above), so the JVM never spends time resizing the heap. Create start.sh:

cat > /opt/minecraft/server/start.sh <<'EOF'
#!/bin/bash
cd /opt/minecraft/server
java -Xms3G -Xmx3G \
  -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 server.jar nogui
EOF
chmod +x /opt/minecraft/server/start.sh

Change -Xms3G -Xmx3G to match your plan. On a 2 GB VPS use 1500M, on an 8 GB box use 6G. Keep both values identical. Type exit now to drop back to your sudo user before the next step.

6. Run the server as a systemd service

A systemd service is the reliable way to keep the server alive. It starts on boot, restarts within seconds if the Java process crashes, and survives you closing SSH. Create the unit file:

sudo tee /etc/systemd/system/minecraft.service > /dev/null <<'EOF'
[Unit]
Description=Minecraft Paper Server
After=network.target

[Service]
User=minecraft
Group=minecraft
WorkingDirectory=/opt/minecraft/server
ExecStart=/opt/minecraft/server/start.sh
Restart=on-failure
RestartSec=10s
SuccessExitStatus=0 1

[Install]
WantedBy=multi-user.target
EOF

Reload systemd, enable the service so it starts on boot, and launch it:

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

To watch the live server console, tail the journal. To run a server command (like op or stop), pipe it through systemd is awkward, so most admins keep a console open with the log:

sudo journalctl -u minecraft -f

If you want an interactive in-game console you can type into, run the server inside a tmux session managed by the unit, or install a small wrapper like mcrcon and enable RCON in server.properties. For most people, journal logs plus RCON for occasional commands is plenty.

7. Edit server.properties

The first successful start generates server.properties in the server directory. Stop the service, edit the file, and start it again. The settings that matter most:

sudo systemctl stop minecraft
sudo -u minecraft nano /opt/minecraft/server/server.properties
sudo systemctl start minecraft

8. Open port 25565 in UFW

The Java server listens on TCP 25565 by default. Your firewall has to allow it or nobody connects. On Ubuntu, UFW is the simplest option:

sudo ufw allow 25565/tcp comment 'Minecraft Java'
sudo ufw reload
sudo ufw status

Make sure SSH (port 22) is allowed before you enable UFW, or you will lock yourself out. If you run several servers on one VPS, give each its own port in server.properties and open each port here. Hetzner also has a cloud firewall in its panel, allow 25565 there too if you use it.

Now connect from your client. Use Multiplayer, Add Server, and enter your VPS IP address (the port is implied when it is 25565). You should see your MOTD and be able to join.

9. Set up automatic backups

A world without backups is a world you will eventually lose to corruption, a bad plugin update, or a griefer. Set up a nightly tar of the world folders that keeps seven days of history. Create the backup script:

sudo tee /opt/minecraft/backup.sh > /dev/null <<'EOF'
#!/bin/bash
SRC="/opt/minecraft/server"
DEST="/opt/minecraft/backups"
mkdir -p "$DEST"
STAMP=$(date +%Y%m%d-%H%M)
tar -czf "$DEST/world-$STAMP.tar.gz" -C "$SRC" world world_nether world_the_end
# Keep only the 7 most recent backups
ls -1t "$DEST"/world-*.tar.gz | tail -n +8 | xargs -r rm --
EOF
sudo chmod +x /opt/minecraft/backup.sh
sudo chown minecraft:minecraft /opt/minecraft/backup.sh

Schedule it at 4am daily in the minecraft user's crontab:

sudo crontab -u minecraft -e
# Add this line:
0 4 * * * /opt/minecraft/backup.sh

For real safety, copy those archives off the box. Push the backups folder to S3-compatible object storage (Hetzner Storage Box or any S3 bucket) with rclone on a second cron line. A backup that lives only on the same server it is protecting is not a backup.

Common mistakes and how to fix them

Skip the manual work: managed Minecraft hosting

Everything above takes about 30 minutes and ongoing maintenance: Java updates, security patches, monitoring, and backup checks. If you do not want to run a Linux box, a managed Minecraft host gives you a web panel that handles the JAR, plugins, backups, and restarts for you. You pay more per gigabyte of RAM, but you never touch a terminal.

Our pick for hands-off hosting is Hostinger Game Panel. It runs a one-click Minecraft setup on the same KVM hardware as their VPS line, with a panel for plugins, mods, and backups, and it is the cheapest managed option we have tested. We walk through it in detail in our Hostinger Minecraft hosting review. For a wider comparison, see our best Minecraft server hosting guide.

Two other managed hosts worth a look are Apex Hosting and BisectHosting. Both have strong modpack support and good panels. We do not earn a commission on Apex or BisectHosting, those are plain links and we mention them purely because they are solid options if Hostinger does not fit.

If you want managed infrastructure but for web apps rather than games, Cloudways is the managed layer we use for WordPress, though it is not a Minecraft host.

FAQ

How much RAM does a Minecraft server need?

Budget roughly 1 GB of RAM per 4 to 6 vanilla or Paper players, plus headroom for the OS. A 2 GB VPS runs 5 to 10 players, a 4 GB plan like the Hetzner CX22 runs 10 to 20, and 8 GB comfortably runs 20 to 40. Modded packs (Forge or Fabric with 100+ mods) need far more: plan on 6 to 10 GB even for a small group, because each mod adds memory and chunk-generation cost.

Should I use Paper or vanilla for a Minecraft server?

Use Paper for almost any self-hosted server. Paper is a drop-in replacement for the vanilla server JAR that fixes hundreds of performance issues, supports Bukkit and Spigot plugins, and gives you fine-grained config to stop lag from redstone, entity stacking, and chunk loading. It is fully compatible with the vanilla client, so players notice nothing except smoother ticks. Use vanilla only if you specifically need exact vanilla mechanics for a datapack project.

What are Aikar's flags and do I need them?

Aikar's flags are a tuned set of JVM garbage-collection options for Minecraft servers, maintained by a Paper developer. They configure the G1 garbage collector to do more frequent, shorter pauses instead of rare long ones, which removes most of the periodic tick stutter you get with default Java settings. Yes, use them: they are free performance and the standard for any Paper or Spigot server with 2 GB or more of heap.

What port does a Minecraft Java server use?

The default Minecraft Java Edition port is 25565 on TCP. You must allow inbound traffic on that port in your firewall (UFW on Ubuntu) and, if you are behind a home router, forward it. To run multiple servers on one VPS, give each a different port in server.properties and open each one. Bedrock Edition uses UDP 19132 instead, which is a separate setting.

How do I keep a Minecraft server running after I close SSH?

Run it as a systemd service. A systemd unit keeps the Java process running in the background after you log out, starts it again automatically if it crashes, and brings it back up after a server reboot. This is more reliable than screen or tmux for a long-lived server because systemd handles restarts and logging for you. You attach to the console when you need it and detach without stopping the server.

Is it cheaper to self-host Minecraft on a VPS or buy managed hosting?

Self-hosting on a VPS is cheaper per gigabyte of RAM. A Hetzner CX22 gives you 4 GB for about EUR 4.50 a month, while a managed Minecraft host charges $8 to $15 for the same RAM. The trade-off is your time: with a VPS you install Java, manage updates, and handle backups yourself. Managed hosts like Hostinger Game Panel, Apex, or BisectHosting give you a one-click panel and support, which is worth the premium if you do not want to touch Linux.

Can I install plugins or mods on a self-hosted Minecraft server?

Yes. On a Paper server, drop Bukkit, Spigot, or Paper plugin JARs into the plugins folder and restart, which covers permissions, anti-grief, economy, and minigames without touching the client. For content mods that change blocks and items, you need a Forge or Fabric server JAR instead of Paper, and every player must install the matching client mods. You cannot mix Paper plugins and Forge mods on the same server.