SameOS ~/tools/minecraft-linux-server.md

Build Your Own Minecraft Server, Part 1: A Java Server on Linux

Published 2026-07-21 · SameOS Tools

After Palworld and Satisfactory, the Minecraft server joined my home Linux box. Minecraft is a different animal from the other two - the default path is not pulling a Docker image but installing Java (the runtime the game runs on) and executing a server file directly, the old-fashioned way. That brings one version trap worth covering first. Part 1 gets a vanilla server up with friends connected; Part 2 covers modded servers and Docker.

First things first - each game version wants a different Java

The number one reason a Minecraft server refuses to start is the Java version. The game has kept raising its Java requirement over the years, so launching a current server on the Java you installed long ago dies instantly with a version error. My 26.x server runs on Java 25. On Ubuntu it is one apt command, and multiple Java versions can coexist so you can pick per use.

# Install Java 25 (Ubuntu 24.04)
sudo apt update
sudo apt install -y openjdk-25-jre-headless

# Verify - success looks like "openjdk 25..."
java --version

# If several Javas are installed, choose the default
sudo update-alternatives --config java

# Create the server working folder
mkdir -p ~/minecraft && cd ~/minecraft

Download the server file and accept the eula

The server binary (server.jar) comes from the official Minecraft server download page. It must match the game version your friends play. One tip on choosing: I picked 26.1.2 rather than the newest release, because that was the version the Fabric mods I planned to run supported. Mods trail game updates, so if a modded server is the plan, check what versions your mods support first and let that decide the server version. On first launch the server does not start - it writes a single eula.txt and exits. That is not a bug; it is asking you to accept the terms. Flip false to true and run it again, and it generates the world and starts for real.

# First run - only creates eula.txt, then exits (expected)
java -Xms2G -Xmx4G -jar server.jar nogui

# Accept the terms - eula=false becomes eula=true
sed -i 's/eula=false/eula=true/' eula.txt

# Second run - generates the world and starts
# Ready when you see: Done (…s)! For help, type "help"
java -Xms2G -Xmx4G -jar server.jar nogui

# -Xms2G  starting memory 2GB
# -Xmx4G  memory cap 4GB - plenty for 2-4 players; go 6G as players/mods grow

server.properties - only a few knobs matter at first

Once the server has run, it writes server.properties. Dozens of options look intimidating, but only a handful matter early on - the defaults are fine for the rest. Restart the server after changing settings.

# The server.properties entries worth checking first

motd=Our Minecraft Server        # description shown in the server list
max-players=20                   # concurrent players
online-mode=true                 # account verification - keep true (blocks pirated clients)
white-list=false                 # true = only listed players may join
server-port=25565                # connection port - leave it unless you must
view-distance=10                 # render distance - drop to 8 if the box struggles

A systemd unit - so it survives reboots

Run it from a terminal and it dies the moment the terminal closes. Registering it with systemd (the Linux service manager) starts it at boot and revives it if it crashes. One catch from real operation: a Minecraft server exits with code 143 on a clean shutdown. systemd treats that as a failure by default and restarts a server you deliberately stopped, so you must declare 143 a success.

# Save as /etc/systemd/system/minecraft.service (needs sudo)
[Unit]
Description=Minecraft Server
After=network.target

[Service]
User=your-server-user
WorkingDirectory=/home/your-server-user/minecraft
ExecStart=/usr/bin/java -Xms2G -Xmx4G -jar server.jar nogui
Restart=on-failure
# 143 = clean shutdown signal - declare it a success to avoid restart loops
SuccessExitStatus=0 143
TimeoutStopSec=90

[Install]
WantedBy=multi-user.target

# Register and start
#   sudo systemctl daemon-reload
#   sudo systemctl enable --now minecraft
# Status and logs
#   systemctl status minecraft
#   journalctl -u minecraft -f

Friends connecting - one port is all it takes

Unlike Palworld and Satisfactory, Minecraft uses a single port: 25565. Forward 25565 (TCP) to the server machine in your router admin page (port forwarding sends outside connections to one machine on your home network), and friends join by typing your public IP in the multiplayer screen. From inside the house, test first with the server's internal address (192.168.x.x).

Wrapping up

That is enough for a vanilla server your friends can live on: check the Java version, accept the eula, touch a few settings, register with systemd, forward one port. Five steps. The next article installs Fabric (the loader that runs mods), moves the server into Docker, and automates backups.

View the config files from this article on GitHub

Read Part 2: A Fabric Mod Server, Run With Docker See also: Palworld server, Part 1