Skip to content

How to Install and Set Up a Minecraft Server on Linux

Updated 7 min read

Updated: 12 October 2026 · Applies to: Minecraft: Java Edition server 26.3 with OpenJDK 25.0.4 on Ubuntu 26.04 and 24.04, Debian 13, AlmaLinux and Rocky Linux 9 and 10; Bedrock Dedicated Server 1.26.52.3 on Ubuntu 26.04

Yes, you can run a Minecraft server on Linux. The Java Edition server is a single Java program: install Java 25, download server.jar, accept the EULA, start it and open TCP port 25565. The steps below were tested on Ubuntu 26.04 and 24.04 with the current release, 26.3, including a systemd service that starts the server at boot; the commands for Debian, AlmaLinux and Rocky Linux are given where they differ. Bedrock Edition has its own section at the end.

What you need

  • A 64-bit Linux server (VPS or dedicated) with SSH access and a user with sudo rights.
  • Memory: the minecraft.net download page starts the Java server with -Xmx4G -Xms4G (4 GB). A small world for a few friends needs less, more players or mods need more: see give a Minecraft server more RAM.
  • Java 25 (step 1) and one open port, TCP 25565.

Which Linux is best for a Minecraft server?

  • Java Edition: any current 64-bit distribution that packages Java 25 works. Ubuntu 24.04 and 26.04 LTS, Debian 13, AlmaLinux and Rocky Linux 9 and 10 all ship OpenJDK 25.0.4 in their own repositories. Ubuntu LTS and Debian have the most community guides; AlmaLinux or Rocky Linux suit you if you already run the RHEL family. Use a server install without a desktop.
  • Bedrock Edition: Mojang’s Bedrock Dedicated Server for Linux “requires Ubuntu 22.04 (LTS version) or later. Other distributions are not supported”, and it needs an Intel or AMD processor. Use Ubuntu for Bedrock.

1. Install Java 25 and tmux

sudo apt install openjdk-25-jre-headless tmux          # Ubuntu, Debian
sudo dnf install java-25-openjdk-headless tmux         # AlmaLinux, Rocky Linux, RHEL

Ask for Java 25 by name. On Debian 13 and Ubuntu 24.04, default-jre-headless installs Java 21 (only Ubuntu 26.04 defaults to 25), and Java 21 cannot start Minecraft 26.3:

Error: LinkageError occurred while loading main class net.minecraft.bundler.Main
	java.lang.UnsupportedClassVersionError: net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 69.0), this version of the Java Runtime only recognizes class file versions up to 65.0

If you see that, install Java 25 and check with java -version (ours printed openjdk version "25.0.4.1"). With several Java versions installed, pick 25 with sudo update-alternatives --config java (Debian, Ubuntu) or sudo alternatives --config java (RHEL family). More: install Java (OpenJDK) on Ubuntu and Debian. We use tmux because screen is not in the AlmaLinux and Rocky Linux 9 and 10 repositories.

2. Create a user and download the server

Do not run the server as root:

sudo useradd -m -s /bin/bash minecraft
sudo -iu minecraft
mkdir server && cd server

Open the Java Edition server download page, copy the link of the server .jar and download it:

curl -o server.jar "PASTE-THE-LINK-HERE"

3. First start and the EULA

java -Xms1G -Xmx1G -jar server.jar nogui

The first start creates the files and stops. A Java stack trace about loading server.properties is normal on this run, because the file does not exist yet; the last lines are:

[ServerMain/WARN]: Failed to load eula.txt
[ServerMain/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.

Accept the Minecraft EULA and check the main settings:

sed -i "s/eula=false/eula=true/" eula.txt
grep -E "white-list|server-port|max-players|gamemode|difficulty|online-mode" server.properties

A new 26.3 server has server-port=25565, max-players=20, gamemode=survival, difficulty=easy, online-mode=true and white-list=true. Change them in server.properties with any editor while the server is stopped.

4. Start the server in tmux

tmux new -s mc
java -Xms2G -Xmx2G -jar server.jar nogui

On the first full start the server generates the world, which takes a while. It is ready when the console prints Done. From our test:

[Server thread/INFO]: Starting minecraft server version 26.3
[Server thread/INFO]: Starting Minecraft server on 127.0.0.1:25565
[Server thread/INFO]: Done (141.983s)! For help, type "help"

That lab run had 1 GB of Java memory on a small, shared test machine, so expect a different time on your server. We also set server-ip=127.0.0.1 to keep the lab private; leave server-ip empty on your server so players can reach it.

Detach with Ctrl+B then D; the server keeps running after you log out. Reattach with tmux attach -t mc. To shut down, type stop in the console, so the world is saved first. Set -Xmx below the server’s total RAM so the operating system keeps some memory, for example 3G on a 4 GB server.

5. Add players to the allowlist

Since 26.3, white-list is true by default (Mojang’s 26.3 changelog), so nobody can join until you add them. In the server console:

whitelist add YourName
whitelist add FriendName
op YourName

To let anyone join, set white-list=false and restart, but on a public server the allowlist is safer. More console commands: Minecraft server commands.

6. Open the port and connect

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

Players connect to the server’s IP address, or a domain name pointing to it; the port is only needed in the address if you change it from 25565. See open port 25565 and port forwarding and find your server IP and port.

7. Start the server automatically at boot (systemd)

Stop the server you started by hand (type stop), exit the tmux session and leave the minecraft user with exit. Then create /etc/systemd/system/minecraft.service as root:

[Unit]
Description=Minecraft server
After=network-online.target
Wants=network-online.target

[Service]
Type=forking
User=minecraft
WorkingDirectory=/home/minecraft/server
ExecStart=/usr/bin/tmux new-session -d -s mc /usr/bin/java -Xms2G -Xmx2G -jar server.jar nogui
ExecStop=/usr/bin/tmux send-keys -t mc stop Enter
ExecStop=/bin/sh -c 'while /usr/bin/tmux has-session -t mc 2>/dev/null; do sleep 1; done'
TimeoutStopSec=90

[Install]
WantedBy=multi-user.target

Enable and start it:

sudo systemctl daemon-reload
sudo systemctl enable --now minecraft
sudo systemctl status minecraft

The console stays available: sudo -u minecraft tmux attach -t mc (detach with Ctrl+B, D). sudo systemctl stop minecraft types stop into the console and waits for the save: in our Ubuntu 26.04 test the log showed Saving worlds and systemd reported Deactivated successfully. Run sudo systemctl daemon-reload after editing the unit. On AlmaLinux and Rocky Linux, check the paths with command -v java tmux first.

Keep it running and up to date

  • Backups: copy the world folder regularly, with the server stopped or after save-off (then save-on).
  • Updates: stop the server, back up, replace server.jar with the new version and start it again.
  • One tool for start at boot, updates and monitoring: LinuxGSM.
  • Better performance and plugins: Paper runs the same worlds; compare the options in Vanilla, Paper, Fabric, NeoForge and Bedrock and see how to reduce lag.

Install a Bedrock Dedicated Server on Ubuntu

Bedrock Edition (phones, consoles and Windows) needs Mojang’s separate Bedrock server, which does not use Java.

  1. Install unzip with sudo apt install unzip, switch to the minecraft user (sudo -iu minecraft), then download the Ubuntu (Linux) zip from the Bedrock server download page (we tested 1.26.52.3) and unpack it:
    mkdir ~/bedrock && cd ~/bedrock
    curl -o bedrock-server.zip "PASTE-THE-LINK-HERE"
    unzip bedrock-server.zip
  2. Check server.properties: 1.26.52.3 starts with allow-list=true, max-players=10 and server-port=19132.
  3. Start it inside tmux so it keeps running after you log out (the start command is the one in Mojang’s included bedrock_server_how_to.html):
    tmux new -s bds
    LD_LIBRARY_PATH=. ./bedrock_server
    In our lab it created the world and printed Accepting clients on [::]:19132.
  4. Open the ports. With the default transport=nethernet, our server listened on TCP 19132 and used a random UDP port for clients; fix the UDP range with server-udp-ports (the file’s example is 49152-49200) and open it as well. Details: Minecraft server ports.

The Bedrock server needs internet access to Minecraft services: our offline lab server stopped with Could not connect to Minecraft services. This is required to accept connections in online mode.

Prefer not to manage it yourself? A Ucartz Minecraft VPS runs Java or Bedrock with DDoS protection, and our engineers install the Minecraft server with standard settings free of charge and add you as an operator. On your own computer instead: the Windows and Mac guides; all options compared: Realms, your own PC, a VPS or a dedicated server.

Official documentation: Bedrock Dedicated Server and Minecraft Java Edition 26.3 changelog.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Linux server management

hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.

Was this answer helpful?

Still stuck? Open a ticket