Minecraft Server Setup
Game Servers

Setting Up a Minecraft Server on an Ubuntu VDS (Java Edition)

Install Java on an Ubuntu VDS and launch a Minecraft Java Edition server: RAM settings, server.properties, firewall, 24/7 operation with systemd and backups.

  • MerkezHost Technical Team
  • 6 min read
  • Level: Intermediate
  • Updated:

You want to set up your own Minecraft server to play with your friends or community. A server running on a VDS instead of your home connection stays online 24/7, offers lower latency and keeps your IP address private. In this guide we explain step by step how to set up a Minecraft Java Edition server on an Ubuntu VDS, tune its performance and run it automatically with systemd.

Requirements

Number of playersRecommended RAMNote
1-10, no plugins2-4 GBSmall server for friends
10-30, a few plugins4-8 GBPaper recommended
30+, modded / large map8 GB or moreHigh-frequency processor essential

A Minecraft server performs most of its world processing (ticks) on a single core. That's why processor frequency is at least as important as RAM; high-frequency processors such as AMD Ryzen 9 deliver noticeably smoother gameplay.

  • A VDS running Ubuntu 22.04 or 24.04 and a user with sudo privileges.
  • DDoS protection: game servers are among the services most frequently targeted by DDoS.

Step 1: Install Java

Current Minecraft versions require Java 21:

sudo apt update
sudo apt install -y openjdk-21-jre-headless screen
java -version
Version compatibility

Older Minecraft versions require different Java versions. If you're going to run a specific older version, install the Java version it requires.

Step 2: Create a separate user

For security, run the server under its own user instead of root:

sudo adduser --system --group --home /opt/minecraft minecraft
sudo -u minecraft mkdir -p /opt/minecraft/server
cd /opt/minecraft/server

Step 3: Download the server file

You have two options:

  • Vanilla (official): Copy the current server.jar link from the "Minecraft: Java Edition Server" page on minecraft.net.
  • Paper (recommended): Download the latest Paper version from papermc.io. Paper is server software that is compatible with Vanilla, includes performance improvements and supports plugins.
# Use the link you copied
sudo -u minecraft wget -O server.jar "BURAYA_INDIRME_BAGLANTISI"

Step 4: First run and the EULA

sudo -u minecraft java -Xms2G -Xmx4G -jar server.jar --nogui

On the first run, the server shuts down saying you need to accept the Minecraft End User License Agreement (EULA). If you have read and accept the agreement:

sudo -u minecraft sed -i 's/eula=false/eula=true/' eula.txt

-Xms is the initial and -Xmx the maximum amount of memory. Don't allocate all of the server's RAM; leave at least 1 GB for the operating system.

Step 5: server.properties settings

sudo -u minecraft nano server.properties
SettingExampleDescription
motdMerkezHost MinecraftDescription shown in the server list
max-players20Players who can connect at the same time
online-modetrueGenuine accounts only; keep it on for security
white-listtrueOnly allowed players can join
view-distance8Lowering it boosts performance considerably
simulation-distance6Distance of processed chunks
difficultynormalGame difficulty

Step 6: Open the port in the firewall

Minecraft Java Edition uses port 25565/TCP by default:

sudo ufw allow OpenSSH
sudo ufw allow 25565/tcp
sudo ufw enable

For detailed firewall settings, see our UFW and Fail2Ban guide.

Step 7: Running 24/7 with systemd

Create a service file so that the server starts automatically if it crashes or the VDS reboots:

sudo nano /etc/systemd/system/minecraft.service
[Unit]
Description=Minecraft Sunucusu
After=network-online.target
Wants=network-online.target

[Service]
User=minecraft
WorkingDirectory=/opt/minecraft/server
ExecStart=/usr/bin/java -Xms2G -Xmx4G -XX:+UseG1GC -jar server.jar --nogui
Restart=on-failure
RestartSec=10
SuccessExitStatus=0 1 143

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now minecraft
sudo systemctl status minecraft
journalctl -u minecraft -f      # Follow the console output live
Sending commands to the console

To send commands to a server running under systemd, you can enable RCON in server.properties and use a tool such as mcrcon. If you prefer a simpler method, start the server in a screen -S minecraft session and return to the console with screen -r minecraft.

Step 8: Connecting to the game

In Minecraft, under Multiplayer » Add Server, enter your VDS's IP address as the server address. If you'd like to use a domain name, create an A record for mc.alanadiniz.com; if you use a different port, add an SRV record. Details: DNS records guide.

Performance tips

  • Use Paper and remove unnecessary plugins.
  • Keep the view-distance value in the 6-8 range.
  • Pre-generate the map; this reduces the lag that occurs when players explore new areas.
  • Limit builds that create large numbers of entities (animal farms, redstone machines).
  • NVMe SSD disks shorten world saving and chunk loading times.

Backups

World files are the server's most valuable data. Before taking a backup, send the save-off and save-all commands to the server, or stop the service briefly:

sudo systemctl stop minecraft
sudo tar -czf /root/mc-yedek-$(date +%F).tar.gz -C /opt/minecraft server/world server/world_nether server/world_the_end
sudo systemctl start minecraft

For automatic backups, you can adapt our Linux automatic backup guide.

Conclusion

In just a few steps you've set up a Minecraft server that runs 24/7 and restarts automatically. A high-frequency processor and DDoS protection are critical for a smooth gaming experience: our performance servers with AMD Ryzen 9 processors and layered DDoS protection are designed specifically for game servers.

Frequently Asked Questions

How much RAM does a Minecraft server need?

For a server with 5-10 players and no plugins, 2-4 GB is enough. As the number of mods, plugins and players grows, you'll need 6-8 GB or more.

Which matters more for a Minecraft server: CPU or RAM?

A Minecraft server does most of its world processing on a single core. That's why a high-frequency processor (e.g. AMD Ryzen 9) is at least as important as RAM.

Should I use Paper or Vanilla?

Paper is a performance-focused fork of the Vanilla server with plugin support. If you'll be using plugins and want higher performance, Paper is the better choice.

  • #minecraft server setup
  • #minecraft server
  • #game server
  • #java
  • #ubuntu
Share:
Read More

Related Guides