Minecraft on Azure

Introduction

Despite approaching it’s 10th anniversary, Minecraft remains an incredibly popular game with both children and adults. There are many options to play Minecraft — locally, on a Minecraft hosted realm, or on a public server. In some cases, you may want to retain more control and run Minecraft on your own server. This allows you full control over who has access, as well as the ability to use a variety of community plugins for different gameplay options. This post will discuss the basics of running your own Minecraft server on Azure.

Content

The first step in getting setup to run your Minecraft server on Azure, is to login to your Azure account. If you don’t have one already, you can easily sign-up for a trial. Within your Azure subscription, I recommend creating a resource group just for use with the Minecraft related resources.

Within this new resource group you will then create a virtual machine. This virtual machine has very few special requirements. You’ll want to ensure you’re using the latest official Ubuntu image, providing an ssh key and allowing access to port 22.

For the most part you can accept the defaults, but you probably want to be careful with the auto-shutoff settings depending on your personal preferences on play time. After creating the virtual machine (vm), select the vm, and click on the network blade. You’ll want to make sure that the access on port 22 is limited to your ip address, and add access on port 25565. If you know the ip address range for all of the people who will play on this server, you can limit it here as well.

At this point, you will probably want to go back to the main vm screen, and click on configure DNS. This allows you to add a dns prefix; making it easier to remember and share the address of your server.

Now that the VM is up, all that remains is to download and configure minecraft. Begin by connecting via ssh to the vm. This can be done via Azure Cloud Shell or a terminal on your machine. You will need the ssh private key you setup as part of creating the vm.

Upon logging into the machine, copy the contents of this gist to the tmp directory, and then run the following commands. The minecraft server.jar can be found here


sudo su -
cp /tmp/<gist you just copied> /etc/systemd/system/minecraft.service
apt update && apt upgrade -y
apt install default-jre -y
adduser --system --home /minecraft minecraft
addgroup --system minecraft
adduser minecraft minecraft
systemctl enable minecraft.service
cd /minecraft
wget <lastest minecraft server.jar> 
echo eula=true > eula.txt
chown -R minecraft:minecraft ../minecraft
systemctl start minecraft
journalctl -u minecraft -f <allows you to look at the logs>

Conclusions

At this point you have a working minecraft server, and can connect to it as normal from your minecraft application. There are numerous potential plugins and options that you can consider.

Next Steps

While we do have our server up and running, there are number of actions you’ll probably want to text next. These may be covered in a future post.

  • Add Azure Firewall / Load Balancer
  • Move server creation to Azure DevOps
  • Add backup of world files
  • Use paper and add some plugins

Authors