“`html
Minecraft Server on Ubuntu: Linux Hosting Setup Guide
Ubuntu remains the go-to Linux distribution for Minecraft server hosting, and for good reason—it’s stable, lightweight, and doesn’t waste resources on unnecessary desktop environments. If you’re tired of paying premium prices for managed hosting or want complete control over your server configuration, running Minecraft on Ubuntu gives you both flexibility and performance.
A Minecraft server on Ubuntu is a Java-based game server application running on Ubuntu Linux that allows multiple players to connect and play together in a shared world. Ubuntu’s command-line environment, minimal resource overhead, and long-term support releases make it ideal for both small private servers and large-scale multiplayer hosting.
Why Ubuntu Beats Other Linux Distros for Minecraft Hosting
Ubuntu’s dominance in the Minecraft server hosting space isn’t accidental. The distribution offers 5-year LTS (Long Term Support) releases, meaning your server stays secure without constant upgrade headaches. Unlike CentOS or Fedora, Ubuntu’s package repositories are consistently updated with compatible Java versions, and the community documentation specifically for game server hosting is unmatched.
The real advantage shows up in resource efficiency. A vanilla Ubuntu Server installation uses roughly 150-200MB of RAM at idle, leaving maximum memory available for your Minecraft server process. Compare that to Windows Server eating 2GB before you even launch the game, and the choice becomes obvious.
Ubuntu also handles Java garbage collection more predictably than Windows, resulting in fewer lag spikes during gameplay. The built-in systemd service manager makes automatic server restarts and crash recovery straightforward—no third-party tools required.
Prerequisites and System Requirements
Before diving into installation, let’s talk actual hardware needs. The “minimum requirements” you see online are usually worthless—they’ll get your server running, but not playable.
Real-World Hardware Specs
- CPU: Minimum 2 cores at 3.0GHz+ (Minecraft is heavily single-threaded, so clock speed matters more than core count)
- RAM: 2GB for vanilla with 5-10 players, 4-6GB for modpacks, 8GB+ for heavily modded servers like All The Mods 9
- Storage: 10GB minimum for vanilla, 20GB+ for modded (SSD strongly recommended for chunk loading)
- Network: 100Mbps connection with at least 1TB monthly bandwidth
You’ll also need Ubuntu Server 20.04 LTS or 22.04 LTS. Skip the desktop version—you don’t need the GUI consuming resources. And yes, you need SSH access and basic command-line comfort. If typing commands makes you nervous, you’ll learn fast.
Step-by-Step Ubuntu Minecraft Server Installation
This process takes about 15-20 minutes if you follow it exactly. Skipping steps or improvising usually ends with troubleshooting for hours.
Update System and Install Java
First, update your package lists and install OpenJDK. Minecraft 1.20+ requires Java 17 or newer:
sudo apt update && sudo apt upgrade -y
sudo apt install openjdk-17-jre-headless -y
java -version
That last command confirms Java installed correctly. You should see something like “openjdk version 17.0.x”. If you don’t, stop and troubleshoot before continuing.
Create Dedicated Server User
Never run your Minecraft server as root. Create a dedicated user for security and organization:
sudo adduser minecraft
sudo su - minecraft
mkdir ~/server
cd ~/server
This isolates your server files and limits potential damage if something goes wrong.
Download and Configure Server Files
Grab the latest server JAR from Mojang’s official site. Replace the version number with whatever’s current:
wget https://launcher.mojang.com/v1/objects/[hash]/server.jar
java -Xmx1024M -Xms1024M -jar server.jar nogui
The first run generates configuration files and fails—that’s normal. Edit the EULA file to accept terms:
nano eula.txt
Change eula=false to eula=true, save (Ctrl+O), and exit (Ctrl+X).
Optimize Server Properties
Before starting your server properly, edit server.properties for better performance:
nano server.properties
Key settings to adjust:
- view-distance: Set to 8-10 (default 10 is often too high)
- max-players: Set realistic limits based on your RAM
- spawn-protection: Set to 0 if you trust your players
- enable-command-block: True if you want advanced automation
Launch with Proper Memory Allocation
Start your server with appropriate memory flags. For a 4GB server:
java -Xmx3G -Xms3G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -jar server.jar nogui
Those garbage collection flags reduce lag spikes significantly. Don’t allocate all your RAM to Java—leave 1GB for the operating system.
Setting Up Automatic Server Management
Manual server starts are fine for testing, but you want automatic restarts after crashes or reboots. Create a systemd service file:
sudo nano /etc/systemd/system/minecraft.service
Paste this configuration (adjust paths and memory as needed):
[Unit]
Description=Minecraft Server
After=network.target
WorkingDirectory=/home/minecraft/server
ExecStart=/usr/bin/java -Xmx3G -Xms3G -jar server.jar nogui
Restart=on-failure
RestartSec=10 [Install] WantedBy=multi-user.target
Enable and start the service:
sudo systemctl enable minecraft
sudo systemctl start minecraft
sudo systemctl status minecraft
Your server now starts automatically on boot and restarts after crashes. Check logs with sudo journalctl -u minecraft -f.
Firewall Configuration and Port Forwarding
Your server won’t be accessible without proper network configuration. Ubuntu’s UFW firewall is straightforward:
sudo ufw allow 25565/tcp
sudo ufw allow 22/tcp
sudo ufw enable
Port 25565 is Minecraft’s default. Port 22 keeps SSH access open—don’t lock yourself out.
If you’re hosting from home, forward port 25565 in your router to your Ubuntu server’s local IP. Every router interface is different, but look for “Port Forwarding” or “Virtual Server” in your router’s admin panel.
Performance Tuning for Better TPS
TPS (ticks per second) should stay at 20 for smooth gameplay. If it drops, players experience lag regardless of their connection speed.
Server-Side Optimization
Install Paper or Purpur instead of vanilla Minecraft for significantly better performance. Paper includes dozens of optimizations without changing gameplay:
wget https://api.papermc.io/v2/projects/paper/versions/1.20.1/builds/[latest]/downloads/paper-1.20.1-[build].jar -O paper.jar
Paper’s configuration files (paper-global.yml and paper-world-defaults.yml) offer granular control over chunk loading, entity activation ranges, and redstone optimization.
Key Paper optimizations to enable:
- Reduce entity activation ranges for mobs you don’t need responsive
- Lower hopper transfer rates if you have massive item sorting systems
- Enable anti-xray to reduce server load from xray client mods
- Adjust mob spawn ranges to reduce AI calculations
Backup Automation and Disaster Recovery
Your world data is irreplaceable. Set up automated backups before you lose weeks of progress to corruption or accidental deletion.
Create a backup script:
nano ~/backup.sh
Add this content:
#!/bin/bash
BACKUP_DIR="/home/minecraft/backups"
SERVER_DIR="/home/minecraft/server"
DATE=$(date +%Y-%m-%d_%H-%M)
tar -czf $BACKUP_DIR/backup-$DATE.tar.gz -C $SERVER_DIR world world_nether world_the_end
find $BACKUP_DIR -name "backup-*.tar.gz" -mtime +7 -delete
Make it executable and add to cron for daily backups:
chmod +x ~/backup.sh
crontab -e
Add this line for daily 3 AM backups:
0 3 * * * /home/minecraft/backup.sh
This keeps 7 days of backups and automatically deletes older ones to save space.
Common Problems and Actual Solutions
Server starts but players can’t connect: Check your firewall rules and router port forwarding. Use netstat -tulpn | grep 25565 to verify the server is listening on the correct port.
Constant “Can’t keep up” warnings: Your server is overloaded. Reduce view-distance, lower max-players, or upgrade your hardware. Those garbage collection flags help, but they can’t fix underpowered hardware.
Random crashes with no error messages: Usually memory-related. Check dmesg | grep -i kill for OOM (out of memory) killer messages. If Java got killed, you need more RAM or to allocate less to the server.
World corruption after power loss: Enable forced-gamemode and configure Paper’s save intervals. Consider a UPS (uninterruptible power supply) if you’re hosting from home.
When Self-Hosting Doesn’t Make Sense
Running a Minecraft server on Ubuntu gives you complete control, but it requires maintenance, monitoring, and troubleshooting skills. If you’d rather focus on building and playing instead of managing Linux systems, professional hosting eliminates the technical overhead.
Get your Ubuntu Minecraft server running in minutes with GameTeam.io—starting at $1/GB with 20% off for new customers. No manual configuration, automatic backups included, and expert support when you need it.
FAQ
Can I run multiple Minecraft servers on one Ubuntu machine?
Yes, absolutely. Create separate user accounts and directories for each server, assign different ports (25565, 25566, etc.), and create individual systemd service files. Just ensure you have enough RAM—each server needs its own allocation.
Do I need Ubuntu Pro for Minecraft server hosting?
No, standard Ubuntu Server works perfectly. Ubuntu Pro offers extended security patches for older releases, but for game servers, using the latest LTS release with regular updates is sufficient and free.
What’s the difference between Ubuntu Server and Ubuntu Desktop for hosting?
Ubuntu Server has no GUI, using significantly less RAM and CPU. Desktop includes unnecessary software for server hosting. Always choose Server for dedicated hosting—you’ll interact through SSH anyway.
How do I update my Minecraft server version on Ubuntu?
Stop the server with sudo systemctl stop minecraft, backup your world folder, download the new server JAR, replace the old one, and restart with sudo systemctl start minecraft. Always backup first—updates occasionally cause world compatibility issues.
Can I use Ubuntu on Windows with WSL for Minecraft hosting?
Technically yes, but don’t. WSL adds overhead, networking is complicated, and performance suffers. If you’re on Windows, either dual-boot Ubuntu or use a proper Linux VPS. WSL is for development, not production hosting.
Setting up a Minecraft server on Ubuntu takes some initial effort, but the performance gains and control make it worthwhile for anyone serious about hosting. Start with vanilla, get comfortable with the commands, then experiment with Paper and plugins once you’ve got the basics down.
“`
 
			
 
				
 
				