Set Up a Minecraft Server on Ubuntu

Setting up a Minecraft server on Ubuntu gives you a predictable home for survival, creative, or community worlds. It also means handling Java, networking, updates, and backups yourself instead of using a hosted game panel. The result can be a small, dependable service that runs on hardware you already own.

The first decision is where it will run. A local machine keeps costs down and gives you full control; a virtual private server can provide steadier uptime and lower latency for distant players. The edition matters too: ordinary Bedrock Edition clients cannot join a Java Edition server without an extra bridge such as Geyser.

The setup below uses OpenJDK, the official Minecraft server software, a dedicated Linux account, and systemd. It stays deliberately small, but the same foundation can support plugins, a family LAN, or invited players from around Australia.

Pick hardware that matches the player count

Java Edition servers perform best with a fast processor, at least 4 GB of physical memory, and an SSD. For a vanilla world with two to six players, allocating 2 GB to Java is often sufficient. Plugins, mods, and larger crowds need considerably more memory, while Ethernet provides a more stable connection than Wi-Fi.

A home server is economical for local play, although upload speed and router configuration determine the remote experience. Australian NBN connections in cities and suburbs often have asymmetric speeds: downloads are quick, but player traffic may suffer during busy periods. Some regional fixed-wireless and business connections also use carrier-grade NAT, which can prevent ordinary port forwarding.

A virtual private server provides a public address, predictable uptime, and easier firewall control. Sydney and Melbourne are common hosting regions, while a Perth region can reduce lag for players in Western Australia. Australian providers often price plans in AUD and offer support during Australian business hours.

If you repurpose a laptop, check its thermals and battery health before leaving it running all day. UbuntuNext’s Tlp power tuning guide explains how to reduce idle power consumption, although a plugged-in desktop or mini PC is usually the better 24/7 choice.

Install Java and create a safe account

Recent Minecraft Java Edition releases require Java 21, while older versions may need Java 17. Install the headless runtime and basic tools with these commands:

sudo apt update
sudo apt install openjdk-21-jre-headless wget
java -version

Create a system account without administrator privileges. This prevents a compromised server process from gaining sudo access:

sudo adduser --system --group --home /opt/minecraft --no-create-home minecraft
sudo mkdir -p /opt/minecraft
sudo chown minecraft:minecraft /opt/minecraft

Download the server JAR from the official Minecraft server download page and save it as server.jar. Move that file into the server directory with the correct ownership:

sudo install -o minecraft -g minecraft -m 0644 \
  ~/Downloads/server.jar /opt/minecraft/server.jar

Start the server manually for its first launch. The first run creates the world, configuration files, and an EULA file, but stops immediately until you address the licence:

cd /opt/minecraft
sudo -u minecraft java -Xms1G -Xmx2G -jar server.jar nogui

Configure the first world and access list

Read the Minecraft EULA at /opt/minecraft/eula.txt. If you accept its terms, change the line to eula=true; merely changing the value does not replace the need to agree to the licence. Restart the server with the same command to generate the world and server.properties.

Review server.properties before inviting anyone. Set a sensible motd, max-players, difficulty, view-distance, and simulation-distance. Keep online-mode=true so that accounts are checked with Minecraft’s authentication service, and set white-list=true if the server is intended for selected players.

During the manual console session, add the first account and grant operator status only when needed:

whitelist add PlayerName
op PlayerName

The whitelist controls who may enter, while an operator can manage players and server settings. Avoid making every trusted friend an operator, because operators can execute powerful commands. Bedrock clients require a compatible separate bridge, such as a Geyser setup, and normally an additional UDP port; Java Edition continues to use TCP port 25565.

Run the server as a systemd service

Create /etc/systemd/system/minecraft.service with sudo nano. The unit starts the server after networking is ready and restarts it following an unexpected failure:

[Unit]
Description=Minecraft Java Server
After=network-online.target
Wants=network-online.target

[Service]
User=minecraft
WorkingDirectory=/opt/minecraft
ExecStart=/usr/bin/java -Xms1G -Xmx2G -jar server.jar nogui
Restart=on-failure
RestartSec=10
TimeoutStopSec=120
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

Enable the service and follow its logs:

sudo systemctl daemon-reload
sudo systemctl enable --now minecraft
sudo journalctl -u minecraft -f

The service is intentionally non-interactive, so ordinary server commands are not typed into journalctl. Use sudo systemctl stop minecraft for a controlled shutdown, or configure RCON with a long unique password if live administration is necessary. Limit RCON’s usual port 25575 to the private network and never publish it through the router. Adjust the memory values when the service unit changes, then reload systemd and restart the game.

Expose the game to local and remote players

For LAN play, give the Ubuntu machine a reserved address on the router and have players connect directly to that local IP. No public port forwarding is required. For internet access, forward external TCP port 25565 to the server’s reserved LAN address, and enable the matching Ubuntu firewall rule:

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

On NBN and other Australian broadband connections, compare the router’s WAN address with the server’s public address. If they differ, the connection may be behind carrier-grade NAT; contact the internet provider, request a public address where available, or use a VPS. A dynamic DNS name can keep the join address stable when a public address changes. Do not disable the firewall or forward RCON, SSH, or unrelated administration ports.

VPS hosting remains a practical choice for Australian groups. It removes the home upload constraint, but introduces another monthly bill and makes hardening essential. For a community build night, organisers can copy the clarity of community event listings: publish the start time, say whether it is an arvo session, and give members the correct join address.

Secure, back up, and monitor the server

Keep the game under the unprivileged minecraft account, use online-mode authentication, and maintain a whitelist for private servers. SSH should use key-based login where possible, and Ubuntu security updates should be installed regularly. Backups contain player and world data, so store them with restricted permissions and keep at least one copy away from the server machine.

A consistent backup requires a brief stop so that chunks and player data are not saved midway through writing. This simple command captures the entire server directory:

sudo systemctl stop minecraft
sudo tar -czf "/var/backups/minecraft-$(date +%F).tar.gz" \
  -C /opt/minecraft .
sudo systemctl start minecraft

Rotate several dated copies and test a restore occasionally; a backup that has never been restored is only an assumption. When scheduling these jobs, account for Australian time practices. Sydney and Melbourne shift their clocks during daylight saving, while Brisbane remains on AEST, so an automated maintenance window should use the intended Australia/ time zone rather than relying on an ambiguous clock.

Watch memory with free -h and top, then adjust the Java allocation if the process approaches the limit. Leave physical memory free for Ubuntu and avoid setting the maximum too high. Check journalctl -u minecraft for crashes, out-of-memory errors, or repeated world saves. Minecraft releases and the server JAR must also be updated separately, so back up first and review plugin compatibility before replacing the JAR.

Complete a controlled first-player test

Test in stages. First, connect from the same LAN and confirm that the world appears, blocks can be placed, and player data is written. Restart minecraft.service, reconnect, and check that the changes remain. This verifies file ownership, Java settings, and shutdown handling before outside access is introduced.

If the server works locally but not through the internet, compare the UFW rule, router forwarding, public address, and TCP port. A connection timeout usually indicates a firewall, NAT, or router problem, while a crash in the journal points toward Java memory, a corrupt world, or plugin compatibility.

The concrete next step is a ten-minute local test with one player: connect using the server’s LAN address, place and break a block, stop and restart minecraft.service, and confirm the change survived the restart.