How to Set Up a Minecraft Java Edition Server
A step-by-step guide to running your own always-on Minecraft: Java Edition server on a Linux VPS — from Java to Paper, ports and 24/7 uptime.
Hosting your own Minecraft: Java Edition server means no third-party player caps, no shared-host lag spikes, and full control over plugins, world settings and who gets in. A Linux VPS is the ideal home for it: cheaper than a dedicated box, far stronger than a home PC, and online around the clock.
What you'll need
- A VPS with at least 2 GB RAM for vanilla and a couple of friends; 4 GB is comfortable once you add plugins and players.
- Ubuntu 24.04 or Debian 12.
- SSH access with a sudo user.
Step 1: Update and install Java
Minecraft 1.20.5 and newer require Java 21. Install the headless runtime — you don't need a desktop:
sudo apt update && sudo apt upgrade -y
sudo apt install openjdk-21-jre-headless screen -y
java -version
Step 2: Create a dedicated user
Never run a game server as root. Make a separate account so a compromise stays contained:
sudo adduser --disabled-password minecraft
sudo su - minecraft
mkdir server && cd server
Step 3: Use Paper instead of vanilla
The official jar works, but Paper is a drop-in replacement that runs the same worlds far faster and supports Bukkit/Spigot plugins. Download the latest build from papermc.io (copy the current URL for your Minecraft version):
wget -O server.jar "PASTE_PAPER_JAR_URL"
Step 4: First run and the EULA
Start it once to generate config files:
java -Xms2G -Xmx2G -jar server.jar nogui
It will stop and create eula.txt. Open it, change eula=false to eula=true to accept Mojang's licence, then start it again.
Step 5: Tune server.properties
A few settings matter most for performance and experience:
view-distance=8— the single biggest RAM and CPU lever; 8–10 is plenty.simulation-distance=6— how far entities and redstone tick.max-players=10— set realistically for your RAM.online-mode=true— keep this on so only legitimate accounts join.
Step 6: Keep it running 24/7
Closing SSH shouldn't kill your world. A screen session is the simplest robust option:
screen -S mc
java -Xms2G -Xmx2G -jar server.jar nogui
Press Ctrl+A then D to detach; reattach any time with screen -r mc. For a proper production setup, wrap it in a systemd service so it restarts on crash and boot.
Step 7: Open the port
Java Edition listens on TCP 25565:
sudo ufw allow 25565/tcp
Give friends your server's IP (and port if non-default) and you're live.
Memory flags that actually help
Minecraft's default garbage collector causes periodic stutter. The community-standard Aikar's flags switch it to G1GC with tuned pause targets and noticeably smooth out tick times — worth adding to your start command once you're past 4 GB of heap.
Lock it down with a whitelist
Once your friends are in, close the door behind them. Turn on the whitelist so only approved players can join, which stops random scanners and griefers cold. As an operator in the console or in-game:
whitelist on
whitelist add PlayerName
op YourName
Set enforce-whitelist=true in server.properties so anyone removed from the list is kicked immediately. Grant operator status only to people you fully trust, since ops can change game rules and manage other players.
Common first-run problems
- Server won't start, "unsupported class version": your Java is too old — install Java 21.
- Friends can't connect but you can: the port isn't open or forwarded. Recheck step 7 and confirm with an external port checker.
- "Failed to verify username":
online-modeis on (correct) but the player isn't using a legitimate account. - Steady lag: lower
view-distanceand profile with the spark plugin before blaming hardware.
Why NVMe matters here
Chunk loading and world autosaves are disk-heavy. On the NVMe-backed VPS instances Nxeon provisions, exploring new terrain and saving the world happen in milliseconds instead of causing the lag stutters you get on oversold spinning-disk hosts. With one-click deploy you can have a Paper server live before you finish reading this guide, then SSH in with full root to customise anything above.