💾 Archived View for bakertribe.co.uk › articles › minecraftbedrock.gmi captured on 2022-07-16 at 13:45:55. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

-=-=-=-=-=-=-

Systemd file for Minecraft Bedrock Edition 1.16.201.02 on Ubuntu Server 20.04 LTS

Introduction

One evening converting from a Windows hosted server to a Linux based one obviously hoping to lower resources, anyway lets begin.

Once you have installed Ubuntu Server 20.04 LTS obviously you want to update and upgrade the system

sudo apt-get update && sudo apt-get upgrade -y

I want to point out that the working directory I used was /home/"username"/bedrock/server

Once complete you want to create a folder called bedrock

mkdir bedrock 

and navigate to the bedrock folder

cd /bedrock 

and create a folder called server

mkdir server

Then begin to download the latest version of the bedrock server using the wget command

wget https://minecraft.azureedge.net/bin-linux/bedrock-server-1.16.201.02.zip

This will download the zip file required and now you need to extract the contents but first you need to install unzip

sudo apt install unzip

After installing unzip, run this command it will extract the bedrock server files into the folder called server

unzip bedrock-server-1.16.201.02.zip -d /home/"username"/bedrock/server

Once extraction is complete inside the server folder is the extracted zip file contents.

To make sure this works before you continue make sure you are in /home/"username"/bedrock/server and run the command

LD_LIBRARY_PATH=. ./bedrock_server

This should start the server and you should be able to join via LAN (Press Ctrl+C to close stop the server)

Run the server as a service:

We want to create a new service called bedrock with the following command

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

Inside insert the following

[Unit]
Description=Bedrock Service
After=network.target

[Service]
Type=simple
WorkingDirectory=/home/"username"/bedrock/server
ExecStart=/bin/sh -c "./bedrock_server"
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target
Save and close

Now make sure it works using the command

sudo systemctl start bedrock.service

Check the status

sudo systemctl status bedrock.service

If it shows as active and running then it is working and now to enable it at every boot run this command

sudo systemctl enable bedrock.service

My main struggle was the systemd service file I couldn't get the server to run via the service to begin with. I tried using a servie to run a .sh script with no luck. Then I stumbled across the way to execute the LD_LIBRARY_PATH command, with a little tweaking and adjusting the WorkingDirectory I figured out how it all works. Hope this helped!