Introduction
Student students love to play Minecraft! They can build a free private server if they join Azure for Student and have a basic knowledge in Azure. This post, we will guide you on how to setup a free private Minecraft server that is good for 6-7 players in Azure for free, as student can have $100 USD of credit every year. On the other hand, students can taste, learn, and build some in Azure thought the server building process or even get into AI with Minecraft and GPT3 OpenAI or reinforcement learning with Minecraft using Microsoft Research Project Malmo.
Full Demo
Deploy an Azure VM instance
1. Your Azure console. In the search bar type Virtual Machine and click on it.
2. Click Create an Azure virtual machine
3. In this page, to configure the virtual machine, you need to setup a resource group that the virtual machine belongs to, if “no” please create a resource group and choose the resource group that created. Please enter the virtual machine name and choose the region that closest to your country as the region. Also pick the availability zone that need to deploy for the virtual machine, you can also keep it as default if you don’t have any preferences.
4. For the image, please choose Ubuntu Server 20.0.4 LTS – Gen 2 as the image for the virtual machine. The size of the virtual machine please choose Standard_D4s_v3 – 4 vcpus, 16 GIB memory. This specification of instance can allow 6-7 players in the server to play. The username can leave it as default as azure user. In the SSH public key source please select generate new key pair, and type in the key pair name. This key later will be used to connect to the virtual machine. Finally, in the public inbound port select allowed selected ports. In the select inbound ports, choose SSH (22), to allow SSH connection of virtual machine. Click next to disk section.
5. In the next section of disk section, in the OS disk type, it can leave it as default to use Premium SSD (locally-redundant storage). Please select create and attach a new disk.
6. In the create new disk page, it is optional to enter a new disk name for better identification, in the source type please choose None (empty disk). In the size section please select change size.
7. In select a disk size section please choose Standard SDD. And select the size as 40 GIB. This is use for storing the server file and player data. Click ok.
8. Please choose Read/write as host caching section. Click Next to networking section.
9. In the networking section, you can leave it as default value, click Review + create.
10. Please review the virtual machine and click create.
11.Click download private key and create resource. After that click return and create a virtual machine.
12. Go to virtual machine page, click on the virtual machine you create. Select network.
13. Add two customs inbound rule with specific value. Port 25565 is for Java edition of Minecraft and 19132 is for bedrock version.
For Port 25565 rule:
For port 19132
After finish setting up the rule, click save.
Connect to virtual machine and install Minecraft server.
- In the virtual instance page click to the virtual instance you created.
- Click connect, select SSH and open cloud shell clicking the right hand corner cloud shell symbol
- After boot up the cloud shell click upload button to upload the key you created. Select the key click open.
- Successfully upload
- After uploaded, run "ls" command to verify. Type "chmod 400 <your_key_name.pem>" to change the permission. In this case, my command is "chmod 400 minecraft-server_key.pem"
- Type "pwd" to get the path of the private key file. And add the private key name at the end of the path. Type it in the private key path. In this case the path is /home/leung/Minecraft-server_key.pem.
- Copy the ssh command and ctrl+shift+v paste to the cloud shell and press enter.
- Successfully connect to the cloudshell.
Install java version of Minecraft Server
1, type “sudo -s” to enter as root user, type apt-get update to update packages.
2. Type "apt-get install openjdk-17-jdk -y" to install openjdk-17-jdk.
3. Type “apt-get install wget screen unzip” to get unzip package.
4. Type mkdir server and cd server, to create a folder to store server file and change directory to server
5. You will need to type wget [game_server_download_link], you can find all stable release version download URL in MCVersions.net - Minecraft Versions Download List, please download according to your version. In this case I will use version 1.19. On the website right click download.
Right click copy Download Server jar link.
The command will be
"wget https://piston-data.mojang.com/v1/objects/f69c284232d7c7580bd89a5a4931c3581eae1378/server.jar" To download the 1.19.2 server.
6. Type “vi eula.txt”, change to insert mode with “i”, change eula=false to eula=true. Type :wq to save and quit. (You may use other editor such as Nano.)
7. Type java -Xmx1024M -Xms1024M -jar server.jar nogui to start the server. You are completed set up a Java version Minecraft server.
Install a bedrock version server.
To set up a Minecraft bedrock version server, the steps are pretty similar.
1. Type wget [Bedrock Edition download link] to download the server version that you need. Link is Minecraft Bedrock Server Download | Minecraft. Select MINECRAFT DEDICATED SERVER SOFTWARE FOR UBUNTU (LINUX) and check the box I agree to the Minecraft End User License Agreement and Privacy Policy. Right click copy the download link
The command will be wget https://minecraft.azureedge.net/bin-linux/bedrock-server-1.19.41.01.zip
2. unzip the server file, type unzip bedrock-server-% Bedrock Edition%.zip (If you don't know the name, you can search it through "ls".)
3. Type “./bedrock_server” to start the minecraft bedrock server, now you are completed to set up a minecraft bedrock version server.
Connect to Minecraft Bedrock edition.
1. In the Minecraft Launcher click Minecraft for Windows. Then click play.
2. After enter the game click Play
3. Click Server and click Add Server
4. Enter Server name, Server Address (Your Virtual Instance IP), Port is 19132. And click save to save the server information
5. Scroll to the bottom, in the Additional server, click the server’s name you saved. Click join Server.
6. Click “Proceed”
7. Successfully enter the server, you should also see in the terminal, that it shows a player has been joined to the server.
Connect to Minecraft JAVA edition
1. In the Minecraft launcher select Java Edition
2. Select Installation click new installation
3. Enter the installation name, select the version that the game server installs from the drop-down menu, and select the game directory. Click “Create”.
4. Successfully installed new version.
5. Go back to play and select the installation on the menu. Click “play”
6. Click “Multiplayer”
7. Click “Proceed”
8. Click “Add Server “
9. Enter Server Name, Server Address. Click “Done”
10. Select the server added, click “Join Server”
11. Successfully Joined, In the virtual instance terminal, you can also see a player joined to your server.
Conclusion
Instead of playing Minecraft, students can also try and learn a bit Azure by setting up the private Minecraft server for free with Azure for student. In future blogs we will also be exploring GPT-3 and Minecraft with microsoft/MinecraftCodex: OpenAI Codex demo using Minecraft GameTest API (github.com) This prototype uses GPT-3 Codex to power a Non-Player Character (NPC) in Minecraft. Through the discipline of "prompt engineering", exploring Minecraft SimulatedPlayer API and how to write code to navigate the worlds within minecraft and even carry out conversation.
Thank you for my student ZENG Haoxuan, Kam Ting Kwok, and Wan Loi Kwan from Higher Diploma in Cloud and Data Centre Administration to prepare for this guide. Also, my colleague Leo helps them to review the process.