Self-host a Minecraft server on your own PC, start to finish

Java 25, first run, start script, firewall, router forwarding, the CGNAT and double-NAT tests, dynamic DNS and the sleep trap. Every home-server step.

Omne TeamUpdated Nov 17, 20269 min read

Quick answer Install Java 25 for Minecraft 26.3, run the server jar once, set eula=true, add yourself with whitelist add YourName, and join from the same PC with localhost. Then make it reachable: allow port 25565 through the PC firewall, give the PC a fixed internal address, and forward the port on the router that faces the internet. Before any of that, check whether your provider uses CGNAT, because if it does, port forwarding cannot work and everything after this is wasted effort. The overview of all three hosting options is in how to host a Minecraft server; this post is the home-network detail.

Do it, or skip it

Do it if you already know how to log into your router, the group is small, and nobody minds the world being down when you are gaming on the same PC or the power blinks. Skip it if the server must be up while your PC is off, or if nobody wants to be the person who applies updates and restarts it. At that point a rented server, ours or anyone else’s, mostly buys you someone else doing the restarts and updates. (We run Omne Hosting, so weigh that last sentence accordingly. The host comparison checklist works on any provider, including us.)

What you need

  • A PC that stays on and awake. The wiki says a budget Intel 8th-gen or Ryzen 2000-series chip is enough for a small server, that the server mostly uses one core, and that no GPU is needed [1].
  • RAM: the setup tutorial says at least 2 GB available for a small server and possibly 4 GB for larger ones [1]. The requirements page says at least 4 GB for server and operating system together [2]. The requirements page’s table says its figures are for the server application only and the operating system uses more [2].
  • Disk: at least 5 GB for the world [1]. Network: wired, because the wiki recommends against Wi-Fi [1].
  • Java 25. Minecraft 26.1 and newer need it [3], and Mojang’s metadata for 26.3 lists Java major version 25 [10].
  • A router you can log into.

Install Java with the wiki’s commands [3]:

winget install EclipseAdoptium.Temurin.25.JRE     # Windows (JRE only)
brew install --cask temurin@25                    # macOS
sudo apt install openjdk-25-jdk                   # Debian, Ubuntu, Raspbian

On Debian-based systems you can add -headless to the package name to leave out the graphical parts [3]. Check with java -version.

First run and the EULA

Download the server jar from Mojang’s server page [5], rename it server.jar, and put it in its own empty folder, because that folder will hold your config and your world [1]. Open a terminal in that folder and run:

java -jar server.jar --nogui

It stops almost at once and creates eula.txt. Open it, change eula=false to eula=true, and run the same command again. If you skip this the server shuts down immediately every time [1]. --nogui stops a graphical window opening [1]. To shut the server down cleanly, type stop in its console [1].

What you should see the second time: a stream of world-generation lines, then a line near the end that starts with Done and tells you how long startup took. Example only, your time will differ:

Done (6.4s)! For help, type "help"

A start script, and how much memory to give it

Retyping the command is how people end up running the server with the wrong flags. The wiki’s start scripts [1]:

:: start.bat (Windows)
@ECHO OFF
java -Xms1024M -Xmx2048M -jar server.jar --nogui
pause
#!/bin/sh
# start.sh (macOS, Linux). Run chmod a+x start.sh once.
cd "$(dirname "$0")"
exec java -Xms1024M -Xmx2048M -jar server.jar --nogui

-Xmx is the memory ceiling and -Xms is the starting size. The wiki says -Xmx2G is more than enough for a home server with 5 players on the default simulation distance, and to scale up from there. Setting it too low causes frequent garbage-collection stops [1]. Do not set it above the PC’s physical memory, which the wiki says can cause memory errors [1]. The pause line in the batch file keeps the window open so you can read the error when the server dies [1].

If the window flashes and vanishes on Windows, the pause line is how you read the error before it closes. The wiki’s FAQ describes this exact symptom [1].

Add yourself, then join from the same PC

Since 26.3 the white-list property defaults to true [4], so a new server turns you away, including you. In the server console:

whitelist add YourUsername

Then start Minecraft, choose Multiplayer, Direct Connection, and enter localhost [1]. Everything below is pointless until this works. If it does not, see Failed to bind to port for startup errors, and the whitelist guide for the rejection. The defaults table and the other first-day settings are in the hosting overview, so I will not repeat them here.

Make it reachable: firewall, fixed address, router

Forwarding fails for three reasons, in roughly this order: the PC firewall blocks Java, the PC’s internal address changed so the rule points at nothing, or the rule is on the wrong router.

  1. Open the port on the PC. The default is 25565, and the server listens on a TCP port [4]. On Windows, the first run shows a firewall prompt for “OpenJDK Platform binary”; if you allow it, Windows manages the rule for you [1]. On Linux with ufw, sudo ufw allow 25565/tcp then sudo ufw status [8][9].
  2. Give the PC a fixed internal address. Routers hand out internal addresses by DHCP, and when the address changes the forwarding rule becomes invalid. Setting a static internal address is done differently on each router, so use your router’s manual [1]. Find the current address with ipconfig (the IPv4 address line, Windows) or ip address (Linux) [1].
  3. Forward the port. Log into the router (its address is the Default Gateway in ipconfig) and create a rule from port 25565 to the PC’s internal address on the same port. Use TCP/UDP or Both; if the router only offers one at a time, make two rules [1]. The wiki points to portforward.com for router-specific menus [1].
  4. If you have two routers, plug the server into the one that faces the internet. Forwarding from a nested router sends everything to the parent router, so you must forward there too [1].

Test it from outside

Leave the server running and test with a port checker, which only reports the port open while the server is up [1]. Better, have a friend join using your public address, which a “what is my IP” search shows [1]. For your own troubleshooting the wiki says you can connect from the server machine through localhost, the internal address (192.168.x.x) or the external address [1].

The quiet killers: CGNAT and double NAT

Forwarding assumes your router owns a public address. Two things break that, and they need different fixes.

CGNAT. Many providers share one public address across customers. RFC 6598 reserves 100.64.0.0/10 (100.64.0.0 through 100.127.255.255) as shared address space for carrier-grade NAT equipment, and says it is not globally routable [6]. A forwarding rule on your router cannot receive internet connections through that. Look at the WAN or Internet address on your router’s status page. If it starts with 100.64 through 100.127, that is your answer. Your options are to ask the provider whether you can get a public address (the wiki says static IPs usually cost an extra monthly fee [1], but I did not verify that one gets you out of CGNAT, so ask), use a VPN-style overlay, or move the server to a VPS or managed host.

Double NAT. If your WAN address is a private one such as 192.168.x.x, your ISP’s modem is acting as a router in front of yours. The wiki’s fix is to log into the modem/router the provider issued and forward the port there to your router’s WAN address [1]. A WAN address that merely differs from a “what is my IP” site does not tell you which of the two you have, so read the address itself.

The wiki lists three VPN-style options, Hamachi, Radmin VPN and ZeroTier, where every player installs the same client and joins a virtual network. It warns that this is inconvenient for players, and that a ZeroTier network set to Public lets anyone join it [1]. I have not tested any of them.

Your public address will change

Most home connections have a dynamic public address, and the wiki says it typically changes every few days to few weeks [1]. A dynamic DNS service gives you a name that follows the address; the wiki names NoIP as one that provides a free subdomain [1]. Without it, your friends’ saved address quietly stops working. Once you have a name, use an SRV record if you changed the port, per pointing a domain at your server.

Keep a PC awake, and know what it costs

Sleep. A PC that is asleep is not running your server. In Windows 11 (24H2 and 24H1 or earlier alike) the timers are under Settings, System, Power and battery, Screen and sleep; Windows 10 uses System, Power and sleep [7]. Microsoft’s page only describes the on-battery timers, so I cannot tell you from it what the plugged-in options are called. Check what your PC offers and set the sleep timers so a plugged-in server never sleeps.

Electricity. Watts times 24 hours times 30 days, divided by 1000, gives kilowatt-hours a month; multiply by your rate. Example arithmetic only: a machine drawing 60 W is 60 x 24 x 30 / 1000 = 43.2 kWh a month. Measure your own PC’s draw with a plug-in meter rather than guessing.

Security for a port open to the internet

Forwarding a port exposes that service to the whole internet. The wiki’s current list [1]:

  • Keep the whitelist on. It only works properly with online-mode on, because offline mode lets a player type a whitelisted name [1].
  • Griefers scan public addresses for the default port. Use another port if you want, or set enable-status=false, which makes the server look offline in status checks while it still accepts connections [1][4].
  • Do not run the server as a super-user, and open only the ports you need.
  • Update the server regularly, take backups (how to automate them), and review plugins and mods for known vulnerabilities [1].

When friends still cannot join

The error text tells you where to look [1]:

  • Connection timed out: a firewall is ignoring the attempt. Allow Java through the PC firewall, or fix the port forward.
  • Connection refused: nothing is listening. The server has not started properly, or the router’s firewall was switched off instead of forwarding.
  • “Failed to bind to port!” at startup: usually an address typed into server-ip; leave it blank [1][4]. Otherwise the port is in use or you lack permission to use it [1].

The wiki also advises against ports below 1024 and ones used by common services such as 22, 80 and 443, because some providers block them [1].

What I checked, and what I did not

Checked against Minecraft 26.3 (Mojang’s version JSON lists Java 25) on 2026-11-17, from the pages cited. I have not run these steps on a fresh machine for this update, I did not test any VPN overlay, and I did not read Mojang’s EULA text. The Done line is an example, not captured output. A 26.4 snapshot exists, and I did not check what it changes. Router menus differ by model and I cannot tell you where yours puts things.

Questions people ask

Do I need a powerful gaming PC?

No. The wiki says no GPU is needed and that a budget Intel 8th-gen or Ryzen 2000-series chip is enough for a small server. It also says the server mostly uses one core, so single-thread speed matters more than core count.

Can I just close my laptop and leave it running?

No. A PC that is asleep is not running the server. Check the sleep timers in Windows under Settings, System, Power and battery, Screen and sleep, and keep the machine plugged in.

Do I have to accept anything from Mojang?

Yes. The first run creates eula.txt, and the server shuts down until you set eula=true. Downloading the server software also means agreeing to Mojang's EULA. If players will pay you, read the EULA's commercial terms first; this post did not.

Why can friends not join even though I forwarded the port?

The usual causes are the PC firewall, a changed internal address, a second router in front of yours, or CGNAT at your provider. The troubleshooting section below tells them apart by the error message.

Sources

  1. Tutorial: Setting up a Java Edition server (Minecraft Wiki)
  2. Server requirements (Minecraft Wiki)
  3. Tutorial: Update Java (Minecraft Wiki)
  4. server.properties (Minecraft Wiki)
  5. Download the Minecraft: Java Edition server (minecraft.net)
  6. RFC 6598: IANA-Reserved IPv4 Prefix for Shared Address Space
  7. Battery saving tips for Windows (Microsoft Support)
  8. Firewall, ufw (Ubuntu Server documentation)
  9. ufw(8) manual page (Ubuntu 24.04)
  10. Minecraft 26.3 version JSON (Mojang launcher metadata)