RECOMMENDED Amnezia Premium: Works Where Other VPNs Fail

Unblockable AmneziaWG 2.0 & XRay protocols. Perfect for lag-free access to ChatGPT, Claude AI, global freelance marketplaces, and restricted streaming networks with clean RAM-only privacy.

How to Set Up a Minecraft Server on Linux (Java and Bedrock): Step-by-Step Guide

Your own Minecraft server means your world, your rules, your mods and no random players. A small server for friends runs on any Linux machine or VPS with 2–4 GB of RAM. This guide sets up the Java Edition server properly: under its own user, started by systemd, protected by a firewall and backed up. At the end there is a section on the Bedrock server for consoles and phones.

What you need

PlayersRAM for the serverCPU
1–5, vanilla2–3 GB2 fast cores
5–20, plugins4–6 GB2–4 cores, high single-thread speed
20+ or modpacks8–16 GB4+ cores, NVMe SSD

Minecraft’s main game loop runs on one thread, so a fast CPU core matters more than many cores. Use Ubuntu 24.04/26.04, Debian 12/13 or AlmaLinux.

1. Install Java and create a user

Minecraft server running on Linux
# Debian, Ubuntu
sudo apt update && sudo apt install openjdk-21-jre-headless screen
# AlmaLinux, Fedora
sudo dnf install java-21-openjdk-headless

java -version
sudo useradd -r -m -d /opt/minecraft -s /bin/bash minecraft

Current Minecraft versions need Java 21 or newer; the exact requirement is listed with each release. Never run the server as root.

2. Download the server

Two good choices: the official server from minecraft.net, or Paper — a faster, compatible server that supports plugins. For a public or plugin server, take Paper.

sudo -u minecraft -i
cd /opt/minecraft
# Paper: download the jar for your version from papermc.io/downloads
# (or the official server.jar from minecraft.net/download/server)
wget -O server.jar "PASTE_DOWNLOAD_LINK"
java -Xms2G -Xmx2G -jar server.jar --nogui     # first run creates files and stops
sed -i "s/eula=false/eula=true/" eula.txt

3. Configure server.properties

motd=My Linux Minecraft Server
max-players=10
difficulty=normal
view-distance=8
simulation-distance=8
white-list=true
online-mode=true
server-port=25565
  • online-mode=true checks that players own the game; keep it on, otherwise anyone can log in as anyone.
  • white-list=true lets in only invited players: whitelist add Nickname in the console.
  • Lower view-distance and simulation-distance if the server lags: they have the biggest influence on load.

4. Autostart with systemd

sudo tee /etc/systemd/system/minecraft.service >/dev/null <<'EOF'
[Unit]
Description=Minecraft Server
After=network.target

[Service]
User=minecraft
WorkingDirectory=/opt/minecraft
ExecStart=/usr/bin/java -Xms3G -Xmx3G -jar server.jar --nogui
Restart=on-failure
SuccessExitStatus=0 1 143

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

Give Java about 1 GB less than the free memory of the machine. To type console commands, enable RCON in server.properties (enable-rcon=true, a strong rcon.password) and use mcrcon, or run the server inside screen instead of systemd.

5. Firewall

sudo ufw allow 25565/tcp            # Ubuntu, Debian
sudo firewall-cmd --permanent --add-port=25565/tcp && sudo firewall-cmd --reload   # AlmaLinux, Fedora

At home, forward TCP port 25565 on the router to the server. Players connect to your-ip or a domain with an A record (and an SRV record if you use another port). Do not open the RCON port to the internet.

6. Backups

# /opt/minecraft/backup.sh — run daily from cron as user minecraft
mcrcon -p "$RCON_PASS" "save-off" "save-all flush"
tar -czf /opt/minecraft/backups/world-$(date +%F).tar.gz -C /opt/minecraft world world_nether world_the_end
mcrcon -p "$RCON_PASS" "save-on"
find /opt/minecraft/backups -name "*.tar.gz" -mtime +7 -delete

Keep a copy outside the server as well: a corrupted world without a backup is the most common way servers die.

Plugins and mods

  • Paper plugins (put the .jar in plugins/): LuckPerms for permissions, EssentialsX for basic commands, CoreProtect to roll back griefing, Geyser to let Bedrock players join a Java server.
  • Mods need Fabric or NeoForge on the server and the same mod set on every client; modpacks need much more RAM.

Bedrock Dedicated Server

For players on consoles, phones and Windows (Bedrock Edition), Mojang publishes a separate Bedrock Dedicated Server for Ubuntu: download the zip from minecraft.net, unpack, run LD_LIBRARY_PATH=. ./bedrock_server. It uses UDP port 19132. To serve both editions from one world, run Paper with the Geyser plugin instead.

Common problems

ProblemFix
“Unsupported class file major version”Java is too old: install Java 21 or newer
Players cannot connectCheck the firewall, port forwarding and that the server listens: ss -tlnp | grep 25565
Lag and “Can’t keep up!”Lower view and simulation distance, use Paper, give more RAM, pre-generate the world (Chunky plugin)
Server crashes with OutOfMemoryErrorRaise -Xmx, but leave memory for the system

Own server or game hosting?

Running the server at home is free, but your computer must stay on, your upload speed limits players, and opening ports exposes your home IP. A VPS or a dedicated game host keeps the world online 24/7 with a fast CPU and DDoS protection; many game hosts install Minecraft, Paper and modpacks in one click. Compare providers on the game server hosting list.

Other games with dedicated servers on Linux: AssaultCube; more games: free Linux games.

🛠️ Top Temporary VPS for Testing & Experiments (2026)

Need a fast cloud server for a few hours or days? Deploy an isolated testing environment, run your scripts, and destroy it without any monthly commitments. Secure payments via Crypto (USDT) & PayPal supported.

AÉZA — Ultimate Testing Environment • Flexible rates: from €0.01/hr depending on the billing period (the longer you rent, the cheaper it gets).
• Exclusive Welcome Bonus: Get an extra 15% on your first balance top-up within 24 hours after registration.
Deploy on Aeza
Friendhosting — High-Storage VDS • Hourly VDS infrastructure (from €0.03/hr) deployed across massive global locations.
• Best-in-class Storage VDS configurations with huge disk space for heavy data testing.
Deploy on Friend
Zomro — Premium Daily Node • Daily billing model starting at just €0.16/day (~€0.007/hr) for optimal cost control.
• High-speed hardware platform with a stable presence in the Netherlands (Europe).
Deploy on Zomro
Rork

Linux hobbyist into networking and digital privacy. I use this hub to translate and store technical notes on sysadmin tasks and anonymity tools. Tech should work for people, not the other way around.

Rate author
Add a comment