This is the official Minecraft Java Edition dedicated server (vanilla), running on a LochStudios KVM VPS. You install Java, download the jar from Minecraft, accept the EULA, and listen on TCP port 25565.
Need a VPS first? See VPS. On a dedicated server, open a support ticket and we will size the box with you.
This article is not Minecraft Bedrock. Bedrock uses a different server and UDP port 19132.
Before you start
- Sign in at the portal, open the VPS service, and keep that page open. Copy the IPv4 from there. Do not guess a hostname.
- Connect with a sudo user, or
rooton a fresh box.
- Connect to your VPS via SSH from macOS or Linux
- Connect to your VPS via SSH from Windows
- If this VPS is new, patch it and create a sudo user first: First steps on a new VPS.
If SSH from your computer will not connect, open the console on the same VPS service. That session does not need port 22 from your network.
We document Ubuntu 24.04 LTS. Debian is close. For AlmaLinux or Rocky Linux, open a support ticket and we will match the packages.
RAM
Leave memory for the operating system. Do not set -Xmx to the full VPS size.
| VPS RAM | Suggested -Xmx / -Xms | What it is for |
|---|---|---|
| 4 GB | 2G | Small vanilla world, a handful of players |
| 8 GB | 4G | Comfortable vanilla (Minecraft's own example uses 4G) |
| 16 GB | 8G to 10G | More players, or a heavier world |
A 2 GB VPS is only a smoke test. Current Java Edition wants more. Pick a size on VPS, or open a support ticket and tell us how many players you expect.
If the kernel is swapping hard, add swap: Add Swap Space to Your VPS.
Java version
Match Java to the Minecraft version you will run. The official server page is the source of truth.
| Minecraft Java | Java needed |
|---|---|
| 26.1 and newer | Java 25 |
| 1.20.5 through 1.21.x | Java 21 |
| 1.18 through 1.20.4 | Java 17 |
Current official jars (26.x) need Java 25. Installing default-jre is not enough if that package is an older release.
Step 1: Install Java
On Ubuntu or Debian:
sudo apt update
sudo apt install -y openjdk-25-jre-headless
java -version
The first line of java -version should mention 25.
If apt cannot find openjdk-25-jre-headless:
sudo add-apt-repository universe
sudo apt update
sudo apt install -y openjdk-25-jre-headless
Still missing? Open a support ticket and we will install the runtime with you. Do not mix random third-party Java downloads onto the VPS.
Running an older 1.21.x world instead:
sudo apt install -y openjdk-21-jre-headless
If more than one Java is installed, sudo update-alternatives --config java picks the default.
Step 2: Create a dedicated minecraft user
Do not run the game as root.
sudo useradd -m -s /bin/bash minecraft
sudo -u minecraft mkdir -p /home/minecraft/server
Later articles in this section assume this user and /home/minecraft/server. Keep those paths.
Step 3: Download the official server jar
- On your computer, open the official download page: minecraft.net/download/server.
- Copy the server.jar (or
minecraft_server.*.jar) download URL for the version you want. The hash in that URL changes every release. Do not reuse an old one from a blog. - On the VPS, download it as
server.jar:
sudo -u minecraft wget -O /home/minecraft/server/server.jar 'PASTE_THE_JAR_URL'
ls -lh /home/minecraft/server/server.jar
The file should be tens of megabytes. A few-kilobyte file is an HTML error page, not the jar. Delete it and copy the URL again.
Step 4: Accept the EULA
You must agree to Minecraft's EULA before the process will start. Read it on the download page, then:
printf 'eula=true\n' | sudo -u minecraft tee /home/minecraft/server/eula.txt
Do not run sudo -u minecraft echo ... > eula.txt. The > redirect runs as your shell user (often root) and can leave a file the minecraft account cannot write.
Step 5: Set server.properties
Write a starter file. You can change these later and restart.
sudo -u minecraft tee /home/minecraft/server/server.properties > /dev/null << 'EOF'
# Minecraft server properties
server-port=25565
max-players=10
gamemode=survival
difficulty=normal
online-mode=true
enable-command-blocks=false
spawn-protection=16
view-distance=10
simulation-distance=10
white-list=false
motd=A Minecraft Server
EOF
| Key | What it does |
|---|---|
server-port | TCP port players use. Default 25565. If you change it, change the firewall too. |
max-players | Simultaneous players. Start low; raise it when RAM and CPU stay comfortable. |
gamemode | survival, creative, adventure, or spectator. |
difficulty | peaceful, easy, normal, or hard. |
online-mode | true requires a genuine Minecraft Java account. Leave it on for a public server. |
view-distance | Chunks sent to each player. Higher uses more CPU and RAM. 8 to 10 is a sensible start. |
white-list | Set true later if only named accounts may join. |
online-mode=false lets anyone join with any name. We do not recommend that on a server reachable from the internet.
Fix ownership if you created any file as root:
sudo chown -R minecraft:minecraft /home/minecraft/server
Step 6: Open port 25565
Two filters can block players: the Firewall tab on the VPS in the portal, then UFW (or firewalld) on the OS. Full walkthrough: Open the Right Firewall Ports for Your Game Server.
Java Edition uses TCP 25565.
- In the portal, open the VPS, then the Firewall tab.
- If you already have Drop rules, add an Accept for TCP
25565(and keep SSH 22/TCP allowed) above those Drops. - On Ubuntu or Debian:
sudo ufw allow 25565/tcp
sudo ufw status
If you have never enabled UFW, do Set up a UFW firewall on Ubuntu first. Allow SSH (22/tcp) before sudo ufw enable.
Unsure about an existing portal rule? Open a support ticket. Tell us the VPS service. Do not put the password in the ticket.
Step 7: Start the server once
Use a heap that fits the table above. Example for an 8 GB VPS (4G):
sudo -u minecraft -H bash -c 'cd /home/minecraft/server && java -Xmx4G -Xms4G -jar server.jar nogui'
-Xmxis the maximum heap.-Xmsis the starting heap. Keep them equal.noguiskips the desktop window. Correct for a VPS.
The first start generates the world and can take several minutes. When it prints that it is done, the process is listening.
Type stop and press Enter for a clean shutdown. Do not use Ctrl+C as your usual stop.
Confirm it listened:
sudo ss -tulnp | grep 25565
You should see java on 0.0.0.0:25565 or [::]:25565. Listening only on 127.0.0.1 means players outside the VPS cannot join.
Step 8: Join from Minecraft
- Use the IPv4 on the VPS in the portal. Do not test only from the VPS itself.
- On your PC, open Minecraft Java Edition (the same major version as the jar).
- Multiplayer, then Add Server. Address is
YOUR.IPV4.HERE:25565(or just the IPv4 if you left the default port).
From another machine, a TCP check:
nc -zv YOUR.IPV4.HERE 25565
A reachable port prints succeeded or open. The real test is still a player joining.
Want a name instead of the raw IPv4? In the portal go to Domains, open the domain, then DNS, and add an A record to that IPv4. AtlasDNS is the default. See Point your domain at your hosting.
Keep it running after you log out
A jar started in your SSH session dies when the session ends. Run it as a systemd service:
- Run a Minecraft server as a systemd service (auto-start)
- Or the generic unit: Keep a Game Server Running and Auto-Restarting with systemd
The Minecraft unit expects User=minecraft, WorkingDirectory=/home/minecraft/server, and server.jar. Match the -Xmx value you used here.
If it will not start, or nobody can join
Unsupported class file or a Java version error. You installed the wrong Java for that jar. Check java -version against the table above.
It exits about the EULA. eula.txt must contain eula=true and be owned by minecraft.
server.jar is tiny. The download was not the jar. Get a fresh URL from the official page.
The port test fails. Check the portal Firewall tab, then sudo ufw status, then sudo ss -tulnp. Details: Open the Right Firewall Ports for Your Game Server.
Players cannot join but nc works. They may be on Bedrock, or on a different Java version than the jar.
The VPS feels slow. Lower view-distance and max-players, or raise -Xmx only if free RAM remains. Watch it with Monitor Server Resources.
Still stuck? Open a support ticket. Tell us the VPS service, the Minecraft version, and java -version. Do not send the password.
What to do next
- Auto-start on reboot: Run a Minecraft server as a systemd service (auto-start)
- Plugins (Paper or Spigot) or mods: Add plugins (Paper/Spigot) or mods to a Minecraft server
- World backups: Back Up and Restore a Game Server World or Save
- Firewall recap: Open the Right Firewall Ports for Your Game Server
A step is unclear? Open a support ticket and we will walk through the VPS with you.