Oracle Cloud
This guide originally comes from the Admincraft subreddit user u/Belaboy1095969, with full prior permission we have re-uploaded this tutorial into our central repository.
If you’re looking to host a basic server that is kept online (for free, 24/7) that you and your friends can play on then this is the guide for you. This guide comes with the following expectations, further expansion on some of these points can be requested within the setup.md discord server if required.
You Will Need
- A
Java Minecraft AccountMinecraft license, as of 07 June 2022 these games are now bundled together. - A credit / debit card for oracle account verification (anti-bot process)
Getting Started
This guide will assume you have already gone through the sign-up process for the OCI console. Once this step has been completed you can follow the rest of this guide.
Creating a Virtual Machine instance.
Don’t Panic! This part isn’t as complicated as it sounds. Once you have finished setting up your account, click the “Create a VM instance” panel.
Give your VM instance a name. Anything will work, but make it easily identifiable. You can leave the default (Root) compartment selected.
Now, Scroll down to the “Image and Shape” section. Make sure “Ubuntu LTS 22.04 (Or just the latest build)” Is selected. Then click “Change shape”. Under “Shape series”, Select “Ampere”. Now set the amount of Ram and CPU Cores you would like.
Next, we need to create a VCN (Or Virtual Cloud Network). If you already have a VCN, use that. If not, select “Create a Virtual Cloud Network” Copy the settings in the picture below!
We’ll need an SSH Key pair to access the server remotely. To generate a keypair, tick the box that says “Generate a new keypair” and then download both the public and private keys. Don’t lose these, or else you won’t be able to connect to your server remotely!
Leave the boot volume settings alone and hit “Create”!
Once you hit “Create”, you will be redirected to your VM details and your VM will be in a “Provisioning” state. Wait for it to be in a running state, which should take 30-60 seconds. Under the “Instance access”, you should see an IP Address. Copy it.
Connecting to your VM with SSH.
There are multiple SSH clients out there from classics such as PuTTY and newer clients such as Termius. For simplicity and universal sake we will use a command prompt / terminal window.
Open a command prompt / terminal window and type in the following command :
As this is your first time connecting you’ll need to ‘accept’ either by pressing Y
or typing Yes
in the confirmation box. You should then see a screen similar to the below.
Our VM is now deployed and ready to configure with Java and our server.
Installing Java
Ubuntu uses the APT
package manager, it’s generally considered a good idea to run the following commands before trying to install an application for the first time.
Once you’ve ensured the package list has been updated and installed packaged upgraded you can proceed with installing java depending on which Minecraft version you’re looking to install you may need to change this command slightly.
To identify which versions of JRE are installable you can run the following command.
This should result in the following output.
Java 16 was not an LTS release and therefore isn’t present in the list.
You can now run the following command changing the version-number
to determine if you would like to install Java 8, Java 11 or Java 17.
The above command will install Java 17 and will allow for us to create a server using the latest builds. You can confirm this has installed successfully by running the following command.
The above command should print out the latest build number for the Java 17 release we have just installed. If you have any errors you can checkout the following guide troubleshooting java.
Creating the Minecraft server
We are nearing the end of this guide, only a few more things to do!
Before we download anything, we should make a directory to put our server in. You can do this by typing the following commands.
Now we can deploy the server jar we’re wanting to use, this tutorial will reference purpur but there are plenty of other server platforms and this page explains the pros and cons of the major ones.
By adding the --content-disposition
we’re preventing the downloaded file being an extension-less file called download
.
To confirm the file has downloaded correctly you can use the ls -al
command to display the contents of the minecraft-server-folder
.
In order to start our server we need to create a file that accepts the EULA for Mojang. This can be done with the following command.
We can now run the following command from the console in order to start our server, this will start the server and create all of the files it needs to run as expected.
Once you see the line Done in (seconds)
you can press shift + c
to end the session or type stop
like a normal server.
So now technically everything is setup and ready - If your newly created VPS was sitting in your house you would be able to play right now… but it’s not - so we need to open the 25565 port to the internet.
Making it accessible over the internet (Port Forwarding)
While we’re still connected via SSH it will save time later for us to configure the servers local firewall now.
This tutorial uses Ubuntu and UFW. If you chose another another distro at the start of this guide you will most likely have a different wrapper, if this is the case you will need to consult the docs for how best to open ports 25565 for TCP and UDP traffic.
To open TCP and UDP traffic within Ubuntu we need to use the following commands.
You can check UFW has successfully deployed and enabled by typing the following command.
The next steps are to do the same things within the Oracle Cloud interface. You will need to look for the category “Primary VNIC”. Click the “Public Subnet” link.
Then click the “Default Security list” link.
And Add an “Ingress Rule”. Copy the configuration shown here ,Then create another ingress rule with the same configuration, but change the “IP Protocol” to TCP, as shown below.
Switching back to the server, you should now be able to start the server again using the same command we used previously.
You are now technically complete, you should be able to join your newly created server and share the IP with your friends… There’s a couple of things to note in the below ‘Optional Configuration’ settings which will help you down the line.
Optional Configuration
The above steps will get you up and running with the basics, but some settings can be adjusted further to make life easier for yourself as an admin.
Adjusting RAM Allocation
We go over adjusting the RAM allocation in more depth here.
Installing ‘Screen’
Screen is an application that allows for you to run your server in the background even after you close your SSH session.
To install screen run the following command.
Now screen has been installed you can run the following commands to launch your server within screen.
To exit the screen session you should press CTRL + A + D
. You should now be able to close the command prompt window without the server crashing. If you need to return to your screen windows you can use the command screen -r
.
Installing Plugins
We go over installing plugins in more depth here.
JVM Flags (Aikar)
We go over adjusting the start-up flags in more depth here.
Disclaimer
This guide has been modified slightly to cater for the needs of this project, setup.md has adjusted the following from the original article.
- Moved from Oracle Linux to Ubuntu LTS
- Moved some Optional Configuration topics to either their own pages within our KB / hyperlinked to existing documents (this prevents topic duplication).
- Ordering / Combining of steps in relation to EULA and port forwarding.
Additional Note
While Oracle cloud is great, ARM CPUs will fall short in high-demand workloads when it comes to Minecraft servers. If you find yourself outgrowing the Oracle instance you can check out the following hosting guide.