Minecraft Windows 10 Edition Bedrock Server on Ubuntu 18.04

Updating

We will be installing the Windows 10 Edition Bedrock Server on Ubuntu 18.04.

First we are going to make sure that everything is up-to-date.

INPUT:

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

Downloading

After we are done updating we are going to download the right server version.

Minecraft Windows 10 Bedrock Server

Make sure that you right click on the green download button after checking "I Agree" and copying the link to the download. Go to your Ubuntu server via SSH and type wget and then paste the link you copied.

If you are are already logged into your Ubuntu machine locally you can just download the server normally.

Make a new folder anywhere in your system. I put all my applications in the /opt directory. My directory looks like this: /opt/Minecraft/Bedrock-Server

INPUT:

sudo mkdir -p /opt/Minecraft/Bedrock-Server

The -p creates recursive directories.

Go into the folder:

INPUT:

cd /opt/Minecraft/Bedrock-Server

Now we will download the files we got from the website:

INPUT:

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

Unzip the files:

INPUT:

sudo unzip bedrock-server-1.12.0.28.zip

Now we can run the server with our current user, however we won't be able to log out. We can solve this in one of two ways, we can use screen to run the server in the background, or we can use systemd to run the server.

With screen we can access the server by connecting to a virtual screen that has a process running, however we won't be able to check the status or easily start or stop the server.

With systemd we can access the server with systemd commands. We can also start, stop, restart, and check the status of the server with ease. 

It is up to you on which you want to use. Both steps will be listed below.


Screen

Make sure you are in the directory where you extracted all your files, my files are in: /opt/Minecraft/Bedrock-Server.

INPUT:

sudo screen -S Minecraft ./bedrock_server

The -S gives the screen a name so it is easier to identify all your screens running in the background.

You list all running screens with:

sudo screen -ls

Follow the onscreen instructions for your Minecraft server.

If you ever want to change any settings in your server.properties for your Minecraft server you will need to stop your server first.

The best way to do that is to gracefully stop your server:

INPUT:

sudo screen -r Minecraft
stop

The first line attaches to the screen "Minecraft" which we defined when naming the screen with -S.

With "stop" we make sure to properly stop the server without corrupting any files that are being written at the moment.


Systemd

Make your way over to the folder: /etc/systemd/system:

INPUT:

cd /etc/systemd/system

Create a new file with vi and name it minecraft.service.

INPUT:

sudo vi minecraft.service

Copy the below text and change the user and group to the appropriate user and group on your system. Also make sure to change the directory in which the server was extracted if you chose a different location.

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

[Service]
SyslogIdentifier=minecraft
Restart=always
RestartSec=5
Type=simple
User=user # CHANGE ME!
Group=group # CHANGE ME!
WorkingDirectory=/opt/Minecraft/Bedrock-Server # MAKE SURE THE DIRECTORY IS RIGHT!
ExecStart=/opt/Minecraft/Bedrock-Server/bedrock_server --NoRestart # MAKE SURE THE DIRECTORY IS RIGHT!
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target

Save and quit by first clicking "ESC" and then typing :wq.

Run the command to reload the systemd manager configuration:

INPUT:

sudo systemctl daemon-reload

Now we can easily start, stop, restart, and check the status of our server.

INPUT:

sudo service minecraft start

Follow the onscreen instructions for your Minecraft server setup.

Here are some additional commands:

INPUT:

sudo service minecraft stop
sudo service minecraft restart
sudo service minecraft status

The stop command gracefully stops the server without interrupting any processes.

The restart command gracefully restarts the server without interrupting any processes.

The status command shows info about the Minecraft service such as: if it is active, PID (Process ID), and a few lines of the log, etc.


Revision #11
Created Tue, Jul 9, 2019 9:39 PM by Lindorak
Updated Thu, Jul 18, 2019 3:54 AM by Lindorak