Table of Contents
Originally written December 2021, updated July 2023
Donate
If you like this content, consider sending me an anonymous tip with Zcash:
zs195rfh80s5m6chxrqej57fg9vxw2ypw2p9ppv3e5f44dstcu36f59pxfukugmgzxnp2djvu6w2jd
Intro
I love Minecraft. Recently I started learning about running Minecraft servers. I'm still a n00b, but I want to start sharing my configs so I can get feedback from the community.
Got feedback for me? email yawnbox at disobey dot net
I started using Purpur in order to support vanilla Minecraft plugins and for server performance enhancements. I am also using Adoptium Java for the stability, performance, and security benefits rather than using OpenJDK.
Like always, I'm using Ubuntu Server LTS, 22.04 at the time of writing.
Install and Setup
Presuming you have already enabled the inbound firewall for server security, open up the Minecraft port:
sudo ufw limit 25565/tcp && sudo ufw reload
First, install some dependencies:
sudo apt install zip screen apt-transport-https
Change to the root user:
sudo su root
Install Adoptium's Temurin 17 for Java: https://adoptium.net/installation.html
mkdir -p /etc/apt/keyrings
wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc
echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
apt update && apt install temurin-17-jdk -V
Validate:
java -version
Create a limited user that will be running Minecraft on the server, for security:
adduser minecraft
Be sure to create and save a secure password via password manager.
Log in as this user:
su minecraft
Start a "screen" session:
screen
Create a new folder for the server:
cd && mkdir purpur && cd purpur/
Download Purpur:
wget https://api.purpurmc.org/v2/purpur/1.20.1/2014/download --content-disposition
Create a start script that will start Minecraft:
- Server filename: purpur-1.20.1-2014.jar
- RAM amount: 16000M
vim start.sh
Paste this in (change the JAR file to current, change the RAM amount to what you have):
#!/bin/bash
JAVA="java"
JAR="purpur-1.20.1-2014.jar"
RAM="16000M"
FLAGS="-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=40 -XX:G1MaxNewSizePercent=50 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=15 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=20 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1"
echo "Starting server..."
${JAVA} -Xmx${RAM} -Xms${RAM} ${FLAGS} --add-modules=jdk.incubator.vector -jar ${JAR} --nogui
To exit vim and save changes:
:wq
Make the script executable:
chmod +x start.sh
Accept the EULA in advance of running the first time:
rm -f eula.txt && touch eula.txt && echo 'eula=true' >> eula.txt && cat eula.txt
Start Minecraft for the first time to setup the files:
./start.sh
Note about the first run
When I ran the start script the first time, I saw "Downloading mojang_1.20.1.jar" for a long time and nothing seemed to be happening. To test, I downloaded it manually to my minecraft server just to see if there was a connection issue, but it seems it's just a very slow download. Less than 100 KB/s yet only a 46 MB file. Could take as long as 20 minutes, so just be patient. Manually downloading the server.jar file does not speed up the script.
After the download completes, the script will start Minecraft for the first time.
Resume
Type "stop" to stop the server. Now there are many other files and folders in the purpur directory.
I start out by editing my server.properties file:
vim server.properties
Things I typically change:
motd=your.domain.com
difficulty=hard
max-players=9000
allow-flight=true
view-distance=32
server-ip=1.2.3.4
server-name=your.domain.com
level-type=AMPLIFIED
Then start the server back up!
./start.sh
To exit "screen" to leave the Minecraft server running, type and hold Ctrl then press A and D.
Enjoy!
Plugins
You have to stop the server, download the plugin jar files, and start the server back up for the plugins to be used. I'd watch YouTube about the most popular plugins for ideas.
cd plugins/
MineTinker
wget https://github.com/Flo56958/MineTinker/releases/download/v1.8.1/MineTinker.jar
WorldEdit
wget https://dev.bukkit.org/projects/worldedit/files/latest --content-disposition
WorldGuard
wget https://dev.bukkit.org/projects/worldguard/files/latest --content-disposition
cd ..
./start.sh
Maintenance
To backup a world manually:
zip -r world.zip world/
To delete a world and start over (while the server is stopped):
rm -r world/
Be sure to keep Adoptium's Java up to date, and of course all other system packages:
sudo apt update && sudo apt dist-upgrade -V && sudo apt autoremove -y && sudo apt autoclean