How to Host a Minecraft Server on a VPS (Ubuntu 24.04)
Running game servers is actually how I got into Linux in the first place. Before starting Galaxy Cloud Solutions, I was running a FiveM RP server — and keeping that running 24/7 with players online taught me more about Linux server management than any tutorial ever did. Minecraft is a lot simpler than FiveM, so if I can keep a GTA V multiplayer server alive, you can definitely keep a Minecraft server running.
This guide covers setting up a vanilla Minecraft Java Edition server on Ubuntu 24.04. The whole process takes about 15 minutes. We actually have a one-click Minecraft installer built into our customer portal, but this guide walks you through doing it manually so you understand what's happening.
⚡ Need a VPS? Start from $5/mo — Use code LAUNCH2026 for 50% offWhat Plan Do You Need?
Minecraft's RAM requirements depend on how many players you're expecting:
- 1-5 players: Nebula 1 (1GB RAM, $5/mo) — works but tight
- 5-15 players: Nebula 2 (2GB RAM, $10/mo) — comfortable
- 15-30 players: Galaxy 1 (4GB RAM, $20/mo) — smooth
- 30+ players or mods: Galaxy 2 (8GB RAM, $35/mo) — recommended
Step 1 — Update and Install Java
Minecraft Java Edition requires Java. Modern versions need Java 21:
apt update && apt upgrade -y
apt install openjdk-21-jre-headless screen -y
The screen package lets you keep the server running after you disconnect from SSH — you'll need it.
Verify Java installed correctly:
java -version
Step 2 — Create a Minecraft User
Running the server as root is a bad idea. Create a dedicated user:
useradd -m -r -s /bin/bash minecraft
mkdir /opt/minecraft
chown minecraft:minecraft /opt/minecraft
Step 3 — Download the Minecraft Server
su - minecraft
cd /opt/minecraft
wget https://piston-data.mojang.com/v1/objects/145ff0858209bcfc164859ba735d4199aafa1eea/server.jar -O server.jar
Step 4 — Accept the EULA
Run the server once to generate the eula.txt file:
java -Xmx1024M -Xms512M -jar server.jar nogui
It'll stop and tell you to accept the EULA. Do that:
echo "eula=true" > eula.txt
Step 5 — Configure the Server
Edit server.properties to your liking. The important ones:
nano server.properties
Key settings to change:
max-players=20— set based on your plan's RAMmotd=Your Server Name— what shows in the server listdifficulty=normal— easy/normal/hardonline-mode=true— keep this true unless you need cracked client support
Step 6 — Create a Startup Script
Create a script that allocates the right amount of RAM. Adjust the Xmx value based on your plan — give Minecraft about 70% of your total RAM:
cat > /opt/minecraft/start.sh << 'EOF'
#!/bin/bash
cd /opt/minecraft
java -Xmx896M -Xms512M -jar server.jar nogui
EOF
chmod +x /opt/minecraft/start.sh
Step 7 — Open the Firewall Port
Exit back to root and open Minecraft's default port:
exit
ufw allow 25565/tcp
ufw reload
Step 8 — Start the Server with Screen
su - minecraft
screen -S minecraft /opt/minecraft/start.sh
The server will start up. Once you see "Done!" it's ready. Detach from screen with Ctrl+A then D — the server keeps running after you disconnect.
To get back to the server console later:
screen -r minecraft
Step 9 — Make It Start on Boot
Create a systemd service so the server restarts automatically if the VPS reboots:
exit
cat > /etc/systemd/system/minecraft.service << 'EOF'
[Unit]
Description=Minecraft Server
After=network.target
[Service]
User=minecraft
WorkingDirectory=/opt/minecraft
ExecStart=/opt/minecraft/start.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable minecraft
systemctl start minecraft
Connect to Your Server
Open Minecraft, go to Multiplayer, and add your server using your VPS IP address. That's it.
Host your Minecraft server from $10/mo
The Nebula 2 plan (2GB RAM, $10/mo) is the sweet spot for a small Minecraft server with friends. Full root access, Ubuntu 24.04, instant deployment. We also have a one-click Minecraft installer in the customer portal if you prefer. Use code LAUNCH2026 for 50% off your first month.
Get Started