While Cubes Hosting offers automated 1-click Minecraft server hosting via our Game Panel, hosting your Minecraft server on a Linux VPS (Virtual Private Server) gives advanced developers full terminal control, custom startup flags, and root file access.
To keep your Minecraft server console running 24/7 in the background—even after you disconnect your SSH session—you can use GNU screen.
This step-by-step guide will walk you through installing Java 21, downloading PaperMC, configuring eula.txt, and managing your Minecraft server inside a screen session on Ubuntu or Debian.
Step 1: Install Java 21 and GNU Screen
Modern Minecraft versions (1.20.5 and newer) require Java 21.
- Connect to your VPS via SSH as
rootor a user withsudoprivileges. - Update your package manager and install OpenJDK 21, GNU Screen, and wget:
sudo apt update && sudo apt install -y openjdk-21-jre-headless screen wget ufw - Verify that Java 21 is installed correctly:
(The output should confirm
java -versionopenjdk version "21.0.x").
Step 2: Download PaperMC Server .jar
PaperMC is a highly optimized Minecraft server software that fixes vanilla server bugs and improves performance.
- Create a dedicated directory for your server files:
mkdir -p /home/minecraft && cd /home/minecraft - Download the latest PaperMC
.jarfile usingwget:# Download PaperMC (replace URL with latest version build if needed) wget https://api.papermc.io/v2/projects/paper/versions/1.20.4/builds/496/downloads/paper-1.20.4-496.jar -O server.jar
Step 3: Accept the Minecraft EULA
Minecraft servers require you to accept Mojang's End User License Agreement before booting:
- Run the server once to generate configuration files:
java -Xms1G -Xmx1G -jar server.jar nogui
(The server will stop automatically after generatingeula.txt). - Edit
eula.txt:nano eula.txt - Change
eula=falsetoeula=true:eula=true - Save and exit (
CTRL + O,Enter,CTRL + X).
Step 4: Launch Minecraft Inside a screen Session
GNU screen creates a virtual terminal window that remains active in the server background even when you log off SSH.
- Create a new screen session named
minecraft:screen -S minecraft
(Your terminal window will clear, placing you inside the new virtual screen). - Launch your PaperMC server with your desired RAM allocation:
java -Xms2G -Xmx4G -XX:+UseG1GC -jar server.jar nogui
(Replace-Xmx4Gwith the maximum RAM allocated to your server, e.g.-Xmx8Gfor 8GB).
Your Minecraft server will generate the world and display Done! For help, type "help".
Step 5: How to Detach and Reattach to Your Console
How to Detach (Leave Server Running in Background):
To exit the screen terminal while keeping your Minecraft server running:
- Press
CTRL + A, then release both keys and pressD.
You will return to your main VPS SSH prompt with the message [detached from minecraft]. You can now safely close your SSH terminal!
How to Reattach to the Minecraft Console:
When you log back into SSH later and want to issue operator commands (/op player) or view server logs:
screen -r minecraft
List All Active Screen Sessions:
screen -ls
Step 6: Open Firewall Port 25565 (UFW)
Ensure Java Edition players can connect to your server by opening default port 25565:
sudo ufw allow 25565/tcp
sudo ufw enable
Players can now join your server in Minecraft using your VPS IP address (YOUR_VPS_IP:25565)!
Useful Screen Shortcut Commands Cheat Sheet
| Command | Action |
|---|---|
screen -S minecraft | Create a new named screen session |
CTRL + A then D | Detach from active screen (keep running in background) |
screen -r minecraft | Reattach to running Minecraft console |
screen -ls | List all running screen sessions |
exit | Close and kill active screen session (run inside screen) |
Conclusion
Running Minecraft inside a GNU screen session gives you total control over server flags, console access, and 24/7 background uptime on your Cubes Hosting Linux VPS! Reattach anytime with screen -r minecraft, manage your community, and enjoy high-performance hosting!
