DevOps

Minecraft Server on Google Cloud

minecraft-logo1If you’ve not followed the Minecraft/Bukkit saga over the past few months, Bukkit and CraftBukkit downloads were taken down by DMCA because a developer (@wolvereness) wanted Mojang to open up. Mojang (@vubui) posted an official statement in their forums. The general feeling is that @wolvereness left the Bukkit community hanging, and Mojang is not responsible for this debacle.

bukkit-logo One of my friends (@ryanmichela), and a contributor to Bukkit, prepared a slide deck explaining the unfortunate debacle:

Kicking the Bukkit: Anatomy of an open source meltdown from RyanMichela

Anyway, leaving all the gory details behind, this blog will show how to get started with Bukkit 1.8.3.

What?

You just said, Bukkit was shutdown by DMCA.

spigotmc-logoHail Spigot for reviving Bukkit, and updating to 1.8.3!

Its still not clear how did Spigot get around DMCA shutdown but the binaries seem to be available again, at least for now.

As a refresher, Bukkit is the API used by developers to make plugins. CraftBukkit is the modified Minecraft server that can understand plugins made by the Bukkit API.

Minecraft Server Hosting on OpenShift already explained how to setup a Minecraft server on OpenShift. This Tech Tip will show how to get a Minecraft server running on Google Cloud.

Lets get started!

Get Started with Google Cloud

google-cloud-platform-1024x717

  1. Sign up for a free trial at cloud.google.com. This gives you credit of $300, which should be pretty decent to begin with.

Create and Configure Google Compute Engine

  1. Go to console.developers.google.com and create a new project by specifying the values as shown:
     
    techtip82-create-project-minecraft-server
  2. In console.developers.google.com, go to “Compute”, “Compute Engine”, “Networks”, “default”, “New firewall rule” and enter the values as shown and click on “Create”.
  3. In the left menu bar, click on “VM Instances” under “Compute Engine”, “Create instance”. Take everything default except:
    1. Provide a name as “minecraft-instance”
    2. Change Image to Ubuntu 14.10.
       
      techtip82-firewall-rule
    3. Change External IP to “New static IP address” and fill in the details. IP address is automatically assigned.

    Exact values are shown here:

    techtip82-create-instance

    And click on “Create”.

    Note down the IP address, this will be used later to connect from Minecraft launcher.

  4. Click on the newly created instance, “Add tags”, and specify “minecraft” tag. Exact same tag on the VM instance and Firewall rule ensures that the rule is applied to the appropriate instance.

Install JDK, Git, and Spigot

In console.developers.google.com, select the recently created instance, click on “SSH”, “Open in browser window”. The software is installed in the shell window.

Install JDK

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Make sure to answer questions and accept license during the install. Using OpenJDK 8 to install Spigot gives the following exception:

Caused by: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorit
hmParameterException: the trustAnchors parameter must be non-empty

Install Git

sudo apt-get install git

This is required for installing Spigot.

Install Spigot

Download and Install Spigot

wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
java -jar BuildTools.jar --rev 1.8

A successful completion of this task shows the following message:

Success! Everything compiled successfully. Copying final .jar files now.
Copying craftbukkit-1.8-R0.1-SNAPSHOT.jar to /home/arun_gupta_gmail_com/.
  - Saved as craftbukkit-1.8.jar
Copying spigot-1.8-R0.1-SNAPSHOT.jar to /home/arun_gupta_gmail_com/.
  - Saved as spigot-1.8.jar

Start Minecraft Server on Google Cloud

Run the server as:

java -jar craftbukkit-1.8.jar

This will generate “eula.txt”. Accept license agreement by giving the following command:

sed -i -- 's/false/true/g' eula.txt

Run server as:

screen -dmS minecraft java -server -jar craftbukkit-1.8.jar

This will start the CraftBukkit 1.8 server in background.

Connect to Minecraft Server from the Client

Launch Minecraft client and create a new Minecraft server as:

techtip82-google-cloud-minecraft-server

Clicking on Done shows:

techtip82-google-cloud-multiplayer

Now your client can connect to the Minecraft server running on Google Cloud.

techtip82-minecraft-client

The server is now live. Add 104.155.38.193  to your Minecraft launcher and put some Google resources to test 

I was hoping to provide a script that can be run using Google Cloud SDK but the bundled CLI seems to have some issues creating the project. CLI equivalent for other commands can be easily seen from the console itself.

Enjoy and happy Minecrafting!

Reference: Minecraft Server on Google Cloud from our JCG partner Arun Gupta at the Miles to go 2.0 … blog.

Arun Gupta

Arun is a technology enthusiast, avid runner, author of a best-selling book, globe trotter, a community guy, Java Champion, JavaOne Rockstar, JUG Leader, Minecraft Modder, Devoxx4Kids-er, and a Red Hatter.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button