Website Vidya
Linux & ServersStep-by-Step Guide

How to Make a Minecraft Server on Ubuntu 24.04

Complete guide to make a Minecraft server on Ubuntu 24.04 LTS using PaperMC, OpenJDK 21, systemd background service, UFW firewall, and automated backups.

RR
Rajesh RayLead Systems Educator
Published:
5 min read
How to Make a Minecraft Server on Ubuntu 24.04
AI Executive SummaryCORE CIS AI

5 min read

Complete guide to make a Minecraft server on Ubuntu 24.04 LTS using PaperMC, OpenJDK 21, systemd background service, UFW firewall, and automated backups.

Key Highlights
  • Prerequisites and Supported Releases
  • Step 1: Installing OpenJDK 21 and Essential Utilities
  • Step 2: Creating a Dedicated Minecraft System User
Grounded in full engineering runbookCORE CIS Ai Engine

Self-hosting multiplayer game infrastructure offers immense creative freedom, performance optimization, and privacy. When you make a minecraft server on ubuntu 24.04, you deploy a dedicated Linux game server capable of handling multiple concurrent players, custom plugin extensions, and vast generated voxel landscapes with minimal tick latency.

While official Mojang vanilla server software is functional, modern multi-player deployments universally favor optimized server forks like PaperMC. PaperMC delivers substantial performance optimizations, fixes game engine exploits, reduces server-side tick lag (TPS drops), and provides native compatibility with thousands of Bukkit and Spigot plugins.

In this tutorial, you will configure the necessary OpenJDK 21 Java runtime environment, create an isolated non-privileged system service user, download and initialize PaperMC, tune server operational parameters in server.properties, configure a managed systemd background service, open firewall ports in UFW, and establish automated daily world backups.

Advertisement

Prerequisites and Supported Releases

This guide is thoroughly verified on Ubuntu 24.04 LTS (Noble Numbat). The instructions apply cleanly to cloud instances (AWS EC2, Google Compute Engine, DigitalOcean, Hetzner), bare-metal servers, and local virtual machines.

Before proceeding, ensure you have the following requirements satisfied:

  • A server or virtual machine running Ubuntu 24.04 LTS with at least 4 GB RAM (8 GB recommended for multi-player worlds).
  • A non-root user account with active sudo administrative privileges.
  • Access to a command-line terminal and active Internet connectivity.
  • A static IP address or configured dynamic DNS hostname for remote player connections.

Step 1: Installing OpenJDK 21 and Essential Utilities

Modern Minecraft server software (version 1.20.5 and above) requires Java 21 or higher to compile and run the game engine. Ubuntu 24.04 LTS provides OpenJDK 21 in its standard repositories.

Refresh your package index and install openjdk-21-jre-headless, screen (for interactive terminal multiplexing), curl, and jq.

# Refresh package repository index
sudo apt update && sudo apt upgrade -y

# Install OpenJDK 21 JRE, screen multiplexer, curl, and jq
sudo apt install -y openjdk-21-jre-headless screen curl jq ufw

Step 2: Creating a Dedicated Minecraft System User

Running game servers under the root administrative user account introduces severe security vulnerabilities if an exploited plugin or network payload achieves remote code execution.

Advertisement

Create a dedicated system user and group named minecraft with home directory /opt/minecraft.

# Create dedicated system user and group
sudo useradd -r -m -d /opt/minecraft -s /bin/bash minecraft

Step 3: Downloading the Latest PaperMC Server Binary

Switch to the minecraft user and create a dedicated server directory /opt/minecraft/server.

Fetch the latest stable PaperMC server binary using Paper's official REST API, which automatically resolves the latest build number for Minecraft 1.20.6.

# Switch to minecraft user shell
sudo su - minecraft

# Create and enter server directory
mkdir -p /opt/minecraft/server
cd /opt/minecraft/server

# Download the latest stable PaperMC jar
MC_VERSION="1.20.6"
BUILD_NUM=$(curl -s "https://api.papermc.io/v2/projects/paper/versions/${MC_VERSION}/builds" | jq '.builds[-1].build')
curl -o server.jar "https://api.papermc.io/v2/projects/paper/versions/${MC_VERSION}/builds/${BUILD_NUM}/downloads/paper-${MC_VERSION}-${BUILD_NUM}.jar"

Step 4: Initializing Server and Accepting the Minecraft EULA

Run the server once with initial memory parameters (-Xms2G -Xmx2G) to generate the initial directory structure and license agreement file (eula.txt).

Open eula.txt and change eula=false to eula=true to accept Mojang's End User License Agreement.

Advertisement
# Run server once to generate initial configuration files
java -Xms2G -Xmx2G -jar server.jar --nogui

# Accept the Minecraft EULA
sed -i 's/eula=false/eula=true/' eula.txt

# Exit back to administrative user shell
exit

Step 5: Configuring Server Settings in server.properties

Customize server gameplay parameters, difficulty, maximum player slots, message-of-the-day (MOTD), and view distances inside /opt/minecraft/server/server.properties.

For optimal performance on multi-core servers, set view-distance=10 and simulation-distance=6 to reduce CPU thread overhead.

# Edit server properties as administrative user
sudo nano /opt/minecraft/server/server.properties

Step 6: Creating a systemd Background Service Unit

To ensure the Minecraft server starts automatically on system boot, runs continuously in the background, and can be easily restarted, create a systemd service unit at /etc/systemd/system/minecraft.service.

The service executes inside a detached screen session, allowing administrators to attach directly to the interactive Minecraft server console at any time.

[Unit]
Description=Minecraft Dedicated Game Server (PaperMC)
After=network.target

[Service]
WorkingDirectory=/opt/minecraft/server
User=minecraft
Group=minecraft
Restart=always
RestartSec=10

ExecStart=/usr/bin/screen -DmS minecraft /usr/bin/java -Xms2048M -Xmx4096M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -jar server.jar --nogui

ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "say Server shutting down in 10 seconds..."\015'
ExecStop=/bin/sleep 10
ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "stop"\015'

[Install]
WantedBy=multi-user.target

Step 7: Starting the Service and Opening Firewall Ports

Reload the systemd daemon, enable the Minecraft service, and start it. Verify that the server is listening on default TCP port 25565.

Configure the Uncomplicated Firewall (ufw) to permit incoming player connections on port 25565.

# Reload systemd and start Minecraft service
sudo systemctl daemon-reload
sudo systemctl enable --now minecraft

# Open default Minecraft game port in UFW
sudo ufw allow 25565/tcp comment "Minecraft Dedicated Server"

# Verify service is running
sudo systemctl status minecraft

Step 8: Accessing the Interactive Server Console

Because the server runs inside a detached screen session, you can attach to the live server console to execute in-game operator commands (such as /op username, /whitelist add, or /ban).

Attach to the screen session, and press Ctrl+A followed by d to detach safely without shutting down the server.

# Attach to the running Minecraft console as minecraft user
sudo su - minecraft -c "screen -r minecraft"

# To detach safely: Press Ctrl+A, then press D

Step 9: Setting Up Automated Daily World Backups

Hardware failures or corrupted chunk data can ruin months of building. Create an automated backup script under /opt/minecraft/backup.sh that compresses your world directories daily using cron.

The script preserves your world while pruning backups older than 7 days.

# Create backup script
sudo tee /opt/minecraft/backup.sh << 'EOF'
#!/bin/bash
BACKUP_DIR="/opt/minecraft/backups"
SERVER_DIR="/opt/minecraft/server"
DATE=$(date +"%Y-%m-%d_%H-%M-%S")

mkdir -p "${BACKUP_DIR}"
tar -czf "${BACKUP_DIR}/world_backup_${DATE}.tar.gz" -C "${SERVER_DIR}" world world_nether world_the_end

# Delete backups older than 7 days
find "${BACKUP_DIR}" -type f -name "*.tar.gz" -mtime +7 -delete
EOF

# Make script executable and own it by minecraft user
sudo chmod +x /opt/minecraft/backup.sh
sudo chown minecraft:minecraft /opt/minecraft/backup.sh

# Add to crontab to run daily at 4:00 AM
(sudo crontab -u minecraft -l 2>/dev/null; echo "0 4 * * * /opt/minecraft/backup.sh") | sudo crontab -u minecraft -

Troubleshooting and Common Errors

When configuring Ubuntu servers, unexpected permission errors, network timeouts, or lock contention can occur. Review these common issues and verified resolutions:

Server crashes on startup with 'UnsupportedClassVersionError'

Resolution: Minecraft 1.20.5+ requires Java 21. Check your default Java version with java -version. Ensure openjdk-21-jre-headless is installed and set as the default via sudo update-alternatives --config java.

Players cannot connect from outside the local network

Resolution: If hosting on a home server, ensure port 25565 is forwarded in your home router settings to your Ubuntu server's static internal IP address. Ensure UFW allows port 25565/tcp.

Can't keep up! Is the server overloaded? Falling behind ticks

Resolution: Adjust garbage collection parameters in /etc/systemd/system/minecraft.service using Aikar's optimized G1GC flags, reduce view-distance to 8 in server.properties, or allocate more RAM to -Xmx.

Security Best Practices and Hardening

Always execute the Minecraft server under a dedicated non-privileged system user account (minecraft) rather than root.

Enable whitelist enforcement (white-list=true in server.properties) on private multiplayer servers to prevent griefers from joining.

Install security and rollback plugins like CoreProtect to log block changes and revert unauthorized player griefing.

Ensure automated backups are stored offsite or in a segregated directory to protect against accidental world corruption.

Deepen your Linux system administration skills with our related production-tested guides:

Authoritative References and Official Documentation

Frequently Asked Questions

Quick answers to common questions and configurations

3 FAQs
For a standard vanilla or light plugin server with 5-10 players, 4 GB RAM (-Xmx4G) is ideal. For heavily modded servers or large communities, allocate 8 GB to 16 GB RAM.
Yes. By installing the GeyserMC and Floodgate plugins into your PaperMC /opt/minecraft/server/plugins/ directory, mobile, console, and Windows Bedrock players can connect seamlessly.
Attach to the running console with sudo su - minecraft -c 'screen -r minecraft', type op your_minecraft_username, and press Enter.
RR
Written byVerified Author

Rajesh Ray

I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.

SPAM-FREE MODERATED DISCOURSE

Join the Conversation & Perspective

Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.

AT
MP
JV
+2

No comments on this guide yet. Be the first to share your thoughts or ask a question!

Recommended Reading10 Guides

Related Technical Guides

Tested runbooks, server administration walkthroughs, and troubleshooting guides

Linux & Servers•

How to Install PDO Extension in PHP

PHP Data Objects (PDO) is one of the most important extensions in PHP for working with databases in a secure, consistent, and modern way. If you are building dynamic websites, APIs, CMS platforms, or enterprise applications, PDO is not opti...

RR
Rajesh Rai
Read More
Featured Infrastructure PartnerUp to 75% OFF + 3 Months Free

Supercharge Your Linux & Cloud Workloads with Hostinger

Deploy high-speed NVMe KVM VPS, Docker containers, and LiteSpeed-accelerated WordPress servers in under 60 seconds with full root access, dedicated IPv4, and 24/7 technical support.

Pure NVMe SSD StorageFull Root Access & SSHFree Domain & Unlimited SSL99.9% Uptime SLA
Plans from$2.99/mo
Claim Hostinger DealAffiliate link • Special discount applied at checkout