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. This guide walks you through every step by hand, so you understand what's happening and can fix it later. Prefer to skip it? On a Debian 13 or Ubuntu 24.04 VPS with 2 GB of RAM or more, the one-click Minecraft installer in your panel does all of this for you. It asks you to accept Mojang's Minecraft EULA first, then sets the server up to start on boot.
⚡ 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:
- 2-5 friends, vanilla: Nebula 2 (2GB RAM, $10/mo)
- 5-15 players: Galaxy 1 (4GB RAM, $20/mo)
- 15-40 players or light plugins: Galaxy 2 (8GB RAM, $35/mo)
- Modpacks or 40+ players: Supernova (16GB RAM, $65/mo)
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, so 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 and 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
On a Galaxy Cloud VPS, open the same ports under Firewall Rules on your VPS page in the client portal too. Everything except SSH stays closed until you do.
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, and a one-click Minecraft installer in your panel if you'd rather not do it by hand. Use code LAUNCH2026 for 50% off your first month.
Get Started