Virteche
Guideschevron_rightServers

Servers · 7 min read · Updated

How to Run a Minecraft Server on a VPS

The simplest dependable way to run a Minecraft Java server on a VPS is the widely used itzg/minecraft-server Docker image. It downloads the server version you ask for, picks the Java version it needs, and restarts with the VPS. You write one compose file with the memory, whitelist and game settings, open TCP port 25565, and players connect to your server's IP address. Give Minecraft 3–4 GB for a few friends on vanilla, more for modpacks.

1. Install Docker

Follow How to run Docker and Docker Compose on a VPS, including the log size limit, then come back here.

2. Write the Compose File

mkdir -p ~/minecraft && cd ~/minecraft
nano compose.yaml
services:
  mc:
    image: itzg/minecraft-server
    container_name: minecraft
    ports:
      - "25565:25565"
    environment:
      EULA: "TRUE"              # you accept Minecraft's EULA
      TYPE: "VANILLA"           # or PAPER, FABRIC, FORGE
      VERSION: "LATEST"
      MEMORY: "4G"
      DIFFICULTY: "normal"
      MOTD: "Our server"
      WHITELIST: "yourname,friend1,friend2"
      ENFORCE_WHITELIST: "TRUE"
      OPS: "yourname"
    volumes:
      - ./data:/data
    restart: unless-stopped
    tty: true
    stdin_open: true

The whitelist keeps strangers out: a public server on a known address gets found by scanners. Setting EULA to TRUE means you accept the Minecraft End User License Agreement.

3. Start It and Open the Port

docker compose up -d
docker compose logs -f        # wait for "Done", then Ctrl+C

If you turned on the firewall on your server's page in the dashboard, add a rule for TCP 25565 there. Players connect to 203.0.113.10 (your server's address), or to a domain name you point at it.

4. Use the Server Console

docker exec -i minecraft rcon-cli
> whitelist add newplayer
> op yourname
> list

Settings in the compose file are applied when the container starts. Change one, then run docker compose up -d again.

5. Back Up the World

Everything lives in ~/minecraft/data. Pause saving while you copy it, so the world is not half-written:

docker exec minecraft rcon-cli save-off
docker exec minecraft rcon-cli save-all flush
tar -czf ~/mc-backup-$(date +%F).tar.gz -C ~/minecraft data
docker exec minecraft rcon-cli save-on

Copy the archive off the server, or back up the whole folder nightly with Borg and a storage box.

6. Update

cd ~/minecraft
docker compose pull && docker compose up -d

With VERSION: "LATEST" the server moves to each new Minecraft release on restart. Pin a version, such as the one your mods support, to stay on it, and back up before any upgrade.

Common Questions

  • How much memory does a Minecraft server need?

    For vanilla with a handful of players, give Minecraft 3 to 4 GB and leave at least 1 to 2 GB for the system. Paper, modpacks, big view distances and more players all need more; watch docker stats while people play.

  • Can I run Paper, Fabric or Forge instead of vanilla?

    Yes. Set TYPE to PAPER, FABRIC or FORGE in the compose file and the image downloads the right server and Java version. Put plugins or mods in the data folder's plugins or mods directory.

  • What about Bedrock Edition?

    Bedrock uses a different server and UDP port 19132. The same author publishes an itzg/minecraft-bedrock-server image that works the same way.

  • Is a dedicated vCPU important?

    Yes. A Minecraft server does most of its work on one main thread, so a fast core that is not shared with anyone else matters more than many cores.

KVM servers with dedicated vCPU and NVMe storage, from 6 GB of memory, in Ashburn and Dallas.

See VPS plans

Keep Reading

All guides
How to Run a Minecraft Server on a VPS | Virteche Cloud