How to Create a Minecraft Server in Ubuntu 22.04

Minecraft has been around for over a decade and is among the most famous sandbox video games worldwide. You can also create personal servers to invite your friends to play and control the gaming experience.

However, setting up the Minecraft server in Linux can confuse the users. If you want to build a Minecraft server in Ubuntu, this guide is for you. Here, we will explain everything about the way to create your Minecraft server in Ubuntu 22.04.

How to Create a Minecraft Server in Ubuntu 22.04

Before we dive into the steps to set up a Minecraft server, it’s essential to understand the hardware and software requirements to run a Minecraft server:

Hardware Requirements:

  • A computer that runs the Ubuntu 22.04 with at least 2GB of RAM.
  • A high-speed internet connection.
  • At least 1GB of free disk space to store the Minecraft server software and data.

Software Requirements:

  • Java 11 or later
  • Minecraft server software

Create and Set Up a Minecraft Server

First, install Java because it is Minecraft’s programming language. To do this, run the following command:

sudo apt-get install openjdk-17-jre-headless

After installing Java, you can download the Minecraft server software and the latest minecraft_server.jar from its official website. Save the file to your computer. Then, move it to the desired location on your Ubuntu server.

For example, if you want to store the Minecraft server software in the /opt/minecraft directory, run the following command:

mv minecraft_server.jar /opt/minecraft
Ensure that you own the /opt/minecraft directory to transfer the files to and from the exact location. If you don't have an ownership of that directory, use the following command:
sudo chown +R prateek /opt/minecraft

You can also use the following command to download the minecraft_server.jar through the terminal:

cd ~/opt/minecraft

sudo wget https://piston-data.mojang.com/v1/objects/c9df48efed58511cdd0213c56b9013a7b5c9ac1f/server.jar -O minecraft_server.jar

Once you install the Minecraft server application, it’s time to start the server. Hence, change to the directory where you moved the minecraft_server.jar file, and run the following command:

java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

This command starts the Minecraft server with 1024 MB of RAM assigned to it. The -Xmx1024M option sets the maximum memory that the Minecraft server can use. The -Xms1024M option sets the minimum memory that the Minecraft server should use. You can adjust the memory requirement for your server by changing the -Xmx and -Xms values.

The next step is to accept the Minecraft End User License Agreement (EULA). The same is communicated to you when you start the server for the first time in the previous step.

To do this, change the value of eula=false to eula=true in the eula.txt file. Save the file and restart the Minecraft server. You can use nano to make the changes using the following command:

nano eula.txt

Press Ctrl+O to save the changes and Ctrl+X to exit from the editor.

You can change the various settings for your Minecraft server by modifying the server.properties file. For example, you can set a port number, adjust your world generation settings, change the server name, and more.

To run your Minecraft server, you need to start the Java process that runs the server. Run the previously used command to launch the minecraft server as follows:

java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

It starts the Minecraft server process using the -jar option which tells Java to run the minecraft_server.jar file as a standalone program. Finally, the nogui option tells the server to run in the terminal rather than as a graphical application.

You should now see the Minecraft server console which shows the various messages and status updates as the server starts up and runs. You can use the console to issue commands and manage the server, just like running the server on your local machine.

Once the server starts up, you can connect to it from a Minecraft client by entering the server’s IP address or hostname into the “Multiplayer” menu in the game. If you want to connect from the same machine as the server, you can use the loopback IP address or localhost to connect.

To run the Minecraft server in the background, you can log out or close the terminal window. You can use the following command:

nohup java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui &

Here, the nohup command instructs the terminal to run the command in the background even if you log out or close the terminal window. The “&” at the end runs the server in the background and returns the control to you immediately.


You can successfully install and start a Minecraft server in Ubuntu 22.04. You can customize your server by changing the server properties or installing the plugins, or you can start playing with friends. Regardless of your choice, Ubuntu 22.04 provides a stable and robust foundation to run your Minecraft server.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.