X

Break New Ground

How To Setup And Run A Free Minecraft Server In The Cloud

In this article we'll take a look at how you can create an "always free" virtual machine and use it to run a Minecraft Server. Before we get started, you'll have to sign up for a free account with Oracle Cloud. This requires a credit card, but there are absolutely no charges at all if you follow the tutorial below.

If you're not yet the age of majority (usually 18), please have your parent sign up for a free Oracle Cloud account and help you with the steps below!

After you have created your free account and signed in, the first thing you'll need to do is create a virtual machine that will be used to host the Minecraft server.

Creating The Virtual Machine

You'll need to create a Virtual Machine to host your Minecraft server. After you have logged in to the Oracle Cloud dashboard, click on 'Create a VM instance' on the homepage.

Next, enter a name for your VM and then click 'Show Shape, Network and Storage Options' and then make sure that you pick the 'always free' shape:

The 'always free' shape:

You will need something known as an "SSH Key" to log in to your server later on. If you've never heard of these, that's perfectly OK, we'll walk through the process of creating one here. They may seem a bit difficult at first, but I promise they are really easy to work with. There are a bunch of ways to create SSH Keys, and you'll have to use a different way if you're on Windows instead of Mac or Linux. If you use Mac or Linux, here is an article to show you how to create a key with ssh-keygen and if you use Windows you can use a program called PuTTY to create your key pair

After you have generated your SSH key pair, keep both of these files to somewhere safe on your computer. I named my two files as 'minecraft_private_key.txt' and 'minecraft_public_key.txt'. Next, open up the public key text file and copy the contents of that. Now, back in the Oracle Cloud console, paste this text in the box that says 'SSH key'. You can instead select 'Choose SSH key file' and upload the public key file if you want to. After you have selected or pasted your public key file, click 'Create':

At first your instance will be in 'Provisioning' state and the screen will look like this:

After about a minute or two, your server will be ready and it will look like this:

Copy the IP Address from the 'Public IP Address' section. Next up, we'll connect to the server to continue with the setup.

If you are using a Mac or a Linux machine, you can use a command line like 'Terminal' to connect up to your server. If you're using Windows, you'll have to use a tool like 'Putty' to connect to the server. Whichever you use, connect up to the server using the IP address and the private SSH key that you downloaded earlier.  The default username for this server is "opc" (it stands for "Oracle Public Cloud" if you were wondering). Here's how I did that:

And now I am connected to the VM!

Installing Java On The VM

The VM needs to have Java installed, so let's do that first. Run the following commands, one at a time, from your SSH terminal:

yum repolist all

sudo yum-config-manager --enable rhel-7-server-optional-rpms

sudo yum install java-11-openjdk-devel

Once the final command is complete, enter java -version and you should see something like this:

Excellent, we've installed Java!

Install Minecraft Server Software

Now we need to download the Minecraft server software. You can get that from https://www.minecraft.net/en-us/download/server and an easy way to download that in Linux is called 'wget' . Copy the link to the server download from the download page and then run this on the server:

Next, try to run the server using:

java -Xmx1024M -Xms1024M -jar server.jar nogui

It should fail the first time you try to run it and it will look like this:

Open the file 'eula.txt' with 'nano eula.txt' and edit it like so:

Then press 'CTRL+X', type 'Y' and then hit enter to save the file.

Before we try to start the server again, let's deal with some networking.

Open Port In Server Network

You're almost ready to use your new Minecraft server, but you'll need to open up a port in the security list in your server's network first. On the VM details page, click on the 'subnet' link:

On the next page, look on the left side of the page for a link called 'Security Lists' and click on it:

On the security list page, click on the 'Default Security List' link:

On the security list details page, click on 'Add Ingress Rules':

In the Ingress Rules dialog window, create 2 rules and enter the values shown here:

You'll also need to open up these ports on the VM's firewall, so run the following commands:

sudo firewall-cmd --permanent --zone=public --add-port=25565/tcp

sudo firewall-cmd --permanent --zone=public --add-port=25565/udp

sudo firewall-cmd --reload

Starting The Server

At this point, the server is ready to be started!  Run the server again with:

java -Xmx1024M -Xms1024M -jar server.jar nogui

After a minute or so, your server is up and running! It's not going to be the fastest server you've ever used, but it is perfect for testing out some settings or hosting small games with a friend or two. You can read more about setting up your server and configuring it here.

Photo by Nina PhotoLab on Unsplash

Join the discussion

Comments ( 6 )
  • Caroline Yu Wednesday, October 16, 2019
    Is there a way to always have the Minecraft server running on the computer instance? Will we be charged for its usage if the server is always running?
  • Mike Reys Tuesday, October 22, 2019
    Euhm, how long before you get a public IP address? It just doesn't get assigned and I can't login...
  • Todd Sharp Thursday, October 24, 2019
    @Mike:

    Did you make sure to select 'Assign a public IP adddress' when creating the VM? If not, you can add one now:

    https://www.mythics.com/about/blog/internet-access-methods-for-oci-compute-instances
  • Todd Sharp Thursday, October 24, 2019
    @Caroline:

    I know we talked offline, but, if anyone has the same question - yes, you can set up the server to run at boot:

    https://fatmin.com/2018/01/29/linux-how-to-start-a-minecraft-server-at-boot-via-systemd/

    And no, you are not charged at all even if the server is always running!
  • KsandbergFL Saturday, November 23, 2019
    Your instructions were great, thanks! The free VM only has 1GB of RAM and 2 vCPU's... which limits Minecraft, somewhat... but I have played around for an hour or so and have had no problems yet. I might decide to pay for some more RAM and vCPU cycles.
  • Casey Thursday, November 28, 2019
    This relates to Caroline's question and it is probably a stupid one but, wouldn't the server be always running once started? I get that it would be a good idea to add the script to start at bootup for anytime the VM instance needed to be restarted but other than in the case of a crash or something, wouldn't it just be running all the time?

    My other question, you said it's pretty slow. Would you expect 3 players to be able to play without noticing lag or other issues?

    I've never tinkered with setting up a server or even a VM before but my son would love having his own Minecraft server so I will probably give this a shot. He currently plays the bedrock version of Minecraft on Xbox and Android devices. I assume only the PC version can connect to this server, correct? I don't mind buying the PC version of the game but I wish I didn't have to tell him he needed to switch to a 3rd platform to be able to have his own server to play with friends.

    Thank you for the time and effort you out into creating this tutorial!
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.