Minecraft

How to Set Up a Minecraft Server on Ubuntu 24.04

Welcome to the Greenhost.Cloud blog! If you’re an avid gamer or just someone looking to dip their toes into the rewarding world of Minecraft, you’re in the right spot. Setting up your own Minecraft server can provide you with a customizable space where you can create, explore, and conquer with friends. In this post, we’ll walk you through the process of setting up your very own Minecraft server on Ubuntu 24.04.

Prerequisites

Before we dive in, make sure you have the following:

  1. A server running Ubuntu 24.04: This can be a physical machine at home or a cloud server.
  2. Sudo access: You’ll need administrative privileges to install software.
  3. Java installed: Minecraft requires Java to run smoothly.

Step 1: Update Your System

First, ensure your system is up-to-date. Open a terminal and run:

sudo apt update && sudo apt upgrade -y

Step 2: Install Java

Minecraft requires Java to function. The recommended version is OpenJDK 17. To install it, run:

sudo apt install openjdk-17-jdk -y

After installation, you can check if Java is installed correctly by running:

java -version

You should see an output that confirms the installed Java version.

Step 3: Create a Minecraft User

For security purposes, it’s a good idea to run the Minecraft server under a separate user. You can create a new user called minecraft by executing:

sudo adduser minecraft

Follow the prompts to complete the user creation process.

Step 4: Download Minecraft Server

Now, switch to the new user and download the Minecraft server jar file. First, switch to the minecraft user:

su - minecraft

Next, create a directory for the Minecraft server and change into it:

mkdir minecraft-server
cd minecraft-server

Now, grab the latest Minecraft server .jar file from the official website. You can usually find the link to the latest version at https://www.minecraft.net/en-us/download/server. Use the wget command to download it:

wget https://launcher.mojang.com/v1/objects/[latest-server-version].jar -O minecraft_server.jar

Make sure to replace [latest-server-version] with the actual filename of the latest server jar.

Step 5: Accept the EULA

Before you can start the server, you’ll need to accept the End User License Agreement (EULA). Create a new file named eula.txt:

echo "eula=true" > eula.txt

Step 6: Start the Minecraft Server

Now you are ready to start your Minecraft server! Run the following command:

java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

In the command above:

  • -Xmx1024M sets the maximum heap size to 1024 MB. You can adjust this depending on your system’s available memory.
  • -Xms1024M sets the initial heap size.

The server will start, and you may see some messages generated in the terminal. Wait for it to reach the point where it says “Done”.

Step 7: Configure Server Properties

The server generates a server.properties file in the same directory. Open it with a text editor of your choice:

nano server.properties

You can adjust settings such as the game mode, difficulty, and server port. Make sure to save your changes after editing.

Step 8: Enable Port Forwarding (Optional)

If you want other players to join your server, you’ll need to enable port forwarding on your router. Forward port 25565 (the default Minecraft server port) to the internal IP address of your server. The exact steps vary depending on your router model, but typically you will access your router’s settings through a web browser.

Step 9: Connect to Your Server

Now it’s time for you and your friends to join your new Minecraft server! Launch Minecraft on your computer and go to the “Multiplayer” menu. Click “Add Server” and enter the following details:

  • Server Name: Any name you wish
  • Server Address: Your server’s public IP address (or localhost if you’re playing on the same machine)

Conclusion

And that’s it! You now have your very own Minecraft server running on Ubuntu 24.04. Whether you’re battling it out with friends or preserving your precious creations, owning a server adds a personal touch to the gaming experience.


Feel free to share this guide with fellow Minecraft enthusiasts and explore all the infinite possibilities of the Minecraft universe. Happy gaming!