Run a game server on your own VPS: Minecraft step by step

Set up a Minecraft Java server on your Debian or Ubuntu VPS: Java 25, a separate user, the official server jar, a systemd service, the firewall and RAM.

EliteStarHosting Team8 November 2026Updated 26 November 20264 min read
Ready to start? View the VPS Hosting plans

On a VPS you run a game server entirely yourself. This guide sets up a Minecraft Java server on Debian or Ubuntu. The building blocks, a separate user, a systemd service and an open port, work for most other game servers too.

Rather not manage the server yourself? Then choose Minecraft hosting with a ready-made panel. If you want to do everything yourself, you can rent a VPS from us from €3 a month.

Log in as your user with sudo, as in Secure your new Linux VPS.

Install Java 25

In November 2026 the newest Minecraft version is 26.3, and Minecraft 26.1 and newer need Java 25. On Debian 13 and on Ubuntu 22.04 and newer, Java 25 is in the normal package sources:

sudo apt update
sudo apt install curl
sudo apt install openjdk-25-jre-headless
java -version

java -version should show version 25. Can't apt find the package, as on Debian 12? Then install temurin-25-jre with the Eclipse Adoptium instructions.

A separate user

Don't run a game server as root: a security hole in the server or a plugin would then hit your whole VPS. Create a user minecraft with its own folder and switch to it:

sudo useradd --system --create-home --home-dir /opt/minecraft --shell /bin/bash minecraft
sudo -iu minecraft

You are now minecraft, in /opt/minecraft.

Server jar and EULA

Download the server from the official source: on minecraft.net, right-click the download link and copy the address. For 26.3, that is the address below. Start the server once:

curl -o server.jar https://piston-data.mojang.com/v1/objects/33680f5f2ac32864d6d7cf5e56a705fdb3e05f4c/server.jar
java -Xms2560M -Xmx2560M -jar server.jar nogui

The server stops right away and creates eula.txt. Read the Minecraft EULA, accept it and start again:

sed -i 's/eula=false/eula=true/' eula.txt
java -Xms2560M -Xmx2560M -jar server.jar nogui

The server now creates the world. Once it has started, type op YourName to make yourself an operator, then stop. With exit you are your own user again.

A systemd service

With a service, the server starts along with your VPS and comes back after a crash. Create the file with sudo nano /etc/systemd/system/minecraft.service:

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

[Service]
User=minecraft
WorkingDirectory=/opt/minecraft
ExecStart=/usr/bin/java -Xms2560M -Xmx2560M -jar server.jar nogui
Restart=always
RestartSec=10
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

Turn the service on and follow the log:

sudo systemctl enable --now minecraft
sudo journalctl -u minecraft -f

Because of Restart=always, the server also starts again after stop in the game. To really stop it, use sudo systemctl stop minecraft: Minecraft then saves the world and shuts down. SuccessExitStatus=143 makes systemd treat Java's exit code 143 as a normal stop. Changed the file? Then run sudo systemctl daemon-reload and sudo systemctl restart minecraft.

Open the port

Minecraft Java uses TCP port 25565:

sudo ufw allow 25565/tcp

Players then connect to 203.0.113.10. More about the firewall is in Set up a firewall with UFW.

How much RAM?

-Xmx is the maximum memory for Minecraft, but Java and Linux need extra memory on top of that. The Paper documentation advises staying 1000 to 1500 MB below your total: the example uses 2560M for a VPS with 4 GB, and with 8 GB about 6500M fits. How much your number of players needs is in How much RAM does your game server need?

When managed game hosting is easier

On a VPS you take care of updates, backups and security yourself. With our Minecraft server hosting, the game panel takes over that work: you choose a server type and version under Versions, install plugins and modpacks from a list, schedule backups and restarts and get a free subdomain. After a crash, your server restarts by itself. A VPS fits when you want full control, or several services on one machine. Mainly want to play with friends? Then game hosting saves you time.