Minecraft Bedrock Linux Server

Create user for minecraft

Good password generator: https://1password.com/password-generator

# useradd --create-home --shell /bin/bash --password iQ0ia32fjdh5EKUcKs mcserver
# apt install unzip w3m

Install Minecraft Bedrock Server

Minecraft Bedrock Server Download Link: https://www.minecraft.net/en-us/download/server/bedrock

# cd /home/mcserver/
# mkdir minecraft
# cd minecraft
# wget --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" https://www.minecraft.net/bedrockdedicatedserver/bin-linux/bedrock-server-1.21.51.02.zip
# unzip bedrock-server-1.21.51.02.zip -d .
# chown mcserver:mcserver -R ./

Edit Server Properties / Enable whitelist

# vi server.properties
server-name: Epic MCB Server
allow-cheats: true
allow-list: true

Configure Daemon / Auto Start

# vi /etc/systemd/system/minecraft.service
[Unit]
Description=Minecraft Bedrock Server
Wants=network-online.target
After=syslog.target network.target network-online.target

[Service]
Type=simple
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
User=mcserver
Group=mcserver
Type=forking
ExecStart=/usr/bin/tmux new-session -d -s minecraft 'LD_LIBRARY_PATH=/home/mcserver/minecraft /home/mcserver/minecraft/bedrock_server'
ExecStop=/usr/bin/tmux kill-session -t minecraft
WorkingDirectory=/home/mcserver/minecraft

[Install]
WantedBy=multi-user.target
# systemctl daemon-reload
# systemctl enable minecraft
# systemctl start minecraft
# systemctl status minecraft

Adding Allowed Users / Ops

# su - mcserver
# cd minecraft
# tmux ls
# tmux attach -t minecraft
allowlist add desertmoose706
op desertmoose706

CTRL-B, D

# jq '.' allowlist.json
# jq '.' permissions.json

Expose Externally / Port Forward / NAT

This is critical for others to connect. Please understand that you are also exposing your internal systems to the outside world, even at a small scale with port 19132. This is your choice, just know what you’re doing here.

  1. Enable whitelist!!
  2. Expose externally for friends, port forwarding aka NAT, ONLY port 19132
  3. Dynamic DNS for dynamic IPs, vs static. Noip.com, Dynamic DNS Update Client for Linux. E.g. ASUS routers have it built in.