Published on

Linode + Minecraft (Bedrock)

So a while back I agreed to setup a Minecraft Server for my kids, not really understanding what I was getting into. I had asked a colleague at work and he said it was essential for be able to collaborate, so I mentioned it to the kids and they really liked the idea.

I tried first to get a server running on my Synology server at Home. I have docked running on there and as I am pretty competent I thought that should be easy. It all fairness it was easy, but it brought my server to it’s knees even without being able to connect to it.

I gave up on the idea and luckily after a few months the kids had moved on from Minecraft so it was no longer relevant. Last month though Minecraft caught on again in our household and in the kids friends circle. With social distancing being important I thought again about a Minecraft server. Then I heard a mention in the Accidental Tech Podcast (ATP) about using Linode to Setup a Minecraft server which piqued my curiosity.

It didn’t go as smoothly as I had expected, and because his was mostly due to a lack of up to date documentation I’ve decided to write down how I got it all to work in the end.

Getting 4 months free hosting with Linode ($20)

One of the things that attracted me to try the setup with Linode was in the sponsor reads for ATP they give a discount for $20 which when used with the smallest server from Linode amounts to 4 months free usage. You can find details on most ATP Episodes - but here is the code from ATP 383 - atp2020.

However i didn’t actually need this because when I searched for help with Linode & Minecraft I found this guide on the minecraft site which contained a link to sign-up and get a $20 credit.

Maybe they can even be combined to get $40 - it’s too late for me to try out, but good luck.

Knowing what server to install (Java or Bedrock)

My first attempt to get Minecraft running was by following the tutorial I linked to above. This explains very quickly how to install a ‘Minecraft Server’. Unfortunately it turns out that there are two types of Minecraft Server and the one outlined in that article was for me the wrong one.

There is a Java Server which is only compatible with desktop Minecraft (AKA Java Minecraft).

Then there is the Bedrock Server which supports any mobile devices (iOS, Android, Switch etc) and game consoles (xbox, Playstation etc). To make things more confusing this used to be called Pocket Edition.

To make matters even worse - for years there has been no official Bedrock / Pocket Edition Server, so unofficial ones have been created such as Pocketmine. I have chosen the official server to be able to quickly follow any updates to the platform. At the time of writing this server was marked as Alpha software (i.e. an early and buggy version) but I have had no problems in my first month.

If you don’t need the Bedrock server - you can probably follow the rest of the instructions here to get the Java Server up and running, but…

There is a very easy way to install the Java Server on Linode via the Marketplace and you might want to consider that too, but it doesn’t seem to be the latest version of the server, and as I discovered last week understanding how the server is installed is relevant for updating.

Setting up a Linode

It makes no sense for me to go into any details about setting up a Linode here, follow the experts at Linode:

https://www.linode.com/docs/getting-started/

I setup an Ubuntu server as per the recommendations from the Minecraft Page.

There is a second support document from Linode that you can also follow regarding securing your server but for my Minecraft server I have only setup a separate user (‘minecraft’) and not bothered with the rest.

Installing the Bedrock Server and getting it running

OK so I hope this point you have a server up and running and you have can connect to it with SSH, if so the rest will be quite painless.

One thing that is good to do now is make sure that your non-root user (minecraft in my case) is also in the sudo group. You can do this by issuing the following command as ‘root’.

adduser minecraft sudo

If your user is not called minecraft then use the correct name here.

Next ssh to the server as minecraft.

Update the packages on the server before we install Minecraft:

sudo apt update && sudo apt upgrade

Next you need to get the URL for the current version of the Bedrock Minecraft Server when I searched the internet (via Duckduckgo) for Bedrock Minecraft Server I came to the page:

https://www.minecraft.net/en-us/download/server/bedrock/

This may change in the future.

On the version of the page I found I had to tick a box to agree to the EULA and then the URL for the download was available by right clicking on the button and doing a copy link. At the time of writing this was:

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

So to download this zip file into my Ubunto server I need to issue the following command:

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

Then we need to unzip the downloaded file:

 unzip bedrock-server-1.16.0.2.zip

This unzips everything into the current directory, which should be the user directory of you user (minecraft) which is fine for me.

We are not going to setup the Minecraft Server to run as a service, so it will not recover after a system restart, we will just leave it running in a process. (I know it is hacky - but it is simple and fast).

To get the server running type (from the same directory):

screen ./bedrock_server

This runs the server using a process called screen which allows you to discontent from the running process and re-connect later. If you require more help on screen follow the link.

Great! You have a server running! You are likely to want to configure it though - but we will come back to that - first let’s connect to it from a Bedrock client to test it.

Before you can do that you better read the next section otherwise it might take two days of pulling hair out for you to understand what is wrong with the server.

Configuring the damn firewall

Not mentioned in either of the official Linode guides about installing Minecraft is Firewall configuration.

I had a real problem with this step because of a simple misunderstanding on my part of how the network tools show open ports. It turns out that when you use netscan and similar tools that they don’t show any information about processes running with UDP ports open.

The default minecraft configuration starts up with a IP4 UDP port open on 19132 which is cool.

Reading the Linode documentation about firewalls led me to believe that all I needed to do was open port 19132 and all would be easy. The command to do this is:

sudo ufw allow 19132

What I missed was that the server was using a UDP port and I had thought the above syntax would open the port for both TCP and UDP. It turns out this command is shorthand for sudo ufw allow 19132/tcp and therefore I needed to add the /udp so therefore use:

sudo ufw allow 19132/udp

Check the rule is in place with:

sudo ufw status

If you find the firewall is disabled then enable it with

sudo ufw enable

Updating the settings.

Updating the settings is fairly easy. If you are familiar with vi then very easy, if not - somewhat painful.

The settings file can be edited using vi by typing in:

vi server.properties

Using vi is not intuitive and you can find more information on how to use vi properly.

To edit this file you need to know:

  • pressing i will enter insert mode, then it will work like a ‘normal’ text editing tool
  • When you a ready to finish - press ESC to enter command mode
  • you can enter qw and then press ENTER to quit and save
  • you can enter q! and press ENTER to quit without saving.

Leave it running

That is the very basic way to get a server up and running, good luck.

If you have any questions or feedback on the instructions here - please contact me on twitter - I am @grouchal.