zettelkasten

Search IconIcon to open search
Dark ModeDark Mode

Deploying a Minecraft Server on Linux

Date: 7 Oct 2021

#post

This post originally appeared on Blog 2.0


I decided to set up a minecraft server on my home server for some reason.

First install java

sudo apt update
sudo apt install default-jdk

check version

java -version

make a place for mc server

mkdir mc-server

from mc server dir, download a mc server. link can be found in mc launcher

rename the server if you wish mv server.jar mc-server.1.17.1.jar

run using java -Xmx1024M -Xms1024M -jar mc-server.1.17.1.jar nogui

to accept eula, change set eula=true in eula.txt

allow through firewall if needed sudo ufw allow 25565


run -jar mc-server.1.17.1.jar --help to get help

run using java -Xmx1024M -Xmx4G -jar mc-server.1.17.1.jar nogui to get bigger memory size


server.properties file allows configuration

see https://minecraft.fandom.com/wiki/Server.properties for how to configure.

Personal config

#Minecraft server properties
#(last boot timestamp)
spawn-protection=16
max-tick-time=60000
query.port=25565
generator-settings=
sync-chunk-writes=true
force-gamemode=false
allow-nether=true
enforce-whitelist=true
gamemode=survival
broadcast-console-to-ops=true
enable-query=false
player-idle-timeout=0
text-filtering-config=
difficulty=hard
broadcast-rcon-to-ops=true
spawn-monsters=true
op-permission-level=4
pvp=true
entity-broadcast-range-percentage=100
snooper-enabled=true
level-type=default
enable-status=true
resource-pack-prompt=
hardcore=false
enable-command-block=false
network-compression-threshold=256
max-players=20
max-world-size=29999984
resource-pack-sha1=
function-permission-level=2
rcon.port=25575
server-port=25565
server-ip=
spawn-npcs=true
require-resource-pack=false
allow-flight=false
level-name=world
view-distance=12
resource-pack=
spawn-animals=true
white-list=true
rcon.password=
generate-structures=true
online-mode=true
level-seed=
prevent-proxy-connections=false
use-native-transport=true
enable-jmx-monitoring=false
motd=A Minecraft Sanctuary
rate-limit=0
enable-rcon=false

whitelist.json

[
  {
    "uuid": "f430dbb6-5d9a-444e-b542-e47329b2c5a0",
    "name": "username"
  },
  {
    "uuid": "e5aa0f99-2727-4a11-981f-dded8b1cd032",
    "name": "username"
  }
]

reverse proxy to server using frp

[Minecraft]

type = tcp
local_ip = 127.0.0.1
local_port = 25565
remote_port = 25565

Fix this error

java.lang.UnsupportedClassVersionError: net/minecraft/server/Main has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 55.0

add repo sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt install openjdk-17-jdk


Installing datapack

There are great datapacks here https://vanillatweaks.net/picker/datapacks/

Put files in the datapack folder

Type /reload to reload after install when server’s running

Run /datapack list enabled to check what’s loaded


  1. https://minecraft.fandom.com/wiki/Tutorials/Setting_up_a_server
  2. https://phoenixnap.com/kb/minecraft-dedicated-server
  3. https://minecraft.fandom.com/wiki/Server.properties
  4. https://minecraft.fandom.com/wiki/Tutorials/Installing_a_data_pack