How To Host a Minecraft Server With Google Cloud
Wanting to host a Minecraft server with Google Cloud? You’ve come to the right place. In this tutorial, you’ll learn how to host both vanilla and snapshot versions of Minecraft with Google Cloud.
Creating the VM Instance
Before creating the VM instance, we’ll need to create a project to put that VM instance in. To create a project, go to console.cloud.google.com and click located in the top-left. In the new window, click and name it whatever you’d like (I’ll name it “minecraft-server.”) Once your project is finished creating, navigate to the VM Instances by clicking on console.cloud.google.com and click , then selecting “VM INSTANCES” from the dropdown. You may be greeted with a message stating that the “Compute engine is getting ready.” No worries! You’ll just have to wait a bit. Once it’s ready, create the VM instance by clicking on that shiny blue button.
Setting up the instance, you can name it whatever you’d like. For this tutorial, I’ll name it “minecraft-server.” For the region, it’s best to choose what’s closest to the majority of the players. For example, if you’re hosting a server for mostly American players, choose Central America instead of, say, France. The “zone” doesn’t matter too much, so just leave it to the default. Now for the machine configuration- this really depends on how many players you have. Please refer to the below table to help you choose the configuration:
|RAM||Player Slots*||Recommended disk size|
|1GB||Up to 4||7GB|
|2GB||Up to 8||10GB|
|3GB||Up to 15||10GB|
|4GB||Up to 25||15GB|
|5GB||Up to 30||20GB|
|6GB||Up to 40||30GB|
|8GB||Up to 90||60GB|
*This is all just based on our testing- depending on how many plugins are installed, and how you use it, it can change.
Since I’m only creating this for testing purposes, I’ll just leave it at the default configuration, which should be fine. Under the “boot disk” section, hit the button, and change the boot disk type to “SSD persistent disk.” For the disk size, it can vary based on how many players you have. Refer to the table above. As for the operating system, select “Debian GNU/Linux 9 (stretch.)” With that all set up, click to save your changes. Scrolling down to the “Firewall” section, tick both boxes, allowing both HTTP and HTTPS traffic.
Now it’s time to reserve a static IP address for the server. Under “firewall,” click the “Management, security, disks, networking, sole tenancy.” button to maximize the contents. Select the “Networking” tab, and enter in what you named your VM instance to the “network tags” field (We’ll use this later for Firewall rules.) Next, click on the network interfaces button. In the “External IP” dropdown, select “Create IP address.” This should bring up a window- simply name it whatever you’d like, and hit .
With your VM instance all ready, click that shiny blue button.
Before installing the server, we’ll need to create a firewall rule. Don’t worry though, it’s simple! In the navigation menu, select VPC network > Firewall. Next, click the button. In the “Name” field, enter whatever you named your VM instance. Down to the “Target tags” field, enter in whatever tag you put on your VM instance, which, if you’ve been following this tutorial, is also what you named your VM instance. In the “Source IP ranges” field, type
0.0.0.0/0. For the “Protocols and ports” field, select the “Specified protocols and ports” radio button, and check the “tcp” button, then enter in the port, which for Minecraft is
25565. Finally, hit that shiny blue button.
Installing & Running The Server
Now, with the VM instance created, click the button to open up a new window with the command line. The first command you’ll want to run is
sudo -s to ensure all of your commands will be ran with the admin permission. To install the latest updates, it is recommended to also run
apt-get update. You’ll also have to install the latest Java Runtime Environment. To do this, simply run the command
apt-get install default-jre-headless. With updates and the Java Runtime installed, navigate to the “home” directory by typing
cd /home/. In the home directory, create a new directory called “minecraft” with the command
mkdir minecraft. Now, navigate to the “minecraft” folder with
cd minecraft. Alright, now it’s time to install the server. Note that this command will vary based on what version you want to host your server on. The easiest way to install the server.jar is to go to mcversions.net and click on the button next to the version you want. Now, in the version’s page, right click on the button and copy it’s link location. Back in the command line, type
wget, and paste your link. Hit enter. Now, the server should install.
Now, we must run the server. Depending on the configuration of your server, you’ll have to change this. Refer to the image below on how to configure this command:
Set the minimum to
1000, and the maximum to however much RAM you have. With the command all set up, it’s time to run it. Paste the command and hit enter. You’ll get an error message telling you to “Agree to the EULA.” This is completely normal.
To agree to the EULA, type
vi eula.txt in the command line. In the editor, type “i” to start editing. Change from where it says “false” to “True.” Once you’ve got that done, hit the escape key to exit edit mode, and type
:wq to save the file, and quit the editor.
Now that you’ve agreed to the EULA, the server should be all ready to go! But first, we should install screen so that it can be a 24/7 server- as, if you just run it as-is, the server will shutdown once you close the window. To install screen. simply type
sudo apt-get install screen. To run the server with screen, type
screen -s mcs java -Xmx3500M -Xms2000M -jar server.jar nogui. (Of course, replacing the run server script with your own.) And that’s it~! Now your server will run 24/7.
Customizing The Server
If you want to customize the amount of players, enable a whitelist, or change the MOTD, you can do that as well. First, make sure your server isn’t running, and edit the
server.properties file by typing
vi server.properties, and typing ‘i.’ Here, you can change teh spawn protection, MOTD, amount of players, and much more!
Enabling a whitelist
If you want to enable a whitelist, change
white-list=true. Now, start up the server and add players to the whitelist with
/whitelist add [username].
Customizing the MOTD
You can change the MOTD easily enough by replacing
motd=A Minecraft Server with your own slogan- but did you know you can add colour to the MOTD? You can use mctools.org/motd-creator to create your own customized MOTD.
Saving & exiting
With your server customized to your heart’s content, hit escape, and type
:wq and hit enter to save and quit.
Thanks for reading! Hopefully this has helped you set up your very own Minecraft server. If you have any questions, or need help, please don’t hesitate to leave a comment- I’ll try my best to help you out. :)