How to set up your own minecraft server

Minecraft (we do not own this game) is a popular sandbox video game that has a huge communities of regular players, modders and server creators. And as part of the many features in this game, players of like-minded communities can create their own servers and can play together! Note that we are talking about java edition of this game.

In this article you will learn how to install all the stuff you need to run minecraft on a linux-based system. You will also learn more about basic configuration and deployment.

This guide is not meant to be an in-depth guide and assumes that you may already have some knowledge about minecraft and linux!

Open-source-Homelab-setup

Prerequisites:

Before you begin, check that you have all the stuff that you need

  • A linux-based operating system
  • A user with sudo capabilities
  • Knowledge of you own distro

For the sake of this tutorial, we will be using ubuntu for demonstration!

Package Installation:

To start, we need to install java. In the case of ubuntu, you will need to add a PPA, after that, install java and screen (I have also added some other packages in case ubuntu does not include them):

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt update
sudo apt install openjdk-17-jre-headless screen unzip wget // you can install later versions of java like 22, which i recommend

Installing the server package:

There are many popular server variants out there, for example: papermc, vanilla and more! However, I personally prefer paper as it is flexible and optimized for servers and I never had issues using it!

wget https://api.papermc.io/v2/projects/paper/versions/1.21.1/builds/99/downloads/paper-1.21.1-99.jar

For me I usually like to put this inside a specific folder:

mkdir minecraftServer && mv paper-1.21.1-99.jar minecraftServer && cd minecraftServer

After that, start a screen session and execute the runtime:

screen -S minecraft

java -Xms1024M -Xmx1024M -jar paper-1.21.1-99.jar nogui

What this does is that it creates a detached screen session so that even when you close the terminal, you can still have the server up and running!

Here is a simple breakdown of what the command that we used to start the server means

-Xms1024M Means that the minimum amount of memory is 1024MB!

-Xmx1024M Means that the maximum amount of memory is 1024MB!

-nogui Means no need for user interface!

-jar Tells the runtime to run this specific jar file!

EULA:

In the console, you will see a error saying that you need to update the EULA, this is the End User License Agreement and you need to agree to the terms before you can continue using it, to agree, open the file in your favourite text editor and change false to TRUE

nano eula.txt

Final result:

eula=TRUE

Once you are done, re-run the runtime and you should have a server up and running!

Notes:

Notes

  • You should try to create a dedicated user on your system to run your minecraft server, this ensures that it is segregated, better yet, run it in docket container!

  • You can try adding plugins into a folder called plugins, you can get some from the spigotMC resource page! Personally I recommend viaversion, viabackwards and chunky!

  • Minecraft is very CPU, RAM and IO dependent, so ensure that your machine is capable in these fields before you do things!

  • Keep frequent backups, you never know when you might need it!

  • You can reattach screen sessions like this: screen -r minecraft

  • Minecraft is especially demanding on the I/O devices. So ensure you have a disk that is capable on it!