Gaming Servers
Minecraft
How to install and configure a Minecraft server (Vanilla, Paper, Spigot) on Linux VPS
Platform Support
| Platform | Support | Notes |
|---|---|---|
| Linux | ✅ Native | Recommended |
| Windows | ✅ Native |
Minimum Requirements
| Players | Recommended RAM | CPU |
|---|---|---|
| 1-5 | 2 GB | 1-2 vCPU |
| 5-15 | 4 GB | 2 vCPU |
| 15-30 | 8 GB | 4 vCPU |
| 30+ | 16 GB+ | 4+ vCPU |
1. Install Java
sudo apt update
# Minecraft 1.20.5+: Java 21
sudo apt install openjdk-21-jdk -y
# Minecraft 1.17-1.20.4: Java 17 is fine
# sudo apt install openjdk-17-jdk -y
java -version2. Create user and folder
# Create dedicated user (security)
sudo useradd -m -s /bin/bash minecraft
sudo su - minecraft
# Create server folder
mkdir ~/server && cd ~/server3. Download the server
Paper (recommended - best performance)
# Download latest Paper version (https://papermc.io/downloads)
VER="1.21.4" # change to desired version
BUILD=$(curl -s "https://api.papermc.io/v2/projects/paper/versions/$VER/builds" | python3 -c "import sys,json; builds=json.load(sys.stdin)['builds']; print(builds[-1]['build'])")
wget "https://api.papermc.io/v2/projects/paper/versions/$VER/builds/$BUILD/downloads/paper-$VER-$BUILD.jar" -O paper.jarVanilla (official Mojang)
# Download from official site: https://www.minecraft.net/en-us/download/server
wget https://piston-data.mojang.com/v1/objects/.../server.jar -O minecraft.jar4. First run and EULA
# First execution (creates config files)
java -Xms512M -Xmx2G -jar paper.jar nogui
# Accept EULA
echo "eula=true" > eula.txt5. Startup script
nano ~/server/start.sh#!/bin/bash
# Optimized Minecraft server startup
cd ~/server
# Adjust Xmx to VPS RAM (leave ~1 GB for system)
java -Xms1G -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 \
-jar paper.jar noguichmod +x ~/server/start.sh6. Persistent startup with tmux
# Start server in tmux session
tmux new -s minecraft
~/server/start.sh
# Press Ctrl+B then D to detach
# Server keeps running!7. systemd service (automatic startup)
sudo nano /etc/systemd/system/minecraft.service[Unit]
Description=Minecraft Server
After=network.target
[Service]
User=minecraft
WorkingDirectory=/home/minecraft/server
ExecStart=/usr/bin/java -Xms1G -Xmx3G -jar paper.jar nogui
ExecStop=/bin/kill -SIGINT $MAINPID
Restart=on-failure
RestartSec=30
[Install]
WantedBy=multi-user.targetsudo systemctl enable minecraft
sudo systemctl start minecraft
sudo systemctl status minecraft
# View logs
sudo journalctl -u minecraft -f8. Basic configuration (server.properties)
# server.properties
server-port=25565
max-players=20
view-distance=10 # reduce for VPS with low CPU (min 6)
simulation-distance=8
online-mode=true # false only for private/cracked servers
difficulty=normal
gamemode=survival
white-list=false
enable-command-block=false9. Open ports
# Minecraft port
sudo ufw allow 25565/tcp
sudo ufw allow 25565/udp
# Bedrock Edition (if using Geyser)
sudo ufw allow 19132/udp10. Console commands
# If using systemd, console is not interactive
# Use RCON to send commands
sudo apt install mcrcon -y
mcrcon -H localhost -P 25575 -p yourrconepassword "list"
# Enable RCON in server.properties:
# enable-rcon=true
# rcon.port=25575
# rcon.password=yourpasswordRecommended Plugins (Paper)
- EssentialsX: essential commands (/home, /warp, /tpa)
- LuckPerms: permission management
- WorldEdit: bulk world modification
- Dynmap: web map of world
- CoreProtect: block logging (anti-griefing)
Tips & Tweaks
JVM Optimization (Aikar's Flags)
The startup script already includes Aikar's optimized GC flags. For reference, the key flags are:
-XX:+UseG1GC: Garbage collector optimized for heap sizes 4-8 GB+-XX:MaxGCPauseMillis=200: Target pause time for GCXX:+ParallelRefProcEnabled: Parallel reference processing
Adjust -Xms (initial) and -Xmx (maximum) heap based on your VPS RAM:
- 2 GB RAM:
-Xms512M -Xmx1G - 4 GB RAM:
-Xms1G -Xmx2G - 8 GB RAM:
-Xms2G -Xmx5G - 16 GB RAM:
-Xms4G -Xmx12G
Paper.yml Tuning
Key performance settings in paper-world-defaults.yml:
world-settings:
default:
# Reduce chunk loading
max-auto-save-chunks-per-tick: 24
# Entity limits
entity-per-chunk-save-limit:
experience_orb: 16
arrow: 16
# Lighting optimization
enable-async-lighting: true
# Spawn rates
despawn-ranges:
soft: 32
hard: 128server.properties Optimization
# Critical performance settings
view-distance=10 # reduce to 8 on limited VPS, max 32
simulation-distance=8 # 6-10 recommended
max-tick-time=60000 # prevent watchdog kills
# Network optimization
network-compression-threshold=256 # reduce packet size
max-players=20 # match your planUseful RCON Commands
| Command | Purpose |
|---|---|
list | Show connected players |
say <message> | Broadcast message |
save-all | Manual save |
reload | Reload server.properties (plugins need restart) |
stop | Graceful shutdown |
difficulty <level> | Change difficulty (0-3) |
seed | Show world seed |
gamerule <rule> <value> | Change game rules |
Monitoring Commands
# Check if server is running
systemctl status minecraft
# View live logs
journalctl -u minecraft -f
# Check memory usage
ps aux | grep java | grep -v grep
# Monitor connections
ss -tulnp | grep 25565Common Config Tweaks
For low-end VPS:
view-distance=8
simulation-distance=6
max-players=10
network-compression-threshold=512For high-performance PVP:
view-distance=12
simulation-distance=10
max-players=50
network-compression-threshold=256
pvp=true
difficulty=hardBackup Strategy
# Automated daily backup at 3 AM
# Add to root crontab: crontab -e
0 3 * * * su - minecraft -c "tar -czf ~/backups/world-\$(date +\%Y\%m\%d).tar.gz ~/server/world*" 2>/dev/nullPerformance Monitoring
Check TPS (ticks per second) via RCON:
mcrcon -H localhost -P 25575 -p password "/forge tps" # Forge serversCommon lag causes:
- View distance too high → reduce in server.properties
- Too many plugins → remove unused ones
- Large world size → consider world border
/worldborder set 5000 - Insufficient RAM → check
Xmxheap size