Setup Minecraft Java Server PaperMC on Arch Linux based lxc container
Install PaperMC
setup environment
1
2
3
4
5
|
pacman -S jre-openjdk-headless
mkdir -p /opt/minecraft/{papermc,latest,plugins}
mkdir -p /opt/minecraft/latest/plugins
useradd -d /opt/minecraft -M -r -U minecraft -s /bin/sh
chown -Rvf minecraft:minecraft /opt/minecraft
|
download PaperMC
download latest version from https://papermc.io/downloads/paper
1
2
3
|
cd /opt/minecraft/papermc
wget https://api.papermc.io/v2/projects/paper/versions/1.20.4/builds/386/downloads/paper-1.20.4-386.jar
ln -sf /opt/minecraft/papermc/paper-1.20.4-386.jar /opt/minecraft/latest/server.jar
|
server.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
cat > /opt/minecraft/latest/server.properties << EOF
enable-jmx-monitoring=false
rcon.port=25575
level-seed=
gamemode=survival
enable-command-block=true
enable-query=false
generator-settings={}
enforce-secure-profile=false
level-name=world
motd=myPrivate Minecraft Server
query.port=25565
pvp=true
generate-structures=true
max-chained-neighbor-updates=1000000
difficulty=easy
network-compression-threshold=512
max-tick-time=60000
require-resource-pack=false
use-native-transport=true
max-players=6
online-mode=true
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=25565
enable-rcon=true
sync-chunk-writes=true
resource-pack-id=
op-permission-level=4
prevent-proxy-connections=false
hide-online-players=false
resource-pack=
entity-broadcast-range-percentage=100
simulation-distance=10
rcon.password=30092008Alexander
player-idle-timeout=0
debug=false
force-gamemode=false
rate-limit=0
hardcore=false
white-list=true
broadcast-console-to-ops=true
spawn-npcs=true
spawn-animals=true
log-ips=true
function-permission-level=2
initial-enabled-packs=vanilla
level-type=default
text-filtering-config=
spawn-monsters=true
enforce-whitelist=true
spawn-protection=16
resource-pack-sha1=
max-world-size=29999984
EOF
|
install whitelist.json
Remember to prepend minecraft bedrock (see Geyser plugin below) usernames with .
1
2
3
4
5
6
7
8
9
10
11
12
|
cat > /opt/minecraft/latest/whitelist.json << EOF
[
{
"uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "myJavaUser"
},
{
"uuid": "00000000-0000-0000-xxxx-xxxxxxxxxxxx",
"name": ".myBedrockUser"
}
]
EOF
|
install ops.json
1
2
3
4
5
6
7
8
9
10
|
cat > /opt/minecraft/latest/ops.json << EOF
[
{
"uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "myJavaUser",
"level": 4,
"bypassesPlayerLimit": true
}
]
EOF
|
accept End User License Agreement (EULA)
1
2
3
|
cat > /opt/minecraft/latest/eula.txt << EOF
eula=true
EOF
|
Install additional Plugins
ServerTap - Management API
Docs here: https://servertap.io/
Latest version here: https://github.com/servertap-io/servertap/releases/latest
1
2
|
wget https://github.com/servertap-io/servertap/releases/download/v0.6.1/ServerTap-0.6.1.jar -O /opt/minecraft/plugins/ServerTap-0.6.1.jar
ln -sf /opt/minecraft/plugins/ServerTap-0.6.1.jar /opt/minecraft/latest/plugins/ServerTap.jar
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
mkdir -p /opt/minecraft/latest/plugins/ServerTap/
chown minecraft:minecraft /opt/minecraft/latest/plugins/ServerTap/
cat > /opt/minecraft/latest/plugins/ServerTap/config.yml << EOF
port: 4567
debug: false
useKeyAuth: true
key: 'OuguiJ5ahd7Eejae'
normalizeMessages: true
tls:
enabled: false
corsOrigins:
- "*"
websocketConsoleBuffer: 1000
disable-swagger: true
EOF
|
Geyser + Floodgate - Minecraft Bedrock
Play Minecraft with Bedrock and Java clients
Docs here: https://geysermc.org
Latest version here: https://geysermc.org/download
1
2
3
4
5
|
wget https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/spigot -O /opt/minecraft/plugins/Geyser_build412.jar
ln -sf /opt/minecraft/plugins/Geyser_build412.jar /opt/minecraft/latest/plugins/Geyser.jar
wget https://download.geysermc.org/v2/projects/floodgate/versions/latest/builds/latest/downloads/spigot -O /opt/minecraft/plugins/Floodgate_build87.jar
ln -sf /opt/minecraft/plugins/Floodgate_build87.jar /opt/minecraft/latest/plugins/Floodgate.jar
|
Multiverse Core - create multiple worlds
1
2
|
wget https://dev.bukkit.org/projects/multiverse-core/files/4744018/download -O /opt/minecraft/plugins/Multiverse-Core_4.3.12.jar
ln -sf /opt/minecraft/plugins/Multiverse-Core_4.3.12.jar /opt/minecraft/latest/plugins/Multiverse-Core.jar
|
Terra World Generator
Docs and latest version can be found here: https://modrinth.com/plugin/terra
Download Bukkit version for usage with PaperMC.
1
2
|
wget https://cdn.modrinth.com/data/FIlZB9L0/versions/lBGwt5NT/Terra-bukkit-6.4.3-BETA%2Bab60f14ff-shaded.jar -O /opt/minecraft/plugins/Terra-bukkit-6.4.3-shaded.jar
ln -sf /opt/minecraft/plugins/Terra-bukkit-6.4.3-shaded.jar /opt/minecraft/latest/plugins/Terra.jar
|
Systemd Service
install service file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
cat > /etc/systemd/system/minecraft.service << EOF
[Unit]
Description=Minecraft Server
After=syslog.target network.target
[Service]
SuccessExitStatus=143
User=minecraft
Group=minecraft
Type=simple
WorkingDirectory=/opt/minecraft/latest
ExecStart=/usr/bin/java -Xmx4G -Xms4G -jar server.jar --nogui
ExecStop=/bin/kill -15 $MAINPID
[Install]
WantedBy=multi-user.target
EOF
|
start service
1
|
systemctl start minecraft.service
|
enable service
1
|
systemctl enable minecraft.service
|
setup LXD portforwardings
Configure portforwarding for your minecraft clients to connect to the server. Update external ports (listen=…) as appropriate.
java clients
1
2
|
lxc config device add minecraft-server tcp25565_4 proxy connect=tcp:10.0.0.57:25565 listen=tcp:[0.0.0.0]:25565 nat=true proxy_protocol=false
lxc config device add minecraft-server tcp25565_6 proxy connect=tcp:[fd00::57:1]:25565 listen=tcp:[::]:25565 nat=true proxy_protocol=false
|
bedrock clients (geyser plugin neccessary)
1
2
|
lxc config device add minecraft-server udp19132_4 proxy connect=udp:10.0.0.57:19132 listen=udp:[0.0.0.0]:19132 nat=true proxy_protocol=false
lxc config device add minecraft-server udp19132_6 proxy connect=udp:[fd00::57:1]:19132 listen=udp:[::]:19132 nat=true proxy_protocol=false
|