How to Run a Minecraft Server on Ubuntu: Step-by-Step
Part of Discord bot hosting, our guide to this topic
To run a Minecraft Java server on Ubuntu, rent a VPS with a few gigabytes of RAM, install Java 25, download the server jar from minecraft.net, accept the EULA, open port 25565, and run the server as a systemd service that restarts itself. These steps use Ubuntu 24.04 LTS and take about 30 minutes.
On this page
This guide has no affiliate links in the steps.
A Minecraft server is a self-hosting job like any other: it runs on a machine you control, not a managed game host. If this is a fresh server, work through our new VPS setup checklist first — a sudo user, key login and a firewall come before any software you install. Never logged into a server? How to SSH into a VPS covers the connection.
The steps below run the vanilla Java server from Mojang, downloaded from the official page. At the end I cover the one optional alternative worth knowing (Paper) and how to back up and update the server.

What you need before you start
- A VPS with Ubuntu 24.04 LTS and a sudo user you log in as. The server runs as a separate non-root user we create below.
- A way for friends to reach you: your VPS’s public IP address, and port 25565 open in both the OS firewall and your provider’s panel.
- About 30 minutes, most of it waiting for the first world to generate.
How much RAM does a Minecraft server need?
Minecraft keeps the loaded part of the world in memory, so RAM is the number you size first. The Minecraft Wiki’s server requirements page asks for at least 4 GB for the server and the OS together, and its small-server table gives the Java process 1 GB for 1–4 players, 2 GB for 5–10 and 4 GB for 10 or more. So a 4 GB VPS is comfortable for a vanilla server with a handful of friends. Paper with plugins wants more: PaperMC’s tuning guide recommends 6–10 GB for its flags. Leave about 1 GB for Ubuntu itself — on a 4 GB VPS you give the Java process the other 3 GB.
The wiki’s table sizes the Java process at 1 GB for 1–4 players, 2 GB for 5–10 and 4 GB for 10+. Source: minecraft.wiki, captured Nov 20, 2026.
In our data the cheapest 4 GB plan on monthly billing is OVHcloud VPS-1 at $5.35/month. RackNerd’s 4 GB special costs less, $4.00/month, but you pay a year up front. If you need more room, Contabo Cloud VPS 4 at $6.60/month is the cheapest monthly 8 GB plan we track. The “A VPS for this guide” table on this page lists the cheapest 4 GB+ plan at each provider whose prices we read daily.
How to run a Minecraft server on Ubuntu: 10 steps
In the commands, minecraft is the dedicated user we create in step 1, and PASTE_THE_JAR_URL is the download link you copy from Minecraft’s page in step 3.
Create a non-root user
Run the server as its own user, never as root. This creates a system user with a home directory at / and no password:
serversudo useradd -r -m -d /opt/minecraft -s /bin/bash minecraft
Then make the folder where the server will live:
serversudo mkdir -p /opt/minecraft/server
sudo chown -R minecraft:minecraft /opt/minecraft
Check: sudo ls -ld / shows the directory owned by minecraft.
Install Java
The current Minecraft release (26.3) needs Java 25: per the Minecraft Wiki’s Java page, every version since 26.1 requires Java 25 or newer, 1.20.5 to 1.21.11 need Java 21, and 1.18 to 1.20.4 need Java 17. Ubuntu 24.04 has OpenJDK 25 in its universe repository:
serversudo apt update
sudo apt install openjdk-25-jre-headless
Check it with java -version — you want a line reporting 25.x. The headless package skips the GUI parts you don’t need on a server.
Every release since 26.1 needs Java 25. Source: minecraft.wiki, captured Nov 20, 2026.
If it fails: Apt says it can’t find the package. The universe repository is switched off on your image; run sudo add-apt-repository universe, then the two lines again. If the server later refuses to start with an UnsupportedClassVersionError, an older Java is the default — pick 25 with sudo update-alternatives --config java.
Download the server jar
Steps 3 to 6 run as the minecraft user inside its server folder. Switch to it:
serversudo -iu minecraft
cd server
Open Minecraft’s server download page on your computer. It offers the current release only; right-click its download link and copy the URL. Then download it on the server:
servercurl -L -o server.jar "PASTE_THE_JAR_URL"
-o server.jar names the output, and -L follows a redirect if there is one.
The download page offers only the current release, 26.3 on the day we checked. Source: minecraft.net, captured Nov 20, 2026.
If it fails: The file is tiny or java later reports an invalid jar. You copied the page URL instead of the download link. Right-click the version’s link and choose “Copy link address”.
Accept the EULA
The first run generates the config files, then stops and asks you to accept the EULA:
serverjava -jar server.jar nogui
It prints “You need to agree to the EULA” and exits. Open the file it just created:
servernano eula.txt
Change eula=false to eula=true, save and exit. That single line is your agreement to Mojang’s EULA — the file itself points to it. The server shuts down at once if you skip it.
First real start, with memory flags
Start it for real this time, giving the Java process a sensible amount of memory:
serverjava -Xms1G -Xmx3G -jar server.jar nogui
-Xms1G is the starting heap, -Xmx3G is the ceiling. On a 4 GB VPS this leaves about 1 GB for Ubuntu. On an 8 GB server, raise them to -Xms2G -Xmx7G. The first start generates the world, which can take a few minutes.
Check: A wall of log lines ending in Done (…s)!. While you’re in this console, type op YOUR_MINECRAFT_NAME so you can run admin commands in game later, and whitelist add NAME for yourself and each friend. Then type stop and press Enter to save and shut down cleanly.
Configure server.properties
servernano server.properties
The four lines that matter most for a small server:
server-port=25565— the default; leave it unless you have a reason to change it.motd=A Minecraft Server— the line players see next to your server in the list.difficulty=easy— the default;peaceful,normalandhardare the other choices.white-list=true— on by default since 26.3, so only names you added withwhitelist addcan join. Keep it on for a private server.
Leave online-mode=true on. It only lets in players verified against Minecraft’s account database.
When you’re done, type exit to go back to your own user.
Open port 25565 in UFW
Allow the game port through the OS firewall, then check the rules:
serversudo ufw allow 25565/tcp
sudo ufw status
If it fails: Friends still can’t connect. Your provider usually has a second, separate firewall in its web panel — check there too. For more on the OS side, our UFW firewall guide covers allow, delete and status.
Run it as a systemd service
Back as your own user, create a service unit so it runs in the background and restarts itself after a crash:
serversudo nano /etc/systemd/system/minecraft.service
minecraft.service — nano[Unit]
Description=Minecraft Server
After=network.target
[Service]
User=minecraft
WorkingDirectory=/opt/minecraft/server
ExecStart=/usr/bin/java -Xms1G -Xmx3G -jar server.jar nogui
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
Then enable and start it:
serversudo systemctl daemon-reload
sudo systemctl enable --now minecraft
sudo systemctl status minecraft
Restart=on-failure means a crash restarts the server, but a deliberate sudo systemctl stop minecraft stays stopped — that’s the behaviour you want. To watch the log live, run sudo journalctl -u minecraft -f.
Back up the world folder
Your world is a folder named world next to the jar. Stop the server so it isn’t writing while you copy, then archive it:
serversudo systemctl stop minecraft
sudo tar -czf ~/world-$(date +%F).tar.gz -C /opt/minecraft/server world server.properties
sudo chown $USER: ~/world-*.tar.gz
sudo systemctl start minecraft
The archive lands in your own home folder, so your login user can download it. Then pull it off the server, from your own computer (the quotes make the remote side expand the date glob):
your computerscp 'YOUR_LOGIN_USER@YOUR_SERVER_IP:world-*.tar.gz' .
A backup that only lives on the same machine dies with the machine — copy it somewhere else. The archive includes server.properties, so your settings come back with the world.
Update to a new version
Updating is just swapping the jar — the world folder carries over untouched. Back up first (step 9), then:
serversudo systemctl stop minecraft
sudo -u minecraft cp /opt/minecraft/server/server.jar /opt/minecraft/server/server.jar.old
# download the new jar as in step 3 (sudo -iu minecraft, cd server, curl, exit)
sudo systemctl start minecraft
Keep server.jar.old until you’ve confirmed the new version starts and the world loads. If it doesn’t, restore it and try again. Check the new release’s Java requirement first (step 2): the jump to 26.1 moved Minecraft from Java 21 to Java 25.
Key takeaways
- A Minecraft server on Linux is five steps: install Java 25, download the server jar, accept the EULA, open port 25565, and run it as a systemd service.
- Run it as a dedicated non-root user and give the JVM about 1 GB less than your VPS’s RAM (
-Xmx3Gon a 4 GB server). - Open 25565/tcp in UFW and in your provider’s panel firewall — a port can be blocked in either place.
- systemd with
Restart=on-failurebrings the server back after a crash, while a clean stop stays stopped. - Back up the
worldfolder with the server stopped, and copy it off the machine. To update, back up, then swapserver.jar.
A VPS for this guide
Everything above runs on a VPS with 4 GB of RAM or more. The cheapest 4 GB+ plan at each provider whose prices we read every day, IPv4 included:
| Plan · provider | vCPU · RAM · disk | You pay | Visit |
|---|---|---|---|
KVM VPS Special 4 GB RackNerd · New York +3 | 3 vCPU·4 GB·60 GB | $5.00/mo | |
VPS Lite 1 G12.5s netcup · Nuremberg +2 | 2 vCPU·4 GB·80 GB | $5.33/mo | |
VPS-1 OVHcloud · Vint Hill, VA +1 | 2 vCPU·4 GB·40 GB | $5.35/mo | |
NVMe 4 GB HostHatch · Amsterdam +15 | 2 vCPU·4 GB·20 GB | $6.00/mo | |
2 slices InterServer · New York +2 | 1 vCPU·4 GB·80 GB | $6.00/mo |
Prices read Dec 4, 2026. gets that provider's deals on Telegram. Compare every 4 GB plan →
Paper: a faster, plugin-friendly alternative
Paper is a Minecraft Java server that PaperMC describes as “designed to greatly improve performance”, and a drop-in replacement for CraftBukkit and Spigot, so Bukkit and Spigot plugins run on it. Paper 26.3 needs Java 25, the same as vanilla (Paper’s getting-started docs). The swap follows Paper’s migration page: stop the server, back it up (step 9), put the Paper jar from papermc.io in place of server.jar, and start it. Your server.properties and systemd unit stay as they are; Paper converts the way the world is stored on its first start, which is why the backup comes first.
The trade-off: Paper fixes some vanilla bugs and exploits, and its own vanilla-like guide says a 100% vanilla experience is not possible on Paper. Technical players whose redstone machines or duplication tricks depend on exact vanilla mechanics often stay on vanilla. For a small server with friends that wants plugins, Paper’s performance usually outweighs it.
Minecraft server problems
“You need to agree to the EULA.”eula.txt still says eula=false. Set it to true and start again.
“Invalid or corrupt jarfile server.jar.”The download came down as an HTML page, not the jar. You copied the page URL instead of the download link. Re-download with curl -L from the copied link.
Friends see “connection refused” or a timeout.Port 25565 isn’t reachable from outside. Check sudo ufw status, then your provider’s panel firewall, and confirm you gave them the right public IP.
Friends get “You are not white-listed on this server!”The whitelist is on by default. Run whitelist add NAME in the server console, or in game as an op.
“UnsupportedClassVersionError” when the server starts.The jar needs a newer Java than the one that ran it. Install openjdk-25-jre-headless (step 2) and check java -version.
“Can’t keep up! Is the server overloaded?”The tick loop fell behind. Check CPU first with top — but if free -m shows the memory full, raise -Xmx (step 5) or move to a bigger plan.
The server keeps restarting or crashing.Look at sudo journalctl -u minecraft -e. Often -Xmx is set too close to the VPS’s real RAM, and the kernel’s out-of-memory killer stops the process. Lower it to about 1 GB under your RAM.
World changes vanished after a crash.The world only saves periodically, and you had no recent backup. Take a backup (step 9) before updates and before anyone does anything risky.
After your server is up
- Lock it down. Keep
white-liston, add only your friends, and op only yourself until you trust people with admin commands. - A Discord bot for your community is a natural next self-host — our Discord bot hosting list ranks plans for it.
- Paper or plugins if you outgrow vanilla (see the section above).
- Picking a server. If you haven’t rented one yet, compare VPS prices by real monthly cost, renewal and setup fees included.
Questions
How much RAM does a Minecraft server need?
The Minecraft Wiki asks for at least 4 GB for the server and the OS together, so a 4 GB VPS is comfortable for a vanilla server with a few friends. Leave about 1 GB for the OS: on a 4 GB VPS give the Java process -Xmx3G. Paper with plugins wants 6–10 GB, per PaperMC.
What Java version does Minecraft need?
Minecraft 26.1 and newer needs Java 25, 1.20.5 to 1.21.11 need Java 21, and 1.18 to 1.20.4 need Java 17. On Ubuntu 24.04 install openjdk-25-jre-headless.
Can I run a Minecraft server on Ubuntu 22.04?
Yes. The steps are the same; openjdk-25-jre-headless is also in 22.04’s universe repository, and the rest carries over.
Do I need to buy Minecraft to run a server?
No. The server software is free to download and run under Mojang’s EULA. Players need a paid account to join while online-mode is on.
How do my friends join?
Add their names with whitelist add NAME first — the whitelist is on by default. Then give them your VPS’s public IP (and the port, if you changed it), and they add it in the multiplayer screen.
Paper or vanilla?
Vanilla for exact Mojang behaviour; Paper for better performance and plugins. The swap is replacing server.jar after a backup — your config stays put, and Paper converts the world storage on its first start.
How we checked: The steps follow Minecraft’s official server download page, the Minecraft Wiki’s server setup, server requirements, Java and server.properties pages, PaperMC’s documentation, and Ubuntu’s package list for 24.04 (OpenJDK 25), all read on 2026-11-17. We did not buy or run these servers for this article, and we did not test the steps on every provider’s image. Prices come from our daily reads of provider pages (Dec 4, 2026). How we check.