Tech tips Diy

How to Create a Minecraft Server on Ubuntu

How to Create a Minecraft Server on Ubuntu

Minecraft is one of the most popular video games of the last two decades. One of Minecraft’s strongest qualities is that it enables users to host their world on servers and make them multiplayer. Creating a Minecraft server makes the game much more enjoyable because it enables players to build with others and save their world progress in the cloud.

Creating a Minecraft server might sound daunting at first, but it’s not. Spinning up a Minecraft server on Ubuntu and installing the required software packages only takes minutes. Here are easy, simple instructions for installing a Minecraft server on Ubuntu.

Note: these instructions are specific to the Ubuntu distribution of Linux. If you have a different distribution or use Windows, we encourage you to research instructions for your own distro or OS.

Minecraft Server Requirements

You will need the following in order to create a Minecraft server:

  • A server with a minimum of 4 GB of RAM
  • Command-line access
  • An Active internet connection

Step 1: Install Java

Once you have an Ubuntu server you need to install Java. To install the latest version of Java, type:

sudo add-apt-repository ppa:openjdk-r/ppa

Then update your package sources so that Ubuntu can pull from this repository.

Sudo apt update -y

Next, install Headless JRE version of OpenJDK version 17 of Java by using the following command:

sudo apt install openjdk-17-jre-headless

Once installed, verify Java is installed correctly by using the following command:

java -version

Step 2: Install Screen

Screen is a program that allows Linux programs to run even if the user disconnects from the console. Normally, if you launch a Minecraft server in the terminal then exit the terminal, the Minecraft server is killed. Screen prevents this from happening. By installing Screen you make sure your players do not experience any interruptions.

Install Screen by typing the following into the terminal:

sudo apt install screen

Step 3: Configure Firewall

We want to accept inbound Minecraft connections through port 25565. Let’s configure the firewall to be the same:

Sudo ufw allow 25565

Step 4: Download Minecraft Server

To download Minecraft Server, download ‘wget’ by typing

sudo apt install wget

Once wget is installed, head to the official Minecraft website and copy the download link. Once you copy the link, user the ‘wget’ to download the files. this will download the latest version of Minecraft Server. Type:

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

Once the file is downloaded rename it to minecraft_server.1.18.1.jar. When you copy the link from the Minecraft site, you will see a file name in .jar format and when you download it, it is named server.jar. So you will need to rename it. Do so by typing:

mv server.jar minecraft_server_1.18.2.jar

Step 5: Configure the Server

After downloading, we need to configure Minecraft Server. Start by naming your current Screen session:

screen -s minecraft

To run Minecraft for the first time, use the following command:

java -Xmx4G -Xms1G -jar minecraft_server_1.18.2.jar nogui

You can adjust the RAM you want the server to use by adjusting the “Xmx” values. In the above example, “Xmx4G” means the server will use 4 GB of RAM. If you want to use 5 GB of RAM, you would use “XMx5G”. You can leave the “Xms” (minimum RAM use) value as the default. This will make it so the server uses a minimum of 1 GB of RAM and can use a maximum of 4 GB of RAM which will help you process traffic easier.

Now you will need to update the server information and accept the policy agreement otherwise you will see an error. Run the ‘/s’ command and you will see two files - ela.txt and server properties for user policy and server information respectively. Open eula.txt in a text editor like nano and set the EULA parameteters as true (it is set to false by default).

nano eula.txt

after that, open the server properties file which contains Minecraft server information.

nano server properties

Set the different parameters to:

  • gamemode=survival/creative/adventure (choose one of these)
  • difficulty=easy/normal/hard
  • pvp=true
  • level-name=world
  • motd=enter the name of your minecraft server

Next, run the following command and make sure that you have already renamed your file, as mentioned in the previous step.

java -Xmx4G -Xms1G -jar minecraft_server_1.18.2.jar nogui

Here is the breakdown to the command:

  • Xms1G: The server will use a minimum of 1024 MB or 1 GB of memory when running.
  • Xmx4G: The server will us a maximum of 4096 MB or 1 GB of memory when running.
  • nogui: this will allow you to launch the server without a GUI.

Once you are done setting up the server, you will see an output with [server thread/info]: done which means your Minecraft server is live.

Now your Minecraft server will will continue to run in the background, even if you close the terminal. To stop your server, use Ctrl + A and Ctrl + D in sequence.

What if you want to run your server again? You will use the a command to restart your Screen session. Run:

screen -list

screen -r minecraft

Step 6: Connect the Minecraft server and client

You must have Minecraft Java Edition for this. If you don’t already have it, get the DEB file from the Minecraft website and install it. Then launch Minecraft Java edition. Select the multiplayer option and then click on ‘add server’. Enter your server name and address. In the address, enter either “Localhost” or your current IP if you are accessing from the same machine your server is on. If you are accessing your server from a different machine or location, enter the IP of the machine hosting your Minecraft server. Or, if you have a domain, you can enter it instead. Once your entered your server details. Click done.

ZebraHost Balanced Public Clouds are Perfect for Minecraft

Setting up a Minecraft server is simple and it will greatly enhance your enjoyment of the game. If you are interested in an affordable, private, and secure server for Minecraft, consider a ZebraHost Balanced Public Cloud. BPCs start at $5/mo. And if you have issues, ZebraHost has 24/7 support.

Sign Up For Our Newsletter

Get featured blog articles, industry news, and specials straight in your inbox.