We earn commissions when you shop through the links below. Learn more
How to Make a Minecraft Server on a VPS (Ubuntu)
Set up your own Minecraft Java server on a Linux VPS: install Java, download the server, give it the right amount of RAM, run it 24/7 with systemd and let your friends join. About 15 minutes from a fresh server.
Minecraft JavaUbuntu 24.04 & 26.04Runs 24/7About 15 minutes
Before you start
What you need
No server yet? ShockHosting includes DDoS protection on every VPS, and Hostinger gives you 8 GB of RAM on its KVM 2 plan for modded worlds. Compare them all in our guide to the best VPS for game servers.
Step 1
Install Java and create a minecraft user
Minecraft runs on Java. Recent releases need Java 21 or newer; if the server later says it needs a newer version, install openjdk-25-jre-headless instead.
Running the server as its own user keeps the rest of your VPS safe if a plugin misbehaves.
Install Java and add a user
sudo apt update
sudo apt install -y openjdk-21-jre-headless
java -version
sudo adduser --system --group --home /opt/minecraft minecraft
Step 2
Download the server and accept the EULA
Copy the download link for the latest server.jar from the official Minecraft website’s Java server download page, and paste it in place of the link below.
Want plugins? Download Paper instead of the official server. It runs the same worlds faster and supports Bukkit and Spigot plugins.
Download and accept
cd /opt/minecraft
sudo -u minecraft wget -O server.jar PASTE-SERVER-JAR-LINK
sudo -u minecraft java -Xmx1024M -jar server.jar nogui
echo "eula=true" | sudo -u minecraft tee eula.txt
The first run stops straight away and creates eula.txt; setting it to true means you accept Mojang’s EULA.
Step 3
Run it 24/7 with systemd
Create /etc/systemd/system/minecraft.service with this. Set -Xmx to about 1 GB less than your server’s RAM (3G on a 4 GB VPS):
[Unit]
Description=Minecraft server
After=network-online.target
[Service]
User=minecraft
WorkingDirectory=/opt/minecraft
ExecStart=/usr/bin/java -Xms1G -Xmx3G -jar server.jar nogui
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
Start it now and at every boot
sudo systemctl daemon-reload
sudo systemctl enable --now minecraft
sudo systemctl status minecraft
Watch the server log
sudo journalctl -u minecraft -f
Step 4
Open the port and join
Allow Minecraft’s port through the firewall, keeping SSH open so you don’t lock yourself out. Then in Minecraft choose Multiplayer → Add Server and enter your server’s IP address.
Firewall new to you? Our UFW firewall guide explains every rule.
Open port 25565
sudo ufw allow OpenSSH
sudo ufw allow 25565/tcp
sudo ufw enable
Running your server
Tips for a smooth server
Whitelist your friends
Set white-list=true in server.properties and add players with whitelist add name so strangers can’t join.
Back up the world
Stop the server and copy the world folder, or take a VPS snapshot before updates and big mod changes.
Use a domain
Point an A record such as mc.example.com at your server so friends don’t need to remember the IP.
Need a server?
Pick a server for Minecraft
RAM matters most. ShockHosting adds DDoS protection for public servers; Hostinger gives you the most RAM per dollar for modded worlds.
Simple cloud servers with great docs. Add your SSH key when you create a Droplet.
From about $4/month
View DigitalOcean dealsHostinger
4 GB of RAM and NVMe storage on the entry VPS plan, with an easy control panel.
About $5.19/month on a 24-month term with our extra 20% off
Get 20% off Hostinger VPSYearly KVM VPS deals for about the price of one month elsewhere. Great for learning.
From about $11/year on promo
View RackNerd dealsPrices are approximate. Compare all VPS hosts, including Vultr and ShockHosting.
FAQ
Minecraft server questions, answered
How much RAM does a Minecraft server need?
About 2 GB for a small vanilla server with a few friends, 4 GB for 5 to 15 players, and 6 to 8 GB or more for large modpacks.
Is it cheaper to host Minecraft on a VPS?
Usually, yes. A VPS gives you more RAM per dollar than most managed Minecraft hosts, and you can run other things on it too. The trade-off is that you manage the server yourself.
Can I run a Bedrock server instead?
Yes. Download the Bedrock Dedicated Server for Linux, unzip it and run it the same way with systemd. Bedrock uses UDP port 19132 instead of 25565.
How do I update the server?
Stop it with sudo systemctl stop minecraft, back up the world folder, replace server.jar with the new version and start it again.
How do I run commands on the server?
A systemd service has no console, so turn on RCON in server.properties and use an RCON client such as mcrcon. Once you make yourself an operator with op yourname, you can also run commands in game.
Why can my friends not connect?
Check that the server is running, that port 25565 is open in UFW and in any firewall in your host’s dashboard, and that they are using the same Minecraft version.
Get a server built for games
ShockHosting VPS plans include DDoS protection, so your Minecraft server stays online when it gets popular.