How to Set Up a Minecraft Server on a VPS

Running your own Minecraft server gives you full control over mods, plugins, and world settings. This guide covers setting up a Java Edition server, the most common self-hosting scenario.

Prerequisites

  • Ubuntu 22.04/24.04 VPS: at least 2 vCPU, 4 GB RAM for a small-to-medium server (more for larger player counts or heavily modded servers)
  • Root or sudo access

Step 1 — Install Java

See How to Install Java (OpenJDK) on Ubuntu & Debian — check current Minecraft version requirements, as newer releases require newer Java versions.

Step 2 — Create a Dedicated User

sudo useradd -m -s /bin/bash minecraft
sudo su - minecraft

Step 3 — Create the Server Directory

mkdir ~/server && cd ~/server

Step 4 — Download the Server JAR

wget https://piston-data.mojang.com/v1/objects/[CURRENT_VERSION_HASH]/server.jar

Get the current download link from Minecraft's official downloads page — the URL includes a version-specific hash that changes with each release.

Step 5 — Accept the EULA

echo "eula=true" > eula.txt

Step 6 — Configure Server Properties

nano server.properties
server-port=25565
max-players=20
difficulty=normal
motd=My VPS Minecraft Server

Step 7 — Run the Server (Initial Test)

java -Xms2G -Xmx4G -jar server.jar nogui

-Xms/-Xmx set minimum/maximum memory allocation — adjust based on your VPS's available RAM, leaving headroom for the OS.

Step 8 — Set Up as a systemd Service (Persistent, Production Use)

exit
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 -Xms2G -Xmx4G -jar server.jar nogui
Restart=on-failure

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

Step 9 — Allow the Firewall Port

sudo ufw allow 25565/tcp

Step 10 — Connect from Minecraft

In the Minecraft client's multiplayer menu, add your server using your VPS's IP address and port (e.g. YOUR_SERVER_IP:25565).

Accessing the Server Console

sudo journalctl -u minecraft -f

For sending commands interactively, use a terminal multiplexer like screen or tmux instead of running as a systemd service, or use RCON for remote command access.

Automating Backups of the World

sudo nano /usr/local/bin/backup-minecraft.sh
#!/bin/bash
tar czf /var/backups/minecraft-world-$(date +%F).tar.gz /home/minecraft/server/world

Schedule via cron, ideally after warning players and briefly saving the world state (save-all command via RCON) for a consistent snapshot.

Adding Plugins/Mods

For plugin support, consider a server platform like Paper (a high-performance fork with plugin support) instead of vanilla Minecraft — check the specific platform's documentation for JAR download and setup, which follows a similar overall process.

Common Errors

Players can't connect despite the server running — confirm the firewall rule was added and port 25565 is correctly forwarded/open.

Server crashes with "OutOfMemoryError" — increase -Xmx if the VPS has available RAM, or reduce max-players/world complexity.

Continue Reading

Browse more articles in Popular Self-Hosted Applications.

  • minecraft server, self hosted game server, minecraft vps, java minecraft
  • 0 Корисниците го најдоа ова како корисно
Дали Ви помогна овој одговор?

Понудени резултати

How to Install Nextcloud on a VPS with Docker

Nextcloud is a self-hosted file sync, sharing, and collaboration platform — a...

How to Install GitLab CE on a VPS

GitLab Community Edition is a full-featured, self-hosted DevOps platform — Git repository...

How to Install Ghost CMS on a VPS

Ghost is a modern, fast, purpose-built platform for blogging and newsletters — a lighter,...

How to Install n8n for Workflow Automation

n8n is a self-hosted workflow automation tool — connecting apps and APIs through a visual...

How to Install Gitea (Lightweight Git Server)

Gitea is a lightweight, self-hosted Git service — a much lower-resource alternative to...