Docs / Game Servers / Running a Minecraft Server on Your VPS

Running a Minecraft Server on Your VPS

By Admin · Jan 19, 2026 · Updated Apr 23, 2026 · 485 views · 2 min read

Requirements

Players RAM CPU Plan
1-5 2 GB 2 vCPU Small
5-15 4 GB 2-4 vCPU Medium
15-30 8 GB 4 vCPU Large
30+ 16+ GB 4-8 vCPU Premium

Installation

# Install Java 21
sudo apt install -y openjdk-21-jre-headless

# Create server directory
sudo mkdir -p /opt/minecraft
sudo useradd -r -m -d /opt/minecraft minecraft
sudo chown minecraft:minecraft /opt/minecraft

Download Server

sudo -u minecraft bash -c '
cd /opt/minecraft
wget https://piston-data.mojang.com/v1/objects/latest/server.jar
echo "eula=true" > eula.txt
'

Server Configuration

# /opt/minecraft/server.properties
server-port=25565
max-players=20
view-distance=10
simulation-distance=8
online-mode=true
difficulty=normal
gamemode=survival
motd=\u00a7bMy Kazepute Server \u00a77- Welcome!

Systemd Service

# /etc/systemd/system/minecraft.service
[Unit]
Description=Minecraft Server
After=network.target

[Service]
User=minecraft
WorkingDirectory=/opt/minecraft
ExecStart=/usr/bin/java -Xms2G -Xmx4G -jar server.jar nogui
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
sudo systemctl enable --now minecraft

JVM Optimization

For Paper/Purpur servers, use Aikar's flags:

ExecStart=/usr/bin/java \
  -Xms4G -Xmx4G \
  -XX:+UseG1GC \
  -XX:+ParallelRefProcEnabled \
  -XX:MaxGCPauseMillis=200 \
  -XX:+UnlockExperimentalVMOptions \
  -XX:+DisableExplicitGC \
  -XX:G1NewSizePercent=30 \
  -XX:G1MaxNewSizePercent=40 \
  -XX:G1HeapRegionSize=8M \
  -XX:G1ReservePercent=20 \
  -XX:G1MixedGCCountTarget=4 \
  -jar server.jar nogui

Firewall

sudo ufw allow 25565/tcp comment "Minecraft"

Performance Tips

  • Use Paper instead of Vanilla for better performance
  • Reduce view-distance to 8-10 for lower RAM usage
  • Use simulation-distance of 6-8
  • Pre-generate the world to reduce CPU spikes
  • Install Chunky plugin for world pre-generation

Automated Backups

#!/bin/bash
# /opt/minecraft/backup.sh
TIMESTAMP=$(date +%Y%m%d_%H%M)
screen -S mc -p 0 -X stuff "say Backup starting...\n"
screen -S mc -p 0 -X stuff "save-all\nsave-off\n"
sleep 5
tar czf /backup/minecraft/world_${TIMESTAMP}.tar.gz -C /opt/minecraft world
screen -S mc -p 0 -X stuff "save-on\nsay Backup complete!\n"
find /backup/minecraft -name "*.tar.gz" -mtime +7 -delete

Tip Consider using Paper or Purpur instead of the vanilla server. They include significant performance optimizations and support plugins (Spigot/Bukkit API).

Was this article helpful?