Linux

Setting up a Minecraft server on Ubuntu 24.04 with DDoS protection

ColossusCloud's Team 2 min read

Before you start

This guide covers Minecraft Java Edition server installation. You’ll need:

  • A VPS running Ubuntu 24.04 LTS with at least 2GB RAM (4GB+ recommended for multiple players)
  • SSH access with root or sudo privileges
  • Basic command line familiarity

Minecraft servers are memory-hungry:

  • 2GB RAM - 1-5 players, small world
  • 4GB RAM - 5-15 players, moderate exploration
  • 8GB+ RAM - 15+ players, large worlds, plugins/mods

Step 1: Update system

sudo apt update && sudo apt upgrade -y

Step 2: Install Java

Minecraft requires Java. Install OpenJDK 21:

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

Verify:

java -version

Step 3: Create Minecraft user

For security, run under its own account:

sudo useradd -r -m -d /opt/minecraft minecraft

Step 4: Download server

Switch to minecraft user and download:

sudo -u minecraft -s
cd /opt/minecraft
wget https://piston-data.mojang.com/v1/objects/45810d238246d90e811d896f87b14695b7fb6839/server.jar

Note: Get current download link from Minecraft’s official site.

Step 5: Accept EULA

echo "eula=true" > eula.txt

Step 6: Create startup script

cat << 'EOF' > start.sh
#!/bin/bash
java -Xms1G -Xmx2G \
  -XX:+UseG1GC \
  -XX:+ParallelRefProcEnabled \
  -XX:MaxGCPauseMillis=200 \
  -jar server.jar nogui
EOF

chmod +x start.sh
exit

Adjust -Xmx to about 75% of VPS RAM.

Step 7: Create systemd service

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

Add:

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

[Service]
User=minecraft
WorkingDirectory=/opt/minecraft
ExecStart=/opt/minecraft/start.sh
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl daemon-reload
sudo systemctl enable minecraft
sudo systemctl start minecraft

Step 8: Configure firewall

In ColossusCloud control panel, configure firewall:

  • Port 25565 (TCP) - Open for Minecraft traffic
  • Port 22 (SSH) - Restrict to your IP or keep closed in Global firewall

DDoS protection included

Minecraft servers are frequent DDoS targets. Good news: all ColossusCloud VPS includes DDoS protection at no extra cost.

Our DDoS mitigation provides:

  • Massive scrubbing capacity absorbing large attacks
  • Third-party DDoS scrubbing service with global presence
  • Always-on protection - no manual enabling needed
  • Automatic detection of attack traffic

When attacks hit, malicious traffic filters before reaching VPS. Legitimate player connections continue.

No configuration needed. Protection is already active.

Step 9: Test server

Check status:

sudo systemctl status minecraft

Connect to server from Minecraft using VPS IP and port 25565.


Explore VPS plans for the right amount of RAM for Minecraft servers.

Choose your VPS.

Compare CPU types, memory, and storage to find the right configuration.

Explore VPS plans