How to set up a Minecraft server on a VPS
Run a fast, always-on Minecraft server for you and your friends on a Linux VPS — from installing Java to keeping the world running 24/7.
Running your own Minecraft server means no player caps you didn't choose, no shared-host lag, and full control over plugins and mods. A VPS is the sweet spot: cheaper than dedicated hardware, far more capable than a laptop under your desk, and online around the clock.
What you'll need
- A VPS with at least 2 GB of RAM (4 GB is comfortable for a handful of friends and plugins)
- Ubuntu 24.04 or Debian — this guide uses Ubuntu
- SSH access to your server as a user with sudo
Step 1: Update the system
First, connect over SSH and get the box up to date:
sudo apt update && sudo apt upgrade -y
Step 2: Install Java
Modern Minecraft needs Java 21. Install the headless JRE:
sudo apt install openjdk-21-jre-headless -y
java -version
Step 3: Create a dedicated user and folder
Never run game servers as root. Make a user just for Minecraft:
sudo adduser --disabled-password minecraft
sudo su - minecraft
mkdir server && cd server
Step 4: Download and run the server
Grab the official server jar from minecraft.net (copy the current URL), then start it once so it generates config files:
wget -O server.jar "PASTE_SERVER_JAR_URL"
java -Xmx2G -Xms2G -jar server.jar nogui
The first run stops immediately and creates eula.txt. Open it, change eula=false to eula=true to accept Mojang's license, and start it again.
Step 5: Keep it running with a service
You don't want the server dying when you close SSH. The simplest robust option is a screen session:
sudo apt install screen -y
screen -S mc
java -Xmx2G -Xms2G -jar server.jar nogui
Press Ctrl+A then D to detach — the server keeps running. Reattach any time with screen -r mc.
Step 6: Open the port
Minecraft uses TCP port 25565. Make sure it's reachable. On a managed VPS you may forward the port from your dashboard; if you run a firewall directly:
sudo ufw allow 25565/tcp
Give your friends your server's IP (and port if it isn't the default) and you're live.
Tips for a smooth server
- Tune
server.properties— setview-distanceto 8–10 to save RAM - Take regular backups of the
worldfolder before big changes - If you want plugins, swap the vanilla jar for Paper, which is faster and plugin-ready
On an NVMe-backed VPS, chunk loading and world saves are dramatically snappier than on spinning disks or oversold shared hosting — which your players will feel every time they explore new terrain.