How to Create a Minecraft Java Edition Server on Ubuntu 24.04 (Noble Numbat)
Minecraft remains one of the world’s most beloved games. Hosting your own private Minecraft Java Edition server allows you and your friends to play together in a persistent world you control. This guide will walk you through setting up a Minecraft server on Ubuntu 24.04 LTS (Noble Numbat).

Prerequisites
- A server running Ubuntu 24.04 LTS.
sudo
privileges or root access.- Access to your server’s command line (e.g., via SSH).
- Recommended minimum 2GB RAM (more needed for more players/mods).
Step 1: Update System and Install Java
First, ensure your server’s package list is up-to-date. Then, install Java, which is required to run the Minecraft server. Minecraft currently requires Java 17 or newer. We’ll install OpenJDK 17 (a free, open-source Java implementation).
# Update package lists
sudo apt update -y
# Install OpenJDK 17 JRE (Headless version is suitable for servers)
sudo apt install openjdk-17-jre-headless -y
Verify the installation by checking the Java version:
java -version
Example Output (on Ubuntu 24.04):
openjdk 17.0.x <DATE> # Version numbers might differ slightly
OpenJDK Runtime Environment (build 17.0.x+x-Ubuntu-124.04.x)
OpenJDK 64-Bit Server VM (build 17.0.x+x-Ubuntu-124.04.x, mixed mode, sharing)
(Note: Ubuntu 24.04 might default to newer Java versions like 21 if installed differently, which should also work with current Minecraft versions. Installing version 17 explicitly ensures compatibility.)
Step 2: Create a Dedicated Minecraft User
For security reasons, it’s best practice not to run the Minecraft server as the root user. Let’s create a dedicated user account named minecraft
.
sudo adduser minecraft
You’ll be prompted to set a password and fill in some user information (you can leave most fields blank by pressing Enter).
Now, switch to the new minecraft
user:
sudo su - minecraft
You will now be operating as the minecraft
user in its home directory (/home/minecraft
). All subsequent commands in this guide (unless specified otherwise) should be run as this user.
Step 3: Download the Minecraft Server JAR
We need to download the official Minecraft server software file (a .jar
file).
- Create a directory for the server files within the
minecraft
user’s home directory:mkdir ~/server cd ~/server
- Get the Download Link: Go to the official Minecraft Java Edition Server Download page. Right-click the download link for the latest server JAR file and select “Copy Link Address” (or similar wording depending on your browser).
- Download the File: Use the
wget
command in your server terminal, pasting the link you just copied. Use the-O
option to rename the downloaded file tominecraft_server.jar
for consistency.Replace <PASTE_THE_DOWNLOAD_LINK_HERE> with the actual URL you copied wget <PASTE_THE_DOWNLOAD_LINK_HERE> -O minecraft_server.jar
Example wget
Output (link will vary):
--TIMESTAMP-- <COPIED_MINECRAFT_SERVER_URL>
Resolving <server_hostname>... <IP_address>...
Connecting to <server_hostname>|<IP_address>|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: <SIZE> [application/java-archive]
Saving to: โminecraft_server.jarโ
minecraft_server.jar 100%[===================>] <SIZE> --.-KB/s in Xs
TIMESTAMP (XXX MB/s) - โminecraft_server.jarโ saved [<SIZE>/<SIZE>]
Step 4: Configure Firewall (UFW)
Before starting the server, ensure the default Minecraft port (25565) is open in your server’s firewall. Ubuntu uses ufw
(Uncomplicated Firewall).
Note: Run these ufw
commands using sudo
โ you might need to temporarily exit the minecraft
user session (exit
) or open a separate terminal logged in with your sudo-privileged user.
sudo ufw allow 25565/tcp
sudo ufw enable # If not already enabled, confirm with 'y'
sudo ufw status # Verify the rule is active
Example ufw status
Output:
--TIMESTAMP-- <COPIED_MINECRAFT_SERVER_URL>
Resolving <server_hostname>... <IP_address>...
Connecting to <server_hostname>|<IP_address>|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: <SIZE> [application/java-archive]
Saving to: โminecraft_server.jarโ
minecraft_server.jar 100%[===================>] <SIZE> --.-KB/s in Xs
TIMESTAMP (XXX MB/s) - โminecraft_server.jarโ saved [<SIZE>/<SIZE>]
Remember to switch back to the minecraft
user if you exited:
sudo su - minecraft
and cd ~/server
.
Step 5: First Server Run and EULA Agreement
The first time you try to run the server, it will fail but generate important configuration files, including the End User License Agreement (EULA) file that you must accept.
We will use screen
to run the server. screen
allows the server process to keep running even if you disconnect from your SSH session.
- Start a
screen
session: (Make sure you are theminecraft
user in the~/server
directory)Start a named screen session called 'minecraft' screen -S minecraft
Your terminal window will clear โ you are now inside thescreen
session. - Run the server for the first time: Allocate initial (
-Xms
) and maximum (-Xmx
) memory. 1GB (1024M
or1G
) is fine for the first run.nogui
prevents the server from trying to open a graphical interface.java -Xms1G -Xmx1G -jar minecraft_server.jar nogui
- Agree to the EULA: The server will stop, mentioning the EULA. You need to edit the generated
eula.txt
file.nano eula.txt
Change the lineeula=false
toeula=true
:#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).
#TIMESTAMP eula=true
Save and close the file (PressCtrl+X
, thenY
, thenEnter
).
Step 6: Configure Server Properties
You can customize your server’s settings by editing the server.properties
file.
nano server.properties
Here are a few common settings you might want to change:
motd
: The “Message of the Day” displayed in the server list.gamemode
:survival
,creative
,adventure
,spectator
.difficulty
:peaceful
,easy
,normal
,hard
.pvp
:true
orfalse
(Player vs Player combat).max-players
: Maximum number of concurrent players.level-seed
: Enter a specific world seed if desired.white-list
:true
orfalse
. If true, only players listed inwhitelist.json
can join.
Explore the file for many other options. You can find a full list on the Official Minecraft Wiki. Save and close (Ctrl+X
, Y
, Enter
) when done.
Step 7: Run the Minecraft Server
Now you can start the server properly within the screen
session. Allocate more memory this time โ 4GB (-Xmx4G
) is a reasonable starting point for a few players, but adjust based on your server’s available RAM and player count. -Xms1G
sets the initial heap size.
(Make sure you are still inside the screen
session. If you detached or got disconnected, reattach with screen -r minecraft
)
# Example: 1GB initial, 4GB maximum RAM
java -Xms1G -Xmx4G -jar minecraft_server.jar nogui
The server will start loading. You’ll see log messages, including world generation progress. Wait for the message indicating the server is done loading (e.g., Done (...)! For help, type "help"
).
Example Startup Log Snippet (version and timings will vary):
[TIMESTAMP] [ServerMain/INFO]: Building unoptimized datafixer
[TIMESTAMP] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
...
[TIMESTAMP] [Server thread/INFO]: Starting minecraft server version <MINECRAFT_VERSION>
[TIMESTAMP] [Server thread/INFO]: Loading properties
[TIMESTAMP] [Server thread/INFO]: Default game type: SURVIVAL
[TIMESTAMP] [Server thread/INFO]: Generating keypair
[TIMESTAMP] [Server thread/INFO]: Starting Minecraft server on *:25565
...
[TIMESTAMP] [Server thread/INFO]: Preparing level "world"
...
[TIMESTAMP] [Server thread/INFO]: Preparing spawn area: X%
...
[TIMESTAMP] [Server thread/INFO]: Time elapsed: XXX ms
[TIMESTAMP] [Server thread/INFO]: Done (XXXs)! For help, type "help"
To detach from the screen
session (leaving the server running in the background), press Ctrl+A
, then press D
. You’ll see [detached from ...minecraft]
. You can now safely close your SSH connection.
To reattach later (e.g., to stop the server or view the console), run:
screen -r minecraft
To stop the server gracefully, type stop
in the attached console and press Enter.
Step 8: Connect to Your Server
- From Minecraft Client: Launch Minecraft Java Edition. Go to
Multiplayer
->Add Server
. - Server Address:
- If playing on the same machine as the server, use
localhost
. - If connecting from another computer on the same local network, use the server’s private IP address (find it with
ip addr show
on the server). - If connecting from over the internet, use your server’s public IP address (you can find this by running
curl ifconfig.me
on the server or using a site like whatismyipaddress.com). Crucially, you must have configured port forwarding on your router to forward TCP port 25565 to your server’s private IP address.
- If playing on the same machine as the server, use
Important Management & Best Practices
- Run as Non-Root: Always run the server as the dedicated
minecraft
user you created. - Memory Allocation: Adjust
-Xms
and-Xmx
values based on your server’s RAM and expected load. Don’t allocate all your server’s RAM; the OS needs some too. - Backups: Regularly back up the
world
directory (located inside your~/server
directory) to prevent data loss! You can stop the server, create a compressed archive of theworld
folder, and then restart the server. - Whitelist: Enable the whitelist (
white-list=true
inserver.properties
) and add allowed players (whitelist add <username>
in the server console) for a private server. - Keep Updated: Regularly update the Minecraft server JAR (
server.jar
) when new versions release by repeating Step 3. Also, keep your Ubuntu system updated (sudo apt update && sudo apt upgrade
). - Advanced: For more robust server management, consider setting up a
systemd
service file instead of usingscreen
. This allows for automatic startup on boot and better process management (though it’s more complex to set up).
Conclusion
You’ve successfully set up your own Minecraft Java Edition server on Ubuntu 24.04! Enjoy playing with your friends in your private world. Remember to manage resources, perform backups, and keep your server secure.
Recent Comments