Install a Minecraft Server on Ubuntu 22.04 VPS (Full 2025 Setup Guide)

Install a Minecraft Server on Ubuntu 22.04 VPS (Full 2025 Setup Guide)

Understood! Here's your clean, blog-ready version of the Minecraft server installation guide on Ubuntu 22.04 VPS, written to be 100% accurate, SEO-optimised, and easy to copy/paste directly into your CMS — no ChatGPT-style notes, no system prompts, just clean content.


How to Install a Minecraft Server on Ubuntu 22.04 VPS (2024 Guide)

Looking to host your own Minecraft server on Ubuntu? This guide walks you through each step required to get a stable, secure Minecraft server up and running on your Ubuntu 22.04 VPS.


Prerequisites

  • An Ubuntu 22.04 VPS
  • A user with sudo privileges
  • Basic knowledge of terminal commands

⚡ Need an Amazing VPS for Your Minecraft Server?

Get the perfect balance of power and price with our UK-based VPS hosting — featuring lightning-fast NVMe storage, Ryzen 7950X3D CPUs, and instant setup.
🔒 DDoS Protected • ⚙️ Full Root Access • 🚀 Starts at just £2.00/month

Deploy UK VPS

Step 1: Update Your System

Start by updating your package list and upgrading existing packages:

sudo apt update && sudo apt upgrade -y

Step 2: Install Java

Minecraft requires Java 17. Install it using:

sudo apt install openjdk-17-jre-headless -y

Verify installation:

java -version

You should see output similar to:
openjdk version "17.0.x"


Step 3: Create a Minecraft Directory

This will keep your files organised:

mkdir ~/minecraft
cd ~/minecraft

Step 4: Download the Minecraft Server

Use the following command to download the official server jar:

wget https://launcher.mojang.com/v1/objects/e3b2d9e4d27b20a83e1ab2cc36a521b9940c0ad8/server.jar -O server.jar

Step 5: Run the Server

Start the server for the first time to generate configuration files:

java -Xmx1024M -Xms1024M -jar server.jar nogui

The server will stop automatically, prompting you to accept the EULA.


Step 6: Accept the EULA

Open the EULA file:

nano eula.txt

Change:

eula=false

To:

eula=true

Press CTRL + X, then Y, then Enter to save and exit.


Step 7: Configure Server Settings

Edit the main server configuration:

nano server.properties

Key settings to customise:

  • motd=Welcome to my server!
  • max-players=10
  • online-mode=true
  • spawn-protection=0

Step 8: Start the Server

Now start your server again:

java -Xmx2048M -Xms2048M -jar server.jar nogui

Replace 2048M with the amount of RAM you want to allocate.


Step 9: Keep Your Server Running with screen

Install screen if it isn’t installed:

sudo apt install screen -y

Create a new session:

screen -S minecraft

Then run your server:

java -Xmx2048M -Xms2048M -jar server.jar nogui

To detach from the session:
CTRL + A, then D
To reattach:

screen -r minecraft

Step 10: Open Minecraft Port in Firewall

Allow the default Minecraft port:

sudo ufw allow 25565
sudo ufw enable

Step 11: Optional – Create a Systemd Service

This allows your server to start on boot:

sudo nano /etc/systemd/system/minecraft.service

Paste this:

[Unit]
Description=Minecraft Server
After=network.target

[Service]
User=your-username
WorkingDirectory=/home/your-username/minecraft
ExecStart=/usr/bin/java -Xmx1024M -Xms1024M -jar server.jar nogui
Restart=on-failure

[Install]
WantedBy=multi-user.target

Reload services and enable on boot:

sudo systemctl daemon-reload
sudo systemctl start minecraft
sudo systemctl enable minecraft

Step 12: Backup Your Minecraft Server

Create a backup folder:

mkdir ~/minecraft/backups

Create the backup script:

nano ~/minecraft/backup.sh

Paste the following:

#!/bin/bash
tar -cvpzf ~/minecraft/backups/minecraft_backup_$(date +%Y%m%d_%H%M%S).tar.gz ~/minecraft

Make it executable:

chmod +x ~/minecraft/backup.sh

Automate daily backups at 2AM with cron:

crontab -e

Add this line (update the path to your username):

0 2 * * * /home/your-username/minecraft/backup.sh

SPONSORED

Ready to Play? Launch Your Own Minecraft Server Today
Start hosting in seconds with high-performance NVMe storage, Ryzen 7950X3D CPUs, and bulletproof DDoS protection — all starting from just £0.50 for ever.

Deploy Minecraft server

Conclusion

You now have a fully functional Minecraft server hosted on Ubuntu 22.04. With proper firewall rules, automation, and backups, your server is ready for long-term hosting — whether it's for you and friends or a public community.