How to Create a Minecraft Server: Step-by-Step Setup Guide

Creating your own Minecraft server gives you complete creative freedom. Whether you want a private SMP world to explore survival with friends, a custom factions and skyblock realm, or a public network welcoming hundreds of simultaneous players, setting up a dedicated Minecraft server is straightforward once you understand the core components.

In this comprehensive, step-by-step tutorial, you will learn how to prepare your environment, install the correct Java runtime, choose high-performance server software (PaperMC), configure server.properties for optimum stability, optimize RAM allocation with Aikar's flags, open port 25565, and list your server on the Top4Games Minecraft server list to build a thriving community.

1. System Requirements & Architecture Overview

Minecraft server software is primarily single-threaded for main game tick loops (entity calculations, redstone updates, chunk ticking). Having high single-core CPU frequency matters much more than having many slow cores.

Scale Player Count Recommended RAM Recommended CPU & Disk
Small SMP 2 – 10 players 4 GB RAM 2+ Cores (3.0 GHz+), SSD Storage
Medium Community 10 – 40 players 8 GB – 12 GB RAM 4 Cores (3.8 GHz+), NVMe SSD
Large / Modded Network 40+ players or heavy plugins 16 GB+ RAM Dedicated Ryzen / Intel Core (4.5 GHz+), NVMe SSD

2. Choose Your Server Software: Why PaperMC?

While Mojang provides an official Vanilla server JAR, running Vanilla on a multiplayer server often leads to severe tick lag (TPS dropping below 20). Here are the standard options:

  • PaperMC (Recommended): The undisputed gold standard for multiplayer servers. Paper fixes hundreds of vanilla exploit bugs, optimizes redstone/hopper mechanics, parallelizes asynchronous chunk loading, and supports thousands of Spigot/Bukkit plugins.
  • Purpur: A lightweight fork of Paper providing even deeper customization of mob AI, gameplay mechanics, and entity stacking.
  • Fabric: Best if you want a modded server (using mods like Lithium and FerriteCore) while staying true to vanilla technical mechanics.
  • Vanilla: Unoptimized official release. Only suitable for tiny 2-player testing environments.

3. Step 1: Install the Correct Java Runtime (Java 21 LTS)

Modern Minecraft releases (Minecraft 1.20.5 and newer, including 1.21+) require Java 21 LTS or newer. Running an outdated Java version (such as Java 8 or Java 17) will trigger an immediate UnsupportedClassVersionError crash.

On Ubuntu / Debian (Linux):

# Update package list
sudo apt update && sudo apt upgrade -y

# Install OpenJDK 21 headless
sudo apt install openjdk-21-jre-headless -y

# Verify installation
java -version

You should see output confirming openjdk version "21.x.x".

On Windows:

  1. Download the Windows x64 MSI Installer for OpenJDK 21 from Eclipse Adoptium (Temurin 21).
  2. Run the installer and make sure "Set JAVA_HOME variable" and "Add to PATH" are checked.
  3. Open Command Prompt (cmd) and run java -version to confirm.

4. Step 2: Create Server Directory & Download PaperMC

It is best practice to keep your Minecraft server in its own dedicated folder. On Linux, run the server under a dedicated system user (e.g., minecraft) rather than root for security.

# Create dedicated directory
mkdir -p /home/minecraft/server
cd /home/minecraft/server

# Download the latest Paper 1.21 build (or your desired version)
# You can visit https://papermc.io/downloads/paper for the direct download link
wget -O paper.jar https://api.papermc.io/v2/projects/paper/versions/1.21.1/builds/132/downloads/paper-1.21.1-132.jar

5. Step 3: Initial Run & Accept the EULA

When running a Minecraft server for the first time, it generates the basic configuration files and immediately stops because Mojang requires you to agree to their End User License Agreement (EULA).

# Run initial startup
java -jar paper.jar --nogui

The console will stop with the message: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.

Open eula.txt in a text editor (e.g. nano eula.txt) and change:

eula=false

to:

eula=true

Save and close the file.

6. Step 4: Configure server.properties

The server.properties file contains all primary settings for your server. Open it with nano server.properties and adjust the critical parameters:

Setting Recommended Value Description
server-port 25565 Default TCP port used by Minecraft Java Edition clients to connect.
motd \u00A76My Top4Games Server \u00A77- \u00A7eSurvival SMP Message of the Day shown in player server browser lists (supports color codes).
online-mode true Verifies player accounts with Mojang/Microsoft auth servers to prevent cracked/impersonation logins.
view-distance 8 to 10 Chunk render distance sent to clients. Lowering from 12 to 8 dramatically boosts TPS.
simulation-distance 5 to 6 Distance around players where mobs, crops, and entities tick. Crucial for lag control.
difficulty normal or hard World game difficulty level (peaceful, easy, normal, hard).
max-players 20 Maximum concurrent player slots.
network-compression-threshold 256 Reduces outgoing bandwidth without eating unnecessary CPU cycles.

7. Step 5: Startup Script & Aikar's Optimized JVM Flags

Minecraft's Java Virtual Machine (JVM) performs automatic garbage collection (GC). Without optimized parameters, Java pauses the server for hundreds of milliseconds whenever freeing memory, causing noticeable gameplay spikes. Minecraft server engineers universally recommend Aikar's Flags using the G1GC garbage collector.

Create a startup script called start.sh (or start.bat on Windows):

#!/bin/bash
# Allocate 6GB RAM (adjust according to your machine's capacity)
java -Xms6G -Xmx6G \
  -XX:+UseG1GC \
  -XX:+ParallelRefProcEnabled \
  -XX:MaxGCPauseMillis=200 \
  -XX:+UnlockExperimentalVMOptions \
  -XX:+DisableExplicitGC \
  -XX:+AlwaysPreTouch \
  -XX:G1NewSizePercent=30 \
  -XX:G1MaxNewSizePercent=40 \
  -XX:G1HeapRegionSize=8M \
  -XX:G1ReservePercent=20 \
  -XX:G1HeapWastePercent=5 \
  -XX:G1MixedGCCountTarget=4 \
  -XX:InitiatingHeapOccupancyPercent=15 \
  -XX:G1MixedGCLiveThresholdPercent=90 \
  -XX:G1RSetUpdatingPauseTimePercent=5 \
  -XX:SurvivorRatio=32 \
  -XX:+PerfDisableSharedMem \
  -XX:MaxTenuringThreshold=1 \
  -jar paper.jar --nogui

Make the script executable and test launch your server:

chmod +x start.sh
./start.sh
Important RAM Rule: Never set -Xmx to 100% of your total system RAM. If your VPS has 8 GB of total RAM, allocate 6 GB to Minecraft (-Xms6G -Xmx6G) so that 2 GB remains free for the operating system, disk caches, and JVM overhead.

8. Step 6: Network Setup & Port Forwarding (Port 25565)

To allow external players to join, Minecraft traffic on TCP port 25565 must reach your server.

Linux UFW Firewall:

sudo ufw allow 25565/tcp
sudo ufw reload

Home Hosting / Router Port Forwarding:

  1. Find your local private IPv4 address (e.g. 192.168.1.100) via ip a (Linux) or ipconfig (Windows).
  2. Log in to your home router admin gateway (typically 192.168.1.1 or 192.168.0.1).
  3. Navigate to the Port Forwarding / Virtual Server section.
  4. Add a new rule:
    • Protocol: TCP
    • External Port: 25565
    • Internal Port: 25565
    • Internal IP: Your machine's local IP (e.g. 192.168.1.100)
  5. Friends connect using your Public IP Address (which you can find by searching "what is my IP").

9. Step 7: Running 24/7 with Systemd (Linux Auto-Restart)

If you close your terminal or your SSH session disconnects, your server will terminate. To keep your Minecraft server running 24/7 in the background and automatically restart on crashes or system reboots, create a systemd service:

sudo nano /etc/systemd/system/minecraft.service

Paste the following service unit:

[Unit]
Description=Minecraft Dedicated Server
After=network.target

[Service]
User=minecraft
WorkingDirectory=/home/minecraft/server
ExecStart=/bin/bash /home/minecraft/server/start.sh
Restart=on-failure
RestartSec=15

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable minecraft
sudo systemctl start minecraft

# Check status anytime
sudo systemctl status minecraft

10. Step 8: Recommended Essential Plugins

PaperMC allows you to drop .jar plugins straight into the plugins/ directory. Here are the must-have plugins for every modern server:

  • GeyserMC + Floodgate: Enables Minecraft Bedrock Edition players (iOS, Android, Xbox, PlayStation, Nintendo Switch, and Windows 10/11 Bedrock) to join your Java server seamlessly.
  • LuckPerms: The standard permissions manager for staff ranks, VIP groups, and prefixes with an interactive web editor.
  • EssentialsX: Provides essential utility commands such as /spawn, /sethome, /tpa, economy support, and player kits.
  • CoreProtect: Ultra-fast block logging and anti-grief rollback tool. Easily inspect who broke a chest or placed lava with /co inspect.

11. Troubleshooting Common Minecraft Server Errors

Error Message / Issue Underlying Cause Solution
FAILED TO BIND TO PORT Port 25565 is already occupied by a running server instance or another program. Kill lingering processes with sudo fuser -k 25565/tcp or verify server-ip in server.properties is left blank.
UnsupportedClassVersionError: 65.0 Running with an older Java version than required (e.g. Java 17 instead of Java 21). Install OpenJDK 21 and check your active default with sudo update-alternatives --config java.
java.lang.OutOfMemoryError Allocated heap RAM exceeded or system has insufficient free physical RAM. Ensure -Xmx does not exceed available host RAM, or reduce chunk view distance.
Connection Timed Out: no further info Firewall blocking incoming packets or incorrect port forward. Verify TCP 25565 is allowed in UFW / Windows Defender and router port forwarding is correctly pointed to your local IP.

12. Promote Your Server on Top4Games

Once your server is live and stable, the next step is attracting players. Top4Games provides a dedicated Minecraft directory where players actively search for fresh survival communities, custom skyblock adventures, and cross-play networks.

How to List Your Server on Top4Games:
  1. Create a free account or log in at Top4Games.
  2. Click Add Server from the user menu.
  3. Select Minecraft as your game type, enter your server IP or domain (e.g., play.yourdomain.com), port 25565, and an engaging description.
  4. Install our voting banner on your server website or Discord to climb the rankings!

Ready to discover active communities or list your own server?

Browse Top4Games Minecraft Servers

Reklama