Skip to main content

[Oracle VPS] Create your own Minecraft Server always free

·20 mins· 0 · 0 ·
Tuto VPS Oracle Minecraft Server Always Free
JustinType
Author
JustinType
Cybersecurity Engineer and CTF Player
Table of Contents
VPS Oracle - This article is part of a series.
Part 1: This Article

Introduction #

This article guides you through the creation of a free Minecraft game server for life using Oracle Cloud Infrastructure’s (OCI) “Always Free” offering.

OCI isn’t the only possible solution for creating your own Minecraft server, however I think it’s the best solution on the market available today, and here’s why:

Other solutions #

To create your own Minecraft server, there are generally 3 solutions:

  • Host your server on your own machine.
  • Use a free specialized host such as Aternos
  • Use a paying generalist host such as OVH

choices

Using your own machine is free (if you don’t count the electricity consumed) and gives you total control over your server, but it does require a machine with good performance and a fast Internet connection, otherwise the server won’t be of good quality.

In addition, you’ll need to open certain ports on your Internet router (your wifi box) to allow your friends to connect to your server. This may be difficult to achieve, depending on your Internet Service Provider (ISP), and may carry security risks for anyone using the router. Finally, the server will only be accessible when your machine is switched on (if you switch off your computer, the server will be closed).

This is a solution I don’t recommend, but it’s possible.

Using a specialized hosting provider like Aternos is free, simple and fast. In fact, once you’ve created your account, we can quickly generate a Minecraft server that can be accessed and played right away.

However, this server can only accommodate 10 people maximum and can only be in Vanilla (no plugins, mods or custom maps). If you want to unlock these features, you’ll have to pay. What’s more, you have no control over the server, which means that Aternos can remove it at any time. This happens regularly because they don’t have unlimited servers, so in order to offer their service to enough people they have to sort.

Generally speaking, if your server is inactive for more than a week or two, it will be deleted and given to another user. And yes, using cloud services is really using someone else’s computer, so if this service is free don’t forget that the real owner of the machine can do whatever he wants.

matrix_cloud

So this is a solution I’d only recommend if you want a small Vanilla server quickly and don’t intend to play on it much.

Using a general-purpose, pay-as-you-go host like OVH solves the problem of control: you pay a certain amount per month for a VPS. As a reminder, VPS stands for “Virtual Private Server”, and as indicated in the name, this server is private. Your host provides it to you and won’t touch it as long as you pay although this doesn’t rule out potential physical problems such as a fire on the premises. As you have total control over this server, there’s nothing to stop you using it as a game server, but also as a small personal cloud or VPN server…

In my opinion, this is the best solution, but unfortunately it comes at a price. The more powerful your VPS, the more it will cost. Here’s an overview of OVH prices:

OVH_prices

OCI is also a general-purpose hosting provider, but thanks to its “Always Free” offer, we get a free solution that solves the main problems of other solutions, making it in my opinion **the best offer on the market today!

We can now create our Minecraft server

Minecraft Vanilla server #

You are strongly advised to read the introduction to this series, as I present the OCI “Always Free” offering we’ll be using. Concepts such as creating a VM, allocating its resources, accessing it, transferring files, etc., are covered.

Thumbnail Introduction OCI
→ Read the introduction of this serie

Once you’ve followed the introduction, you should have an Oracle account and a VM (instance) dedicated to your Minecraft server. You can now follow the steps described below:

Install java #

Every Minecraft server needs java to run, so we’re going to install the Java Development Kit (JDK) on our server. To find the latest version available, here’s the command to run:

yum list jdk*

Install Java

Don’t be surprised, I use the Hyper terminal, the appearance is slightly different but the commands don’t change.

We’re going to install the latest “headless” version, this version may be different for you, take the latest version available, here’s the command to run at home:

sudo yum install jdk-22-headless.aarch64

To check that java is installed :

java --version

Install Java 2

Installing the Minecraft server #

At last we come to the exciting part! To install the Minecraft server you first need to get the .jar file from the official site.

Vanilla 1

The version on the official website corresponds to the latest stable version, if you want another version you will have to get the .jar file from another source

Vanilla 2

Once you’ve retrieved the .jar file from your local machine, create a folder on your VM for your Minecraft Vanilla server and transfer the .jar to this folder:

Vanilla 3

From your SSH access, go to this folder and execute this command:

java -Xms1G -Xmx2G -jar server.jar nogui
  • Xms allows you to specify the minimum RAM to be allocated to your server
  • Xmx allows you to specify the maximum RAM your server can use

Always check that the minimum RAM allocated is sufficient for your server and that the maximum RAM is not equal to or greater than the RAM available to your VM.

In fact, if your VM has 2GB of RAM and you allocate 2GB to your Minecraft server, your VM is likely to crash. You should always keep at least 1 or 2GB that your VM can use for other resources.

Numerous lines will appear, including this one:

Vanilla 4

This message indicates that you need to accept the EULA (end-user license agreement) in order to launch the Minecraft server.

If you list the current directory, you’ll see that the server has created all the files and folders it needs, including the eula.txt file.

Vanilla 5

Edit this file with the command :

nano eula.txt

Change the value “false” to “true” :

Vanilla 6

To save your changes and exit the nano editor, press CTRL + X then Y then the Enter key. If you don’t want to save your changes, press the N key instead of the Y key.

You can now restart your server with the same command:

java -Xms1G -Xmx2G -jar server.jar nogui

Your server is now generating the various worlds, until you get the message “Done”.

Vanilla 7

To stop the server, you must interrupt the operation in progress on your terminal with the CTRL + C combination or write stop.

Vanilla 8

You’d think our server would be up and running by now, but unfortunately not yet 😭 (cheer up, it’s almost over).

You won’t be able to connect to your Minecraft server from the game right now, simply because we haven’t opened the port for the Minecraft game!

Firewall configuration #

In reality, all the VMs we create are behind a firewall. The principle of the firewall is to authorize or block communications between our VMs and the outside world.

To communicate with the outside world, our VMs can use a lot of protocols, each of which has a default port:

  • port 80 and 443 are used by the HTTP and HTTPS protocols for a website
  • Port 25 is used by the SMTP protocol for e-mail transfer.

On an Oracle server, all ports are blocked by default except port 22 for the SSH protocol, which allows us to administer the machine.

Firewall 1

We therefore need to open the port used by the Minecraft server, port 25565:

Firewall 2

To do this, go to your server’s instance page and click on “subnet”:

Firewall 3

Then in the “Security List” of this subnet:

Firewall 4

As you can see in the “Egress Rules” list, all ports are blocked by default:

Firewall 5

Only port 22 is authorized in the “Ingress Rules”:

Firewall 6

We’re going to add port 25565, to do this press “Add Ingress Rules” then add a rule to authorize anyone (0.0.0.0/0) to access port 25565 via TCP and UDP:.

Firewall 7

Don’t forget to make one rule for the TCP protocol and one for the UDP protocol

For the server to take these changes into account, you need to run these 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

And get the message “success” :

Firewall 8

Launching the server #

Your Minecraft Vanilla server is finally ready!

Let’s go

You can try to connect to your server from the Launcher:

Vanilla Launch 1

Don’t forget to adapt the server’s IP address

And that’s it! Now all you have to do is share your server information with your friends so you can play together:

Vanilla Launch 2

Minecraft server with plugins - PaperMC #

Creating a Minecraft Vanilla server is cool, but creating a server with plugins is even better! Minecraft plugins can greatly enhance the game experience without changing Minecraft’s source code (unlike mods). The advantage is that you can add as many plugins as you like to your server (as long as it’s powerful enough), and players don’t have to do a thing.

Let’s create our Minecraft server with plugins!

Installing plugins #

To get started, you’ll need to download the .jar file for a server capable of running plugins. There are several possibilities, but for my part I’ll choose PaperMC (because it’s the most widely used):

Paper 1

Once you have retrieved the .jar file, create a folder specifically for this server and transfer the .jar to it:

Paper 2

It works in exactly the same way as a Vanilla server: go to this folder from your SSH access, then launch the server and allocate the necessary RAM:

java -Xms1G -Xmx3G -jar server-paper.jar nogui

The server will create the folders and files it needs to function properly, and then you’ll need to accept EULAs as described above for the Vanilla server:

Paper 3

If you restart your server, it will be operational, but for the moment we haven’t installed any plugins.

For the example I’m going to install 3 popular plugins:

  • WorldEdit → advanced build and destroy functionalities
  • EssentialX → lots of features needed by other plugins
  • BlueMap → world generation in a web interface

For each plugin you want to install, you need to make sure it’s compatible with your server.

Paper 4

Paper 5

Paper 6

Each plugin corresponds to a .jar file, once the files are downloaded I transfer them to my server in the “plugins” folder (Paper has automatically created this folder, you may have to create it yourself if you use another server such as Spigot) :

Paper 7

To install the plugins, simply restart your server!

Paper 8

Plugin configuration #

Some plugins will require you to configure them, so it’s up to you to read the documentation for each plugin to understand whether there are things you need to modify or not. In our case, we only need to configure BlueMap.

Go to plugins > BlueMap > core.conf, then agree to use BlueMap by changing “false” to “true”:

BlueMap 1

BlueMap uses the default port 8100 for the web application, as you can see in the webserver.conf file:

BlueMap 2

You can change this port if you wish, but in any case you’ll need to authorize it on the firewall for the plugin to work.

BlueMap 3

Once the port has been added to the firewall, don’t forget to reload the firewall configuration on your VM:

sudo firewall-cmd --permanent --zone=public --add-port=8100/tcp
sudo firewall-cmd --permanent --zone=public --add-port=8100/udp
sudo firewall-cmd --reload

You should get the message “Success”:

BlueMap 4

When you launch your server, it tells you that the BlueMap plugin is operational:

BlueMap 5

You can go to the url http://[IP_of_your_VM]:8100 and see that your world has been taken into account by BlueMap :

BlueMap 6

Now you know how to create a Minecraft server and install plugins!

Nice

Modded Minecraft Server - Forge #

Now we’ll take a look at how to set up a Minecraft server with mods.

The difference between a modded server and a server with plugins is that mods change the game’s source code, so two people can’t play with different source code because it’s not the same game!

This means that if you decide to create a Minecraft server with mods X and Y, all the people who want to play on your server must also have mods X and Y installed on their machine in the same version!

[Client side] - Prerequisites #

To install a mod on your local machine, you’ll need to download the CurseForge application. This allows you to install mods on a wide range of games. Go to the download page and install the “Overwolf” version :

Forge 1

Follow the installation process (it’s very simple), and once the application is installed, choose Minecraft :

Forge 2

You’ll need to link your Mojang account to CurseForge. If you haven’t bought the game and don’t have a Mojang account, you won’t be able to play with mods!

[Client side] - Installing mods #

For this example, we’re going to install the “ Pixelmon” mod, which lets you play Pokémon on Minecraft!

Click on “Browse” and on the mod you want to install:

Forge 3

The latest version of Minecraft available for this mod is 1.20.2, however this version is in “Beta” which means that the mod includes new features but is not necessarily stable.

You can find all available versions in the “Versions” tab:

Forge 4

If you click on the “Install” button (1), CurseForge will install the latest stable (release) version of the mod, here the version in 1.16.5, but you can choose to install the beta version by clicking on the button on the right (2) if you wish:

Forge 5

What’s important to remember here is that the “server” version is only available as a stable release, so we’re going to download the 1.16.5 version:

Forge 6

It is recommended to download the stable version in any case to avoid crashing your game, regardless of the mod.

Once the mod is installed, you can find it on your “My Modpacks” tab:

Forge 7

If you press “Play”, CurseForge will automatically launch your Minecraft Launcher and load the mod:

Forge 8

Now that your mod has been installed on the client side, we’re going to install it on our VM. Please note that anyone wishing to play on your server must first install the mod on their own machine.

[Server Side] - Installing mods #

A modded server is a Forge server, so the installation process differs slightly from that of a server with plugins. To begin, retrieve the mod from CurseForge, using the “Download Server Pack” button:

Forge 9

You’ve just retrieved a .zip file. In fact, I’ve been talking about mods until now, but in reality it’s a “modpack”. A modpack contains all the files needed to install your Forge server, as well as all the .jar files corresponding to the mods.

Create a folder for your Forge server on your VM and upload the modpack .zip file:

Forge 10

Unzip the contents of this file with the command :

unzip [filename]

Forge 11

You can delete the .zip file.

Numerous files and folders have been created, including .sh, these files are scripts, but for the moment these scripts are not executable. To give them this right, we need to write the command :

chmod u+x *.sh

Forge 12

You’ll notice that all these files have turned green, meaning that they can now be executed.

Run the “Install.sh” file, which will install the Forge server and all the .jar files corresponding to the mods in the modpack:

./Install.sh

Forge 13

You can now start your modde server with the command:

./ServerStart.sh

Forge 14

And then the worst happens: the server doesn’t launch and a big error appears on the screen!

Error

But don’t panic, it’s perfectly normal. This mod is quite old, in fact we’ve installed a version of java that’s too recent for it, I deliberately used this modpack to show you this scenario, as it happens regularly.

If we consult the Pixelmon mod documentation, we can see that we need Java 8 (for the stable version) and not a higher version:

Forge 15

Always check the mod or plugin documentation before installing it, this will help you solve most problems.

We will therefore install Java 8 (corresponding to jdk11) with the command :

sudo yum install jdk-11-headless.aarch64

We now have 2 versions of Java available on our VM. To use the correct one, simply run the following command, then choose the number corresponding to the version we want to use:

sudo update-alternatives --config java

Forge 16

To check that we have changed version, let’s run the command :

java --version

Forge 17

Now we can restart the server with ./ServerStart.sh, then accept the EULA :

Forge 18

And our modded server is ready! We can now play on it with the Pixelmon modpack installed:

Forge 19

Now you know how to create your own modded Minecraft server!

Very Nice

Improvements #

We’ve covered in detail how to create a Minecraft Vanilla, Paper and Forge server, as well as the configuration of multiple plugins and mods. However, it would be a shame to stop there, as we’re not yet exploiting all our VM’s potential.

Let me show you some of the improvements that change everything!

One VM, multiple servers #

You may have noticed up to now that we’ve only been running one Minecraft server at a time, but in reality it’s possible to run several on the same VM!

If you open several SSH terminals accessing your VM and try to launch the Vanilla and Paper servers at the same time, you’ll get an error message informing you that port 25565 is already in use.

This is normal, as both servers have the same default port configuration, but it’s possible to change this!

If you open the configuration of one of the two servers in the server.properties file, you’ll see 2 parameters with the number 25565:

  • query.port which corresponds to the server’s UDP port
  • server.port which corresponds to the server’s TCP port

Improvment 1
ArchLinux Documentation

If you change these parameters to the number 25564 for example, open this port on the Oracle firewall and don’t forget to load the firewall configuration into the VM as described in the previous points, you can now launch your Vanilla server and your Paper server at the same time!

Improvment 2

Always keep 1 or 2 GB of RAM strictly allocated to your VM and nothing else.

Here, our VM has 10GB and the maximum allocated RAM for both servers is : 2+3=5 GB, so no worries.

The more servers you have at the same time, the more computing power you’ll need, so don’t forget OCPUs too.

Open your server to cracked versions #

Maybe some of your friends haven’t bought the game but would still like to have some fun with you: it’s totally possible to open your server to cracked versions!

To do so, go to the server.properties file and change the online-mode parameter to false :

Improvment 3

Improvment 4

This file contains many interesting parameters, and I strongly advise you to have a look at the game documentation concerning it.

Managing your world - saving and resetting #

After hours of playing on your server, constructing numerous buildings and mining endless resources, your world crashes for no reason and you have to start all over again!

To avoid this situation, it’s a good idea to make regular backups of your world. It’s so simple!

Simply download the folders corresponding to the worlds on your server from your FTP client. There are 3 basic folders:

  • overworld, corresponding to the normal world
  • world_nether, which corresponds to the nether world
  • world_the_end corresponds to the end

Improvment 5

Once you’ve retrieved these folders, store them in a safe place, and simply put them back on your server to retrieve your current progress.

This can be very useful if you want to “go back in time”, or if you change server.

Alternatively, you can stop your server and delete these folders. When you restart your server, it will automatically regenerate a new, blank world.

Importing a world #

With what we’ve just seen in the previous section, you can imagine that it’s possible to import a world created by anyone!

The world must be compatible with your server version.

You can find maps on this site, we’ll use the Far Far Away kingdom from the Shrek universe as an example:

Improvment 6

Download the map (which is a simple compressed file), then upload it to your server:

Improvment 7

In the server.properties file, change the level-name parameter to the name of the map folder:

Improvment 8

Restart your server, and you’re ready to play on the map you’ve imported!

Improvment 9

24/7 Open Server - Service creation #

Of all the possible improvements, this is certainly the best.

In fact, if you’re observant, you’ll have noticed that from the start, my server has been linked to the terminal of my SSH connection. If I close my SSH connection or this terminal, I stop all processes linked to it, so I stop my Minecraft server. If I want my server to be open 24/7, my SSH access would also have to be open 24/7, and so would my own machine, which is very annoying!

I’m going to show you how to open your server 24/7 without having to keep your own computer on.

Jesus

To do this, we’ll need a service.

A service is a program that runs in the background on an operating system. Unlike ordinary applications, they have no graphical interface.

Services are used for a variety of essential tasks that need to run continuously or at regular intervals, for example:

  • Network management: Services that manage network connections.
  • Web servers: Services that provide web content (such as Apache or Nginx).
  • Databases: Services that manage databases (such as MySQL or PostgreSQL).
  • Security: Monitoring and protection services (such as firewalls or antivirus).
  • Task scheduling: Services that execute scheduled tasks at specific times or continuously.

It’s this last type of service that we’re interested in.

On Windows, you can view all the services running on your local machine from the services.msc console:

Service 1

On Linux, the most common service management system is systemd, and the tool for interacting with it is systemctl.

To list all services (active, inactive, …) you can use the command :

systemctl list-units --type=service --all

For this example, I’m going to create a service that will run the Forge server continuously.

First, create the service with the command :

sudo nano /etc/systemd/system/[service_name].service

Here, I’ll name my service : server-forge.service

Then we need to write the service configuration. Here’s what ours looks like:

[Unit]
Description=Forge Server Service
After=network.target

[Service]
WorkingDirectory=/home/opc/server-forge
ExecStart=/bin/bash ServerStart.sh
Restart=on-failure
RestartSec=60

[Install]
WantedBy=multi-user.target

The [Unit] section contains general information about the service.

  • Description=Forge Server Service: Provides a description of the service.
  • After=network.target: Indicates that our service should start after the network.target service, it means after the network is available.

The [Service] section defines how the service is to operate.

  • WorkingDirectory=/home/opc/test-forge: Specifies the working directory for the service. Commands will be executed from this directory.
  • ExecStart=/bin/bash ServerStart.sh: Defines the command our service will execute. Here, our service executes the bash script ServerStart.sh to start the Forge server.
  • Restart=on-failure : Indicates that the service is to be restarted automatically if an error occurs.
  • RestartSec=60: Defines the delay in seconds before attempting to restart the service after a failure. Here, we wait 60 seconds before restarting.

The [Install] section defines when and how the service should be installed or activated.

  • WantedBy=multi-user.target: Indicates that this service should be started when the system reaches the multi-user.target operating level, which is a typical operating state for non-graphical (multi-user) systems.

Once the configuration has been written, save it and close the file editor.

We need to make our system take our new service configuration into account with the command:

sudo systemctl daemon-reload 
If you change the service configuration, you must always execute this command so that the system takes the changes into account.

To inform the system that this service must be started each time your VM is restarted, run the command :

sudo systemctl enable server-forge

Finally, to start your service, run the command :

sudo systemctl start server-forge

You can view the status of your service with the command

sudo systemctl status server-forge

As you can see, our service is fully functional:

Service 2

It’s possible to create and run multiple services to have multiple Minecraft servers, these servers just need to be configured on different ports.

You can stop your service (and therefore your Minecraft server) with the command :

sudo systemctl stop server-forge

Your Minecraft server is now run by a service set up to never stop and restart automatically in the event of problems.

So it’s accessible 24/7, without you having to keep your SSH access open!

Perfect

Conclusion #

In this article I show you how to create your own free Minecraft game server for life!

The aim was to share useful knowledge while introducing you to the world of IT.

As I myself fell into the world of computing thanks to video games and in particular Minecraft, it seemed logical to start this series of articles with a complete tutorial on this iconic game.

I hope you’ve enjoyed reading the article, if you have, please feel free to like it and share it with your friends.

Keep an eye on this blog, as I’ll be publishing many more articles in this style in the near future!

See you

VPS Oracle - This article is part of a series.
Part 1: This Article