How to set up a Minecraft server on Linux

A Minecraft server on Linux (in this case: Ubuntu 20.04) is quick and easy to set up. Once you have the right hardware ready for hosting, all you need is a current Java version and the latest program files of the sandbox computer game. You can obtain both conveniently via the terminal in Linux.

Minecraft server on Linux: Hosting options from IONOS

Hosting options where you can choose between Windows and Linux as the server operating system are available from a wide range of providers — including IONOS. Here, the vServer or VPS (Virtual Private Server) server model is recommended for an easy start with a smaller Minecraft Linux server for a few people. For a low monthly fixed price, you get access to virtualized hardware resources that you can scale up and down at any time. As a generally suitable plan with the required computing power, we recommend VPS M.

In the table below you can find three concrete example use cases for a Minecraft server with Linux including matching server options from IONOS.

Minecraft server scenario

Recommended IONOS plan (with Linux as OS)

Small game world for 1-2 players

IONOS VPS M

Medium game world for 3-5 players

IONOS VPS M RAM

Large game world for 6+ players

IONOS VPS XL

Tip

Start your online adventure today and rent your gameserver from IONOS. Install and host your Minecraft server based on Linux – plus it is reliable and secure!

Set up your Minecraft server on Linux: Step-by-step (Ubuntu 20.04)

If you want to run your Minecraft server on a Linux distribution, the choice is yours. The usual suspects such as Debian, Ubuntu, or OpenSUSE are possible as a system base as well as Arch Linux, Solus, Gentoo Linux or other, less common Linux distributions. In the following tutorial, we show the individual steps for setting up a Minecraft server using Ubuntu 20.04 as an example.

Tip

More information about hosting as well as detailed instructions for installing a Minecraft server on Windows can be found in our article “Create and set up your own Minecraft server for beginners”.

Step 1: Install additional software components

Connect to your Linux server by setting up a remote desktop connection or by making an SSH connection with PuTTy.

Once the connection is established, your first step is to install the additional components required to run a Minecraft server via the terminal.

To do this, first update the package index of the package manager APT:

sudo apt update

In the next step, you install the minimal OpenJDK Java runtime environment (headless), which is mandatory for running the Minecraft server application programmed in Java:

sudo apt install openjdk-17-jre-headless

With the command “sudo java - version” you can then check whether the installation of the Java kit was successful. In this case, the terminal will give you the installed version of OpenJDK.

To keep the Minecraft server active when you leave the terminal, also install the full-screen window manager Screen:

sudo apt install screen

Step 2: Enable Minecraft server port

After you have installed the basic components for your Minecraft server on Linux, the next step is to enable TCP port 25565. By default, the server application uses this port to communicate with clients, so a corresponding firewall rule is essential. Use the following command to add the new policy:

sudo ufw allow 25565

Step 3: Install Minecraft server application (Java edition)

Now you can download and install the server software of the sandbox game. For the best compatibility, use the Java edition, and it is equally important that you use a recent version of this variant.

To do this, go to the official download page of Minecraft: Java Edition server and copy and paste the link displayed there.

Now find the installation files behind the copied link using wget:

wget
https://launcher.mojang.com/v1/objects/c8f83c5655308435b3dcf03c06d9fe8740a77469/server.jar
Note

The link in the code above is only an example — you paste the copied link at this point.

Step 4: Running the server application for the first time

After you have downloaded the server.jar file, you can run the server application at any time. Use the window manager screen installed in the first step, which you start with the following command:

screen

Confirm the start of the manager with the space bar. Afterwards you will see the familiar terminal interface, which is now ready for the start of the Minecraft server. To do this, execute the following input:

sudo java -Xms1G -Xmx2G -jar server.jar nogui

Minecraft: Java Edition server (here version 1.18.2) is subsequently loaded without a graphical user interface (“nogui”). For the execution, 1 gigabyte is granted as “start” memory (“Xms1G”) — the maximum memory usage is limited to 2 gigabytes (“Xmx2G”). Of course, you can adjust these values individually.

When you execute the command for the first time, you will get the following two error messages at the end of the loading process:

So, on the one hand, the eula.txt file could not be loaded, and on the other hand, the Minecraft server is missing configuration information that is to be defined by default in the server.properties file.

The End User License Agreement (EULA) consent file is subsequently generated directly in the current directory. You can open the file as follows:

nano eula.txt

You will find a link to the contract, which you copy and open in the browser. After reading through the terms, change the “eula=false” entry to “eula=true”. Save and close the text file.

Step 5: Configure server

Once you have agreed to the license agreement, you can turn to the server.properties configuration file. This was also created in the current directory when the server application was started for the first time. Open the file with the text editor nano:

nano server.properties

You will find an initial, simple standard configuration in which, among other things, the difficulty level and the server port (“query.port”) are defined. Adjust the configuration individually and finally save the file. A detailed list of all possible settings can be found in the official Minecraft fandom wiki.

Step 6: Start Minecraft server

After you have agreed to the EULA conditions and saved your individual server configuration, you can now type the command already used in Step 4 for starting the Minecraft server in the Linux terminal one more time:

sudo java -Xms1G -Xmx2G -jar server.jar nogui

After successful startup process — which takes some time — the terminal displays the message:

[Server thread/INFO]: Done (….s)! For help, type "help"

Now type “help” and you will get a list of possible server commands.

Step 7: Maintain server session

Once you have the Minecraft server up and running on Linux, you will of course want it to remain active when you disconnect remotely from the server. To initiate this, first exit the screen session with the key combination [Ctrl] + [A] + [D].

Then run the following command to display all active screen sessions:

screen -list

You will get a listing where you will also find the previously established connection of your Minecraft server including the prefixed session ID. In our case, this is the ID “2385”:

Now, to keep this session active even if you log off the server later, enter the following into the terminal — replacing the value “2385” with the individual ID of your screen session:

screen -r 2385

Now you can close the screen window at any time with the key combination [Ctrl] + [A] + [D] and log out of your server without closing the Minecraft server.

Step 8: Connect to Minecraft server

Your server is running and you can now connect to the generated game world at any time. To do this, proceed as follows:

  1. To do this, launch the Minecraft client (Java Edition).
  2. Select “Multiplayer”.
  3. Click Direct Connection.
  4. Enter the IP address of your Minecraft server.
  5. When you are finished, press “Join Server”.

Once connected, your online adventure on your own Minecraft server on Linux can begin!

Tip: .gg Domain

Make a statement with your own .gg domain and let the games begin. Register your own .gg domain now with IONOS.

Domain Check
  • .gg
  • .builders
  • .team
  • .city
  • .fun
We use cookies on our website to provide you with the best possible user experience. By continuing to use our website or services, you agree to their use. More Information.