Deploying Minecraft Server on Azure

The Azure Marketplace now has a Minecraft Server offering which deploys a customizable Minecraft Server to an Azure virtual machine. This replaces an older Azure Gallery Minecraft item which was often out of date, sometimes broken, and eventually removed.

The new solution template creates an Azure virtual machine running Ubuntu 16.04 and installs Minecraft Server running on it. It also creates the other cloud infrastructure components you need, including: a resource group, virtual network, public IP address, DNS name, network security group (NSG). Additionally it lets you set several Minecraft server configuration parameters at deployment time. What follows is a brief user guide covering how to deploy and operate your Minecraft Server running in Azure.

What you need to get started

Finding the Minecraft Server

You can deploy the Minecraft Server Marketplace solution to a new VM directly from the Azure Marketplace or by searching for it from the Azure portal.

From the Marketplace

Go to the Minecraft server Marketplace product page and click GET IT NOW.

image

From there click Continue and you’ll be taken to the Azure portal..

From the Portal

You can also deploy the Minecraft Server directly from the Azure Portal. Click the ‘+’ sign and type “minecraft” in the search.

image

Deploying the Minecraft Server

Once you’ve selected the Minecraft Server product in the portal you’ll see a description and a Create button.

Click Create.

From here the portal takes you through a set of forms known as portal blades to configure the deployment. Let’s go through them one by one:

Basics

image

VM username – A Linux user name you’ll use if you need to log on to the virtual machine.

Password – The password you’ll use if you need to log on to the virtual machine. Don’t forget this.

Subscription – If you have access to more than one Azure subscription, choose the one you want to use for this deployment.

Resource group – A logical container for your resources. It’s a good idea to create a new one here, that way if you want to remove everything you created at some point you can simply delete the resource group and it won’t affect any other deployments.

Location – Pick the region where the resources will be created. Picking somewhere local to you is usually a good idea to minimize network round-trip time.

Click OK.

Virtual Machine Settings

image

Public IP address resource name – Leave the default setting.

Domain name label – Pick a unique domain name for your server. No punctuation, spaces etc., just letters and/or numbers. Later when you connect to this server the full domain name will be like: <yourdomainname>.<yourlocation>.cloudapp.azure.com.

Size – The size of the virtual machine. You can accept the default or choose a larger machine with more CPU/memory, but it is not recommended to choose a smaller machine like A0 or D0. If you do pick a smaller VM size the server might get a bit laggy.

Click OK.

Minecraft Server Settings

image

Minecraft username – This is your Minecraft username – get it right or you won’t be an operator of the Minecraft server that gets created. Don’t put an email address or anything else, except a valid Minecraft username.

Minecraft server version – This should default to the latest version of the Minecraft server and hence not need changing. The field is editable just in case a new server version comes out and the Azure Marketplace product hasn’t been updated yet. If there is a new server version available you can put it here.

difficulty – The default Difficulty of 1 means peaceful mode. Check here for what values you can use for this and the next few parameters: http://minecraft.gamepedia.com/Server.properties

level-name – Whatever you want your new Minecraft world to be called or leave the default value. Don’t use any special characters which could interfere with a bash script. E.g. no spaces, single quotes, explanation marks, backslashes (unless you’re deliberately escaping a character).

game-mode – The default value is 0 – Survival mode. 1 is creative.

white-list – Set this to true to make this invite-only. Initially only you would have access, and for people to join you’ll have to use operator commands to add them to the white-list.

enable-command-block – If this is true you can create command blocks in the server, which empowers you to build a near limitless array of quasi-magical operations.

spawn-monsters – Controls whether monsters show up at night or not.

generate-structures – Controls whether your world will have temples and villages.

level-seed –  Leave this blank to use a random seed. The seed controls which of the 18,446,744,073,709,551,616 possible worlds are generated. As with level-name, avoid using characters which could interfere with the bash script which installs Minecraft. No spaces or punctuation like quotes, explanation marks, backslashes.

Click OK

Summary

Next you’ll see a summary of the options you picked…

image

Click OK.

Buy

At the purchase blade you confirm that you’re deploying the Azure resources. Note there are no extra charges on top of the Azure resources, just the basic compute and storage charges.

image

Once you click the Purchase button your Minecraft server will start deploying and you’ll see a progress icon on the dashboard. Allow several minute for this to deploy.

image

Connecting to the Minecraft Server

Once deployment is complete you’ll see the resources that were created in the portal..

image

Click on the Public IP address and you’ll see the DNS name you’ll use to connect to from your Minecraft launcher:

image

Start your Minecraft desktop client. Use the regular desktop app, not a pocket edition which won’t connect to regular multiplayer servers like the one you just created. Click Play->Multiplayer and then select Direct Connect or Add Server like this:

image

Once connected you (and only you) should be an operator. You should be able to type commands like /gamemode 1 to switch to Creative mode:

Minecraft 1.11.2 2_11_2017 2_55_43 PM

The full list of operator commands can be found on the Minecraft wiki:  http://minecraft.gamepedia.com/Commands#Summary_of_commands

Troubleshooting and managing
Troubleshooting may involve logging on to the VM directly. For this you need to SSH to the DNS address. If you’re connecting from Windows you’ll need to get an SSH client like putty (see this article for more examples), or better still SSH directly from the Windows subsystem for Linux which is available in Windows 10 Anniversary edition and later. In the example above the SSH command would be:
ssh mcserver211.southcentralus.cloudapp.azure.com -l mcuser

  1. Manually stopping/starting the Minecraft server on the VM
    ssh to the VM
    sudo systemctl stop minecraft-server
    sudo systemctl start minecraft-server

2. If you need to edit any of the Minecraft server files, they are in /srv/minecraft_server

3. Cannot SSH to the VM
Go here: https://github.com/Azure/azure-linux-extensions/tree/master/VMAccess

4. Upgrading Minecraft to the latest server version
Use this script: https://msftstack.wordpress.com/2016/06/25/upgrading-minecraft-on-an-azure-vm/.

Next Steps

There is another Minecraft server in the Azure Marketplace called Multicraft. I’ve not tried it myself yet but Bitnami have good solutions. It’s an advanced hosting platform for Minecraft so worth trying.

If you have any ideas to improve the Azure Marketplace Minecraft Server template, the source files are here: https://github.com/gbowerman/azure-minecraft/tree/master/azure-marketplace/minecraft-server-ubuntu – please take a look and log issues or submit a PR. 

Advertisements
This entry was posted in Cloud, Computers and Internet, Games, Ubuntu and tagged , , , . Bookmark the permalink.

9 Responses to Deploying Minecraft Server on Azure

  1. Pingback: Creating and Operating a Minecraft Server in Microsoft Azure | MSFT Stack

  2. Pingback: Creating a Minecraft server using an Azure Resource Manager template | MSFT Stack

  3. xulture says:

    Thanks!! I just got one going 🙂

    Is there a way to use server console? (via ssh?)

    • sendmarsh says:

      @xulture, yes. If you ssh to the VM and start the server manually. E.g. you can run:
      cd /srv/minecraft_server/
      sudo systemctl stop minecraft-server
      sudo java -Xms1g -Xmx2g -jar ./minecraft_server.1.11.2.jar

      Then your ssh session will show the server console.
      Remember to run sudo systemctl start minecraft-server before you log out if you want the server to keep running.

  4. snugam says:

    We’re a group of friends playing; we’ve moved our server from Realms due to serious lag issues when players are flying with Elytra. Before I’ve setup my own Ubuntu server to host it, but this time I am using this one from the market place.

    Can you tell me what Xmx and Xms values you used for the default config, or tell me where to check/changes these for systemctl minecraft_server

    thank you very much for going t the trouble to build it – was incredibly easy to setup.

  5. theDurpachu says:

    hi i’m having a little problem when i try to put in a password for the VM it says invalid password any reason why?

    • sendmarsh says:

      If you successfully logged on to the VM before, then I can’t think of a reason it would stop working. If you’ve never been able to log in then it’s possible there was some issue typing in your password at deployment time. Either way, you can fix this by viewing the VM in the Azure portal, and selecting the Reset Password option under Support and Troubleshooting.

    • sendmarsh says:

      I realized you’re saying it doesn’t like the password when you’re typing it in in the portal. You should be able to enter any valid Linux username and password for the VM configuration. Some things to keep in mind:
      – Don’t use characters in the password that are bash shell special characters, i.e. avoid using “‘`$\#[]!|;{}()~
      – Make the user name at least 6 characters
      – Have a password length of at least 10 chars. In fact try 12.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s