😁 About me 📜 Articles 📚️ Bookshelf 📧 Contact 🎮 Games 🥞 Recipes 📙 Things I use 🔗 Links
🇺🇸 🇵🇱

Creating a minecraft server on debian

#software #linux #tutorial #minecraft #games

2024-04-23

In this guide I will install and setup debian machine for running a minecraft server. I will use 1.20.4 version of it with some fabric additions to make it run much faster.

Installing java

sudo apt update
sudo apt install default-jre

Verify the installation with:

java -version

Minecraft 1.18 and newer needs JRE version 17 or higher.

Creating a Minecraft User

Let's just say that for many reasons you don't wont your server running with root privileges. So, we will create a new user:

sudo adduser minecraft

Switch to this user:

su - minecraft

Download the Minecraft Server

Move to directory where you wont to have this server. I have chosen /srv/minecraft.

For fabric downloading we will use curl.

curl https://meta.fabricmc.net/v2/versions/loader/1.20.4/0.15.9/1.0.0/server/jar > fabric.jar

You can get a link for your specific version from fabric website

Run it once to download minecraft.

java -Xmx2G -jar fabric.jar nogui

Startup service

After reading mojang's EULA (because you will), accept it throw:

echo "eula=true" > eula.txt

/etc/systemd/system/minecraft.service:

ExecReload=/usr/bin/screen -S minecraft -X stuff \"reload^M\"

ExecStart=/usr/bin/screen -DmS minecraft /usr/bin/java -Xms2G -Xmx7G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -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 -jar fabric.jar --nogui

ExecStop=/usr/bin/screen -S minecraft -X stuff \"save-all^M\"
ExecStop=/bin/sleep 5
ExecStop=/usr/bin/screen -S minecraft -X stuff \"stop^M\"
ExecStop=/bin/sleep 5

ProtectControlGroups=true
ProtectHome=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=full

PrivateDevices=true
PrivateUsers=true

User=minecraft
Group=minecraft

WorkingDirectory=/srv/minecraft

Ferium (Mod Manager)

Ferium is a great command line minecraft modmanager.

Installation

I assume that you are using arm64 arch, but if you are not, then good luck.

wget https://github.com/gorilla-devs/ferium/releases/download/v4.5.2/ferium-linux-arm64-nogui.zip
unzip ferium-linux-arm64-nogui.zip
rm ferium-linux-arm64-nogui.zip