How to Set Up a Minecraft Server on Linux
Running your own Minecraft server gives you full control over plugins, performance, and who can join. This guide walks you through setting up a high-performance Paper server on Ubuntu.
Recommendation: For a lag-free Minecraft server with mods, plugins, and multiple players, we recommend a Prepaid Gaming KVM Server with AMD Ryzen 9 9950X. With up to 5.7 GHz single-core boost, DDR5 ECC memory, and full root access, even heavy chunk-loading runs smoothly.
1. Install Java
Minecraft requires Java 21 or newer. We recommend following our dedicated guide for this step: How to Install Java 21 on Linux.
Once Java is installed, you can verify it by running:
java -version2. Create a Dedicated User
Never run game servers as root. Create a dedicated system user:
sudo useradd -r -m -d /opt/minecraft -s /bin/bash minecraft3. Download PaperMC
Paper is a high-performance fork of Spigot that dramatically improves server TPS (ticks per second).
sudo su - minecraft
mkdir server && cd server
curl -o paper.jar https://api.papermc.io/v2/projects/paper/versions/1.21.4/builds/411/downloads/paper-1.21.4-411.jarNote: Check papermc.io for the latest build number.
4. First Run and EULA
Start the server once to generate configuration files:
java -Xms2G -Xmx4G -jar paper.jar --noguiThe server will stop and ask you to accept the EULA. Open the file and change false to true:
nano eula.txt
# Change eula=false to eula=true5. Optimize server.properties
Open server.properties and configure the basics:
server-port=25565
max-players=20
view-distance=8
simulation-distance=6
motd=\u00A7bMy Ryze Server \u00A77- Welcome!Lowering view-distance and simulation-distance massively improves performance on smaller VPS instances.
6. Run with PM2 (Keep Alive)
Exit back to root (exit) and use PM2 to keep the server running permanently:
sudo npm install pm2 -g
sudo -u minecraft pm2 start "java -Xms2G -Xmx4G -jar paper.jar --nogui" --name minecraft --cwd /opt/minecraft/server
sudo -u minecraft pm2 save
sudo env PATH=$PATH:/usr/bin pm2 startup systemd -u minecraft --hp /opt/minecraft7. Firewall
sudo ufw allow 25565/tcpYour friends can now connect using your server's IP address!
Ready for your own game server?
Launch your own gaming project on our high-performance KVM VPS with maximum AMD Ryzen single-core power, ultra-fast NVMe storage, and real Layer 3/4/7 DDoS protection (PletX & SmartNet). 100% prepaid with no contract lock-in.