How to Host Your Own Minecraft Server (Java & Bedrock, Step by Step)
Java, Paper and Bedrock Dedicated Server set up from scratch, port forwarding explained without the jargon, and the tunnelling trick for South African ISPs that use CGNAT.
The short answer
- Java Edition
- Install Java 21, download Paper (or the vanilla server jar), accept the EULA, run it, forward TCP 25565 or use a tunnel.
- Bedrock Edition
- Download Bedrock Dedicated Server from minecraft.net, run it, forward UDP 19132 or use a tunnel.
- Both at once
- Run Paper and add the Geyser plugin. Bedrock players connect on 19132, Java on 25565, same world.
- The South African catch
- Many fibre ISPs use CGNAT, which makes port forwarding impossible. playit.gg or a public-IP add-on from your ISP fixes it.
- Time needed
- About 20 minutes for a working local server, plus however long your router takes to co-operate.
On this page
Before you start
This guide gets a server running on a machine you control — your own PC, a spare laptop, or a VPS you have rented. If you have not decided between those and a paid host, the hosting comparison comes first. You need:
- A machine with at least 4 GB of RAM free beyond whatever else it is doing. If you also want to play on the same PC, 16 GB total is comfortable.
- An ethernet connection to your router if at all possible. A server on Wi-Fi gives every player the jitter of your Wi-Fi.
- About 500 MB of disk to begin with; worlds grow by a few gigabytes over a year of play.
- An ordinary Minecraft account for yourself. The server software itself is free.
Java Edition: step by step
- Install Java 21. Minecraft 1.20.5 and later, including 1.21, need Java 21. Download a build from Adoptium (Eclipse Temurin) or Microsoft’s OpenJDK — either is free. On Windows, run the installer and tick the option to set the
JAVA_HOMEvariable. Confirm by opening a terminal and typingjava -version; it should print 21. - Download the server. For most people that means Paper from papermc.io: pick the version matching what your players run and download the latest build. It is a faster, plugin-capable replacement for the official jar and behaves identically to vanilla for players. If you want unmodified vanilla, the official
server.jaris on minecraft.net under Download → Server. - Make a folder. Something like
C:\mcserveror~/mcserver. Put the jar in it, renamed toserver.jarfor convenience. Everything the server creates will live here, so keep it out of your Downloads folder. - Create a start script. On Windows, make
start.batin the folder containing:
On macOS/Linux,@echo off java -Xms2G -Xmx4G -jar server.jar nogui pausestart.shwith the same java line and nopause, thenchmod +x start.sh.-Xmx4Gis the maximum RAM; set it to what you can spare, and never to all of the machine’s memory. - Run it once and accept the EULA. The first run stops almost immediately and writes
eula.txt. Open it, changeeula=falsetoeula=true, save. This is you agreeing to Mojang’s server terms. - Run it again. The server generates a world, which takes a minute or two, and finishes with
Done (…s)! For help, type "help". It is now running. Typestopin that window to shut it down cleanly — never just close the window, which can corrupt the world. - Connect from the same PC. Open Minecraft, Multiplayer, Add Server, address
localhost. If that joins, the server works and the rest is networking. - Connect from another device in the house. Find the server PC’s local IP (
ipconfigon Windows, look for IPv4 Address — usually192.168.x.x) and use that as the address on the other device. If this works and the previous step worked, the server is fully functional on your LAN.
The settings worth changing
Stop the server and open server.properties in a text editor. Most of it can stay at the default; these are the lines that matter.
| Setting | Default | What to do |
|---|---|---|
online-mode | true | Leave true. It makes the server verify accounts with Mojang, which stops anyone joining under someone else’s name. Setting it false lets cracked clients in and disables skins. |
view-distance | 10 | The single biggest performance lever. 8 is plenty and halves the load compared with 12. Players’ own render distance is capped at this. |
simulation-distance | 10 | How far from players the world actually ticks (crops, mobs). 6–8 is fine for most servers. |
max-players | 20 | Set to what your RAM supports; it is a cap, not an allocation. |
difficulty | easy | normal is what most survival servers want; hard for hunger damage and harder mobs. |
white-list | false | Set true for a private server, then add names with whitelist add Name. This is how you keep a friends-only server friends-only. |
motd | A Minecraft Server | The text shown in the server list. Keep it short. |
enable-command-block | false | True only if you use command blocks for builds or minigames. |
spawn-protection | 16 | Radius around spawn that non-ops cannot build in. Set to 0 on a small friends server or it gets in the way. |
level-seed | blank | Set before the first run if you want a specific seed. Changing it afterwards does nothing to the existing world. |
Paper adds its own files in the config folder; the defaults are sensible and the one thing worth knowing about is that paper-world-defaults.yml is where per-world performance tuning lives if you ever need it.
Bedrock Dedicated Server
Bedrock players on phones, consoles and Windows cannot join a Java server directly. If everyone in your group is on Bedrock, run Mojang’s Bedrock Dedicated Server instead. It is a free download from minecraft.net (Download → Server → Bedrock), available for Windows and Ubuntu Linux, and it is lighter than the Java server.
- Unzip the download into its own folder.
- Windows: run
bedrock_server.exe. Linux:LD_LIBRARY_PATH=. ./bedrock_server. There is no Java involved. - Edit
server.properties:server-name,gamemode,difficulty,max-players, and leaveonline-mode=true. - To limit who can join, set
allow-list=trueand add players toallowlist.jsonby gamertag. - Players add the server under Servers → Add Server with your address and port 19132. Console players cannot type a custom address in the normal UI; the workaround is a DNS trick or the BedrockTogether app, covered in the crossplay guide.
Bedrock Dedicated Server has no plugin system in the Java sense; add-ons and behaviour packs are how it is customised. If you want plugins, the crossplay setup below is the better path even for an all-Bedrock group.
Crossplay with Geyser
To let Java and Bedrock players share one world, run a Paper server and install two plugins: Geyser, which translates the Bedrock protocol into Java on the fly, and Floodgate, which lets Bedrock players join with their Xbox account instead of needing a separate Java account. Drop both jars into the plugins folder and restart. Geyser listens on UDP 19132 by default, so you open that port in addition to TCP 25565. Bedrock players then connect to the same address on port 19132 and appear in the world alongside Java players. The crossplay guide explains what does and does not translate cleanly.
Letting people in: port forwarding and CGNAT
Everything above works on your home network. For people outside the house, incoming connections have to reach the server PC through your router, and there are two very different situations depending on your ISP.
Check first: do you have a public IP?
Log into your router (the address is on its label, commonly 192.168.0.1 or 192.168.1.1) and find the WAN or Internet IP address. Compare it with what a site like whatismyip.com shows from a browser on the same connection.
- They match, and the router address does not start with
10.or100.— you have a public IP. Port forwarding will work. - They differ, or the router shows an address in
100.64.0.0–100.127.255.255or10.x.x.x— you are behind CGNAT. Port forwarding cannot work, no matter how carefully you set it up, because the address you are forwarding on is not reachable from the internet. Skip to the tunnel section.
Port forwarding (public IP)
- Give the server PC a fixed local IP. Either reserve it in the router’s DHCP settings by MAC address (best) or set a static IP on the PC.
- In the router, find Port Forwarding (sometimes under NAT, Virtual Server or Applications). Add a rule: external port
25565, internal port25565, protocol TCP, internal IP = the server PC. For Bedrock or Geyser add a second rule for19132UDP. - Allow the port through the PC’s own firewall. Windows usually prompts the first time the server runs; if you clicked Cancel, add an inbound rule for Java manually.
- Give players your public IP. Because most home IPs change occasionally, set up a free dynamic DNS name (No-IP, DuckDNS, or your router’s built-in DDNS) so the address stays constant.
Tunnelling (CGNAT, or when you would rather not touch the router)
A tunnelling service runs a small program on the server PC that keeps an outbound connection open to the service’s own servers; players connect to an address the service gives you, and traffic is relayed through the tunnel to your PC. Because the connection is outbound from your side, CGNAT and firewalls are irrelevant. playit.gg is built specifically for game servers and has a free tier that is enough for a friends server; ngrok and Cloudflare Tunnel can do the same with more setup. Install the agent, create a Minecraft Java (or Bedrock) tunnel, and it gives you a hostname to share. Expect a few milliseconds of added latency, and check which relay region you land on — one in Europe adds more.
The other CGNAT fix is to ask your ISP for a public or static IP. Several South African fibre ISPs offer it as a monthly add-on, and some will move you off CGNAT for free if you ask support. Then port forwarding works as above.
Do not put the server in the DMZ
Some guides suggest the router’s DMZ option as a shortcut. It exposes every port on that PC to the internet. Forward the one or two ports you need instead.
Running it on Linux or a VPS
If you rented a VPS — say in Azure South Africa North or AWS Cape Town, as discussed in the hosting guide — the steps are the same with two additions: the server needs to survive you logging out, and it should restart itself after a crash. On Ubuntu:
sudo apt update && sudo apt install -y openjdk-21-jre-headless
sudo useradd -r -m -d /opt/minecraft minecraft
sudo -u minecraft mkdir -p /opt/minecraft/server
# put server.jar in /opt/minecraft/server, run once, accept the EULA, then:
sudo tee /etc/systemd/system/minecraft.service >/dev/null <<'EOF'
[Unit]
Description=Minecraft server
After=network.target
[Service]
User=minecraft
WorkingDirectory=/opt/minecraft/server
ExecStart=/usr/bin/java -Xms2G -Xmx3G -jar server.jar nogui
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now minecraft
sudo ufw allow 25565/tcp
On a 4 GB VPS, leave about a gigabyte for the operating system — hence -Xmx3G. Open the same port in the cloud provider’s own firewall or security group as well; the OS firewall alone is not enough on Azure or AWS. To type commands into a systemd-managed server you need a console: the simplest approach is to run it inside tmux instead of systemd, or install a lightweight panel. For backups, a nightly tar of the world folder copied off the machine is the minimum.
Admin basics: ops, whitelist, backups
- Make yourself an operator by typing
op YourNamein the server console. Ops can run every command. Give it to as few people as possible. - Whitelist for a private server:
whitelist on, thenwhitelist add Namefor each friend. On a public server, keep it off and rely on moderation plugins. - Backups. The world is the folder named in
level-name(defaultworld, plusworld_netherandworld_the_endon Paper). Copy it while the server is stopped, or usesave-off, copy,save-onwhile it runs. Do it before every plugin change and every game update. - Updating. Back up, stop, replace
server.jarwith the new version, start. Players must be on a matching version; Paper accepts the same client versions as vanilla. - Essential plugins for a friends server on Paper: a land-claiming plugin, a homes/teleport plugin, and a backup plugin. Resist adding fifty. Each one costs performance and is a potential update-day breakage.
- Watch TPS. Type
tpsin the Paper console. 20 is perfect; sustained values under 18 mean the machine is struggling, and lowering view distance is the first fix.
Frequently asked questions
What version of Java do I need for a Minecraft server?
Minecraft 1.20.5 and newer, including 1.21, require Java 21. Older versions need Java 17 (1.17–1.20.4) or Java 8 (1.16 and earlier). Install the version that matches the server jar you are running.
Which port does a Minecraft server use?
Java Edition uses TCP port 25565 by default. Bedrock Dedicated Server uses UDP port 19132. If you run Geyser for crossplay, you open both.
Why can nobody connect to my server even though I forwarded the port?
Almost always CGNAT: your ISP has not given your router a public IP address, so the forwarded port is unreachable from the internet. Check the WAN IP on your router — if it starts with 100.64–100.127 or 10., you are behind CGNAT. Use a tunnelling service such as playit.gg or ask your ISP for a public IP.
Should I use vanilla or Paper?
Paper for almost everyone. It is a drop-in replacement for the vanilla server that runs faster, fixes long-standing bugs and supports plugins. Use vanilla only if you specifically want unmodified game behaviour, and Fabric or Forge if you want mods.
How do I make friends admins?
Type op PlayerName in the server console, or /op PlayerName in game if you are already an operator. Use it sparingly; operators can do anything, including deleting the world.
How do I keep the server running after I close the terminal?
On Windows, leave the window open or use a batch file with a restart loop. On Linux, run it as a systemd service or inside tmux/screen so it survives disconnecting from SSH and restarts on a crash.
Players getting errors?
Send them to the connection error guide — it covers every message they are likely to see, from the server owner’s side as well as theirs.
Read next
How to Get Lower Ping in Minecraft from South Africa
Why South African ping is high on most servers, the three different things people call “lag”, the fixes that genuinely work, and the honest answer on gaming VPNs.
Fix Every Common Minecraft Connection Error (Java & Bedrock)
Connection timed out, connection refused, UnknownHostException, outdated client, invalid session, “unable to connect to world” — what each one means and the fix that works.
How to Boost FPS in Minecraft: Settings, Mods and Fixes That Work
The in-game settings that cost the most frames, the Sodium/OptiFine question settled, RAM allocation done properly, and Bedrock-specific fixes for phones and consoles.