Firstly, you need a Google cloud platform account with credits in it.
Available here: http://cloud.google.com/
You get $300 worth of free credits, so you don’t have to worry about it for this tutorial as it won’t be using up much.
Go to Google Cloud Platform console and using the navigation drawer on the left navigate to
Compute Engine → VM Instance
Creating an instance
- Click on create instance
- Give a name to your instance, I’ll choose
minecraftubuntu
- Select region and zone as per your wish. Note: Different regions have different pricing.
-
Choose a machine configuration, we do not require anything demanding for a small minecraft server. A machine with 4GB RAM should suffice. I will be choosing from the E2 series and e2-medium machine type with 2 vCPU, 4GB memory.
-
As the boot disk I will be allocating 20GB space and choosing an SSD. For the operating system, I will choose Ubuntu and version 18.04 LTS.
-
Scroll down and then click on
-
Go to the networking tab and fill in the network tag with a word that you will remember. So I will be typing in
minecraftserverip
-
Now we need to create a static IP address for our instance, as we do not want our server to get a new IP address everytime it is switched on.
Click on default under network interfaces and it should extend.
-
Here click on the dropdown under External IP and select create IP address and a new dialog box should open.
- Give a name to your new static IP address, I’ll choose
minecraftstatic
and click on reserve. - That should be it now click on create at the bottom of the page.
Setting Firewall Rules
-
Using the navigation drawer on the left navigate to
VPC Network → Firewall Rules
- Click on create firewall rule at the top.
- Give a name, I’ll choose
minecraftservertcp
. -
Now scroll down in the target tags, type in the name we gave in Step 7 of Creating an instance. So that will be
minecraftserverip
.This means that all the instances that use the above networking tag will follow this firewall rule.
-
Fill in the source IP ranges with
0.0.0.0/0
- In protocols and ports, select Specified protocols and ports and then check the checkbox of TCP and type in
25565
which is the minecraft port. - Click on create.
Logging in into the instance
-
Go to VM instances page and press the SSH button under the connect tab.
-
A new window should open connecting you to the VM.
Let us first update the VM type in, ``` sudo apt update && sudo apt upgrade
-
After updating create a folder where we will be storing and running our minecraft server from.
mkdir mineserver cd mineserver
-
Now install java using
sudo apt install default-jre
-
We need to get the Minecraft server jar file now. There are many versions you can get the latest from
If you need older versions you can visit MCVERSIONS
You can get modded servers such as spigot from Spigot Download.
-
For this tutorial I will be using the latest from official Minecraft.
Copy the link address from the webpage
And in the VM type in
wget https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar
This will download the latest server into your mineserver folder.
-
Now we can run the server by typing
java -Xmx3072M -Xms1024M -jar minecraft_server.1.15.2.jar nogui
Here note the option -Xmx is the maximum RAM allocation and option -Xms is the minimum RAM allocation. I have allocated a maximum of 3GB and a minimum of 1GB.
Click enter.
-
You will notice that after few lines of execution it will stop, that is because you need to agree to the EULA - End User License Agreement. For that using any text editor open the eula.txt that is automatically generated when the server is run for the first time.
I will be using nano, so type in
nano eula.txt
Find the variable that has false and change it to true. To save the file press
CTRL+O and press enter
To exit editing the file press
CTRL+X
-
Now run the server using the previous java command. Wait for a while you will see that it is done.
Connecting to server
Open up Minecraft, select multiplayer, click on add server. Give a server name you like and in the server address copy the IP address under the External IP tab in the VM instances page.
That’s it. Enjoy playing with your friends on the server by giving them the IP address!