How to Self-Host a Minecraft Server

Run the server on your own machine: install Java, accept the EULA, start the JAR, and understand the four things a home server owes you before friends can join.

Written by
Mihail Griniuc
Last updated
Checked against
Vanilla 1.21.11 and Paper 1.21.11 on Java 21, Linux and Windows
Reading time
3 min

Short answer

Install Java 21, download the server JAR, accept the EULA by setting eula=true, then run java -Xmx2G -jar server.jar nogui. The server runs on your machine; making it reachable from the internet needs port forwarding.

Self-hosting is the way to run a server with no hosting account, no sleep timer and no monthly bill. It is also the way to keep a computer switched on forever and to expose your home connection to anyone who joins.

That trade is worth it when you want control: mods, forks, custom worlds, no slot limit. This guide gets the server running on your machine. It stops short of opening it to the internet, because that is a separate decision with separate steps.

Before you start

  • A machine with at least 2 GB of memory spare and a decent CPU
  • Java 21 or newer installed
  • A stable internet connection, and a willingness to leave the machine on

1. Install Java 21

Current Minecraft versions need Java 21. Most Linux distributions can install it from their package manager, and Windows and macOS installers come from Adoptium or your operating system vendor.

Check what you have before you download a JAR, because a missing or wrong Java version is the most common reason a server exits immediately with no useful message.

Debian and Ubuntu
sudo apt update && sudo apt install -y openjdk-21-jre-headless
java -version
Fedora
sudo dnf install -y java-21-openjdk-headless
java -version
Windows and macOS, with Adoptium installed
java -version
# openjdk version "21.0.x" is what you want to see

2. Create a folder and accept the EULA

Put the server JAR in its own folder, and run it once from there. The first run stops immediately and writes eula.txt: Mojang's terms require you to accept them, and the server will not start until you say you have.

Read the file, then set eula=true in it. Everything the server creates from here on lives in that folder, so the folder is the server.

the folder, then the first run
mkdir -p ~/minecraft-server && cd ~/minecraft-server
# download server.jar from minecraft.net/download/server (the link updates with each release)
java -Xmx2G -jar server.jar nogui
the official manifest, if you prefer to fetch it yourself
curl https://launchermeta.mojang.com/mc/game/version_manifest_v2.json
eula.txt, after reading it
#By changing the setting below to TRUE you are indicating your agreement to the EULA.
eula=true

3. Start it and wait for Done

Start the server again. The first run generates a world, which takes longer than later starts. When the console prints Done (...)! For help, type "help", the server is running and listening.

The server runs in the foreground, so closing the terminal stops it. For anything longer than an evening, put it behind a service manager: running with systemd is the version that restarts on crash and starts on boot.

starting the server
java -Xms2G -Xmx2G -jar server.jar nogui

4. Test it on your own network first

Before touching the router, prove the server works: on the same machine, join localhost from the Minecraft client, and from another device on the same Wi-Fi join your local IP address. Both should work with no configuration at all.

This isolates the server from the network. If it fails locally, the problem is the server; if it works locally but not from your phone's mobile data, the problem is the network, and that is the port-forwarding step.

addresses to try, in the Minecraft client
localhost      the same machine as the server
127.0.0.1     the same, written as an IP
192.168.x.x   your machine on the local network (find it with "ip addr" or "ipconfig")
  • Windows: ipconfig prints the IPv4 address of the network adapter.
  • Linux: ip addr prints the address of each interface.
  • macOS: ipconfig getifaddr en0 prints it for Wi-Fi.

5. Know what hosting at home actually costs

Once it works, the honest accounting: the machine stays on, your upload speed becomes the connection limit for every player, and your home IP is what strangers connect to. A 100 Mbps download does nothing for a server; uploads are usually a fraction of that.

That is where a hosted server earns its place. Making a free server covers the alternative for a group that just wants to play, and this guide is the right one when you need mods or control over the software.

Before you commit, check your upload speed with a measurement, not the number on the package. A 10 Mbps upload comfortably carries a handful of players on one core; a 1 Mbps upload does not carry a modded world at all, whatever your download speed says.

Good to know

  • On macOS and Windows, Gatekeeper and the firewall both ask about the first Java process. Allow it, or the server will start and no one can reach it.
  • Back up the whole folder, not the world folder alone. Backing up has what a usable backup contains.
  • A Raspberry Pi is not a Minecraft server. It will start and it will stutter; the CPU is the wrong shape for the job.
  • Port forwarding is the next step once it works locally, and it is the one that decides whether the server is private to your house or open.

Common questions

What do I need to run a Minecraft server?

Java 21, about 2 GB of memory spare for a small world, and a decent CPU. The server JAR is free from Mojang or from PaperMC for the fork. Players need the same Minecraft version and nothing else.

Why will my server not start?

Most often the EULA: the server writes eula.txt and exits until eula=true is set. Second most often the Java version, which the console usually names. Third is running out of memory, which appears as OutOfMemoryError in the log.

Can I play on the same machine as the server?

Yes, and you should test that way first: join localhost from the client on the same machine. It is the quickest way to prove the server itself is working before you touch the network.

Is self-hosting cheaper than a hosting provider?

The bill is zero, but the cost is electricity, a machine that never sleeps, and your upload bandwidth. For a group that plays a few hours a week, a free hosted server is less work; self-hosting earns its place when you need mods or control over the software.

Can I run a Paper server the same way?

Yes, with Paper's JAR in place of the vanilla one and the same command. The only difference on first run is that Paper writes its own configuration files and supports plugins. Installing Paper covers the fork-specific parts.

Sources

Official documentation this guide was checked against.

Written and maintained by Mihail Griniuc. Last reviewed against Vanilla 1.21.11 and Paper 1.21.11 on Java 21, Linux and Windows. Spotted a mistake or something out of date? Email [email protected].

Revision history
  • Rewritten as install, EULA, start, local test, with the home-hosting costs stated before the port-forwarding step.

Rather not run this on your own machine? PufferHost gives every player a free Minecraft server with 3 GB of RAM and 10 slots. Create a free server.