Menu Close

Full instructions: Setup a dedicated Minecraft Bedrock server on Linux

Running your own Minecraft Bedrock server so all platforms (Xbox, PS, IOS, Switch and PC) can join the same server and build together your world is now possible. This manual is learning how to setup a Bedrock server on a Linux (Debian) server and expose it to the internet for others to join. No deployment script or fancy tooling required. Just hardcore manual installation so you understand what is happening.

If you are looking how to upgrade an already existing server see the upgrade post here

Introduction

Minecraft comes in two versions. The old and trusty Java edition and the new Bedrock edition. Bedrock was released by Mojang and developed in C++ programming language to support platforms not able to run Java like the Xbox of IOS. In the beginning it lacked a server version so if you wanted to play online with friends on different platforms you needed to use realms and pay a monthly fee to keep the realm online. But they released a Bedrock server edition that can be installed on Linux and you can access this server from all those Non-Java-Edition platforms. My server is being accessed by Windows 10/11, some switches and IOS. Isn’t that awesome? let’s dive into the instructions how to setup your own free Bedrock server.

Prerequisites

I am using a low footprint Debian 11 server and running virtual on MacOS – VMWare Fusion with 8GB storage, 4GB RAM and 4 vCPU’s. Just to be sure that no one complains about the performance. But 1 vCPU and 512MB of RAM is enough to run your server with a few friends. The performance of the server depends also on the view distance and the tick-distance set in your server properties. More on that later.

Running this server on VMWare also makes it possible to run snapshots to backup any progress made. Mine takes a snapshot every 30 minutes and I keep 40 snapshots. If your multi-billion city burns up by a dropped lava bucket you can press the recovery button and lost a maximum of 30 minutes gameplay.

I assume you know how to setup a Debian server. Secure it somehow and make a secure terminal connection over SSH from a management computer.

Your Debian server needs the following software:

sudo apt install wget unzip screen openssl -y
  • wget to download the package from Minecraft website
  • unzip to unzip the package
  • screen to start a terminal screen where we will be running the server
  • openssl is needed by the Bedrock server

Installation

Create a Minecraft user

  1. Login as administrator on your Debian server
  2. Create a new Minecraft user:
sudo adduser minecraft

Create the Bedrock server folder

  1. Create the bedrock server folder in /opt:
sudo mkdir /opt/bedrock

Download the Minecraft Bedrock server package for Linux

The only place where you need to find the dedicated server package is here: https://www.minecraft.net/en-us/download/server/bedrock.

  1. Go to that page and copy the URL behind the Download button
  2. Paste that URL in the following command:
wget https://minecraft.azureedge.net/bin-linux/bedrock-server-1.19.11.01.zip

The file will be downloaded to your home profile folder.

  1. Unzip the dedicated server package to the ‘/opt/bedrock’ folder:
sudo unzip bedrock-server-1.19.11.01.zip -d /opt/bedrock

Set ownership

  1. Set the ownership to the newly created Minecraft user:
sudo chown minecraft:minecraft /opt/bedrock -R

Installation is done. Now comes the configuration.

Configure your server

  1. Open up the server.properties to set some parameters:
sudo nano /opt/bedrock/server.properties

The minimal set you need to set are the following properties:

server-name=MyBedrockServer
# Choose whatever name you want. It will be visible in Minecraft :)

server-port=19132
# The UDP port number where users will connect to

Save the file for now and let’s start the Bedrock server in a way you can disconnect your SSH session and the server keeps running.

Manual start server first time

To start your server in a way that you can disconnect your SSH session we can use a tool named ‘screen’. Normally when you disconnect your SSH session all running processes are killed and your Minecraft server will die.

  1. Sudo into the Minecraft user
sudo su minecraft
  1. Go to your bedrock folder
cd /opt/bedrock
  1. Start the Bedrock server for the first time
/usr/bin/screen -dmS bedrock /bin/bash -c "LD_LIBRARY_PATH=. ./bedrock_server"

A screen has been started and in that screen the bedrock server has been started.

  1. Now to access that screen we can attach to the running screen with:
screen -r

What you see next is the output of the screen where the Bedrock server is running. Should look like:

NO LOG FILE! - setting up server logging...
[2022-08-07 16:24:35:250 INFO] Starting Server
[2022-08-07 16:24:35:250 INFO] Version 1.19.11.01
[2022-08-07 16:24:35:250 INFO] Session ID 1661d124-cfbd-403a-ae94-b623eaddb14c
[2022-08-07 16:24:35:250 INFO] Level Name: Bedrock level
[2022-08-07 16:24:35:252 INFO] Game mode: 0 Survival
[2022-08-07 16:24:35:252 INFO] Difficulty: 1 EASY
[2022-08-07 16:24:35:283 INFO] opening worlds/Bedrock level/db
[2022-08-07 16:24:36:681 INFO] IPv4 supported, port: 19132
[2022-08-07 16:24:36:681 INFO] IPv6 supported, port: 19133
[2022-08-07 16:24:36:866 INFO] Server started.
[2022-08-07 16:24:36:894 INFO] IPv4 supported, port: 33741
[2022-08-07 16:24:36:894 INFO] IPv6 supported, port: 58551
[2022-08-07 16:36:18:232 INFO] Player connected: Jack, xuid: 123123123123123123
[2022-08-07 16:36:51:177 INFO] Player disconnected: Jack, xuid: 123123123123123123

Congratulations, you have successfully started your server. Now try to access your server from any Minecraft Bedrock client and see if you can add your server to the server list and connect to it. As you can see, I have connected with my player Jack.

Disconnect from screen

To not stop your running server we need to detach from the screen. Press CTRL+A and then D for disconnect. You will return to your normal console.

Reconnect to screen and kill the bedrock server

To reconnect to the screen again type ‘screen -r’. Press CTRL+C to stop your Bedrock server and kill the screen also. Type exit to return to your normal administrator account level.

Auto start server

Now that we have a running Bedrock server we want this server to start automatically when the server reboots. We also want users to be notified when the server goes down. Let’s create a service for that.

First create a bedrock.service file:

sudo nano /etc/systemd/system/bedrock.service

Copy and paste the following information into the bedrock.service file:

[Unit]
Description=Minecraft Bedrock Service
After=network-online.target

[Service]
User=minecraft
WorkingDirectory=/opt/bedrock
Type=forking
ExecStart=/usr/bin/screen -dmS bedrock /bin/bash -c "LD_LIBRARY_PATH=. ./bedrock_server"

ExecStop=/usr/bin/screen -Rd bedrock -X stuff "say is stopping in 10 seconds...\r"
ExecStop=/bin/sleep 1
ExecStop=/usr/bin/screen -Rd bedrock -X stuff "say is stopping in 9 seconds...\r"
ExecStop=/bin/sleep 1
ExecStop=/usr/bin/screen -Rd bedrock -X stuff "say is stopping in 8 seconds...\r"
ExecStop=/bin/sleep 1
ExecStop=/usr/bin/screen -Rd bedrock -X stuff "say is stopping in 7 seconds...\r"
ExecStop=/bin/sleep 1
ExecStop=/usr/bin/screen -Rd bedrock -X stuff "say is stopping in 6 seconds...\r"
ExecStop=/bin/sleep 1
ExecStop=/usr/bin/screen -Rd bedrock -X stuff "say is stopping in 5 seconds...\r"
ExecStop=/bin/sleep 1
ExecStop=/usr/bin/screen -Rd bedrock -X stuff "say is stopping in 4 seconds...\r"
ExecStop=/bin/sleep 1
ExecStop=/usr/bin/screen -Rd bedrock -X stuff "say is stopping in 3 seconds...\r"
ExecStop=/bin/sleep 1
ExecStop=/usr/bin/screen -Rd bedrock -X stuff "say is stopping in 2 seconds...\r"
ExecStop=/bin/sleep 1
ExecStop=/usr/bin/screen -Rd bedrock -X stuff "say is stopping in 1 seconds...\r"
ExecStop=/bin/sleep 1
ExecStop=/usr/bin/screen -Rd bedrock -X stuff "say Bye...\r"
ExecStop=/bin/sleep 1
ExecStop=/usr/bin/screen -Rd bedrock -X stuff "save-all^M"
ExecStop=/usr/bin/screen -Rd bedrock -X stuff "stop^M"
ExecStop=/bin/sleep 5
GuessMainPID=no
TimeoutStartSec=30
TimeoutStopSec=30
Restart=on-failure

[Install]
WantedBy=multi-user.target

Save and exit the file with CTRL+X and press Y.

Enable the new Bedrock Service with:

sudo systemctl enable bedrock.service

Start the Bedrock Service:

sudo systemctl start bedrock.service

To stop the Bedrock Service use:

sudo systemctl stop bedrock.service

Reboot your Linux server to check if the server comes up in a few minutes. It should be.

Firewall settings

This setting is optional. I like to protect my Linux servers with additional firewall settings and not only trust on my external firewall settings. In general you need to block all incoming and outgoing traffic on your server and then open up each service that you need. In my example I have one running Minecraft Bedrock server so I need to open UDP-19132.

Because the next example will block all traffic you need to make sure you add some rules so you do keep access to the server and the server can have access to the internet. In my example I have a proxy server which controls the internet access but you could replace these proxy rules with normal http/https egress.

What is happening in the next example:

  • We reset all rules of the internal ufw firewall
  • We deny all incoming and outgoing rules
  • We allow in and out for UDP-19131 for Bedrock server
  • We allow a specific management PC to connect with SSH on port TCP-22
  • We allow in and out for a proxy server on port TCP-8080
  • We allow out to access a DNS server on port 53
  • We allow out to access time protocol on port UDP-123
  • We enable the new rule set
ufw reset

ufw default deny incoming
ufw default deny outgoing

ufw allow from any to any port 19132 proto udp comment Bedrock
ufw allow out from any to any port 19132 proto udp

ufw allow from <your.management.pc.ip> to any port 22 proto tcp comment mycomputer

ufw allow out from any to <your.proxy.server.ip> port 8080 proto tcp
ufw allow out from any port 8080 to any

ufw allow out to <your.dns.server.ip> port 53
ufw allow out 123/udp

ufw enable

Update an existing server

See my next post how to update an existing server here.

Related Posts

Leave a Reply

Your email address will not be published.