Article Background
Back to Knowledgebase

How to Set Up a Minecraft Server on a Linux VPS Using Screen

VPS
Cubes Support
July 20, 2026

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.

  1. Connect to your VPS via SSH as root or a user with sudo privileges.
  2. 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
    
  3. Verify that Java 21 is installed correctly:
    java -version
    
    (The output should confirm openjdk 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.

  1. Create a dedicated directory for your server files:
    mkdir -p /home/minecraft && cd /home/minecraft
    
  2. Download the latest PaperMC .jar file using wget:
    # 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:

  1. Run the server once to generate configuration files:
    java -Xms1G -Xmx1G -jar server.jar nogui
    

    (The server will stop automatically after generating eula.txt).
  2. Edit eula.txt:
    nano eula.txt
    
  3. Change eula=false to eula=true:
    eula=true
    
  4. 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.

  1. Create a new screen session named minecraft:
    screen -S minecraft
    

    (Your terminal window will clear, placing you inside the new virtual screen).
  2. Launch your PaperMC server with your desired RAM allocation:
    java -Xms2G -Xmx4G -XX:+UseG1GC -jar server.jar nogui
    

    (Replace -Xmx4G with the maximum RAM allocated to your server, e.g. -Xmx8G for 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 press D.

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

CommandAction
screen -S minecraftCreate a new named screen session
CTRL + A then DDetach from active screen (keep running in background)
screen -r minecraftReattach to running Minecraft console
screen -lsList all running screen sessions
exitClose 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!

Special Offer

Ready to Start Your Server?

Get 10% OFF your first month on any server with promo code CUBES10 at checkout!

24/7 Assistance

Need Help With Your Server?

Already a Cubes Hosting customer and couldn't find your answer? Our dedicated support team is available 24/7.