Ultra-lightweight PaperMC Server

[PaperMC]

How to set up an ultralight PaperMC server

..on a shitty Ubuntu 24.04.4 VPS with 2GB RAM already running a Wireguard server. (In my case)

The official vanilla server software from Mojang is kind of a mess. It’s single-threaded, so it hogs resources and lags when a few players start exploring. That’s why pretty much everyone uses PaperMC instead. It’s a Spigot fork that actually optimizes the backend & does things like loading chunks on separate CPU threads and patching game-breaking exploits. If you’re hosting a server on a budget or using an old PC, Paper is basically the default choice.

Ensure the system is up-to-date and install OpenJDK

sudo apt update -y # And if there are any upgradeable packages, do sudo apt upgrade
sudo apt install openjdk-17-jre-headless -y # 17 is recommended for 1.20.x but check & make sure
java -version # Verify installation

Each Minecraft version has different Java requirements and recommended versions, look up which one is best for yours and get that.

Create a dedicated Minecraft user for security

sudo adduser minecraft

Then just press enter to go with the default, and do:

sudo su - minecraft

Download the JAR for your preferred Paper server

Head on over to PaperMC to grab the JAR for your preferred Minecraft version.

I'm going to be using 1.20.4:

mkdir ~/server
cd ~/server
# The -O flag renames the downloaded file to paper.jar
wget https://api.papermc.io/v2/projects/paper/versions/1.20.4/builds/496/downloads/paper-1.20.4-496.jar -O paper.jar

Configure UFW

Exit the minecraft user with exit first to go back into root.

sudo ufw allow 52304/tcp # Or anything else just PLEASE don't set the port to 25565 (the default port) 'cause scary-ass bots will fuck your server up
sudo ufw allow ssh # Only if it's not already allowed, and if you are using ssh even
sudo ufw enable # Only if it's not already enabled
sudo ufw status  # Verify the port rule is active
sudo su - minecraft # Log back into the minecraft user

Create a server startup script

Open run.sh with whatever text editor you have on hand.

These are my settings for it, tailored for the specs of my VPS:

#!/bin/bash
java -Xms1G -Xmx1280M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=4M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar paper.jar nogui

Make it executable:

chmod +x run.sh

Run it & accept the EULA

./run.sh  # Server will fail initially
nano (or whatever) eula.txt  # Change "eula=false" to "eula=true"

Edit server.properties to customize server settings

Use your text editor and open server.properties

My server.properties for reference:

#Minecraft server properties
#Thu Apr 30 20:32:16 UTC 2026
enable-jmx-monitoring=false
rcon.port=52304
level-seed=12345
gamemode=survival
enable-command-block=false
enable-query=false
generator-settings={}
enforce-secure-profile=true
level-name=world
motd=This is the description sorta thing
query.port=52304
pvp=true
generate-structures=true
max-chained-neighbor-updates=1000000
difficulty=easy
network-compression-threshold=256
max-tick-time=60000
require-resource-pack=false
use-native-transport=true
max-players=3
online-mode=false
enable-status=true
allow-flight=false
initial-disabled-packs=
broadcast-rcon-to-ops=true
view-distance=6
server-ip=
resource-pack-prompt=
allow-nether=true
server-port=52304
enable-rcon=false
sync-chunk-writes=false
resource-pack-id=
op-permission-level=4
prevent-proxy-connections=false
hide-online-players=false
resource-pack=
entity-broadcast-range-percentage=75
simulation-distance=6
rcon.password=
player-idle-timeout=0
debug=false
force-gamemode=false
rate-limit=0
hardcore=false
white-list=false
broadcast-console-to-ops=true
spawn-npcs=true
spawn-animals=true
log-ips=true
function-permission-level=2
initial-enabled-packs=vanilla
level-type=minecraft\:normal
text-filtering-config=
spawn-monsters=true
enforce-whitelist=false
spawn-protection=16
resource-pack-sha1=
max-world-size=29999984

Just play around with them, tailor them for your VPS and needs and wants.

Finally run the Minecraft server

Start the server in a screen session to keep it running in the background:

(Make sure you are in the server folder, always)

screen -S minecraft # -S stands for "session name"
./run.sh

Connect to the bitchass server

Add the server using the VPS's IP address or custom domain name.

How to maintain it

Maybe you wanted to change some server properties or add an OP?

While you are in the screen session, that's basically the Minecraft server console where you can run commands. Such as op <username> to add an op without using a .json, which is a little more work.
I mean, the op command saves to that .json anyways.

OR maybe you changed some settings in server.properties and have to restart? In that case, do:

stop
exit

And to start it again, just do screen -S minecraft again.


Just as a sidenote, if you get disconnected or can't type any more,
do screen -r to reattach to that screen.

Or if you accidentally ran the screen command as the root user,
do screen -ls then screen -X -S 1234.minecraft quit (Replace 1234 with what's on your screen).

That is how you kill a screen session. Whoopdee-doo.

Also, you can run ps aux | grep java to verify that it has stopped.