Minecraft Server on Ubuntu 22.04: Quick and Easy Setup for Beginners

Minecraft is one of the most popular games ever made. Did you know you can host your own private server that you and your mates can play on? Checkout of this procedure of how to create a Minecraft server on Ubuntu 22.04

Minecraft Server

Step 1 – Update Server and Install Java:

  • Minecraft requires Java to run. You can install OpenJDK using the following commands:

Bash
sudo apt update -y # Update package listsย 

sudo apt install openjdk-17-jre-headless -y # Install OpenJDK JRE (headless version for servers)ย 

  • Now check the version of Java

Bash
java -version # Verify Java installation

You should see output like this

Bash
openjdk 17.0.10 2024-01-16
OpenJDK Runtime Environment (build 17.0.10+7-Ubuntu-122.04.1)
OpenJDK 64-Bit Server VM (build 17.0.10+7-Ubuntu-122.04.1, mixed mode, sharing)

Step 2 – Download the Minecraft Server:

  • First, create the folder structure
  • Then, use wget to download the latest server JAR file from the official Minecraft website.

Bash
mkdir ~/minecraft_server ย  ย  ย  # Create a server directory

cd ~/minecraft_server

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

You should see output like this:

Bash
root@AIML:~# mkdir ~/minecraft_server
root@AIML:~# cd ~/minecraft_server
root@AIML:~/minecraft_server# wget https://launcher.mojang.com/v1/objects/c8f83c5655308435b3dcf03c06d9fe8740a77469/server.jar
--2024-05-28 14:02:38--  https://launcher.mojang.com/v1/objects/c8f83c5655308435b3dcf03c06d9fe8740a77469/server.jar
Resolving launcher.mojang.com (launcher.mojang.com)... 13.107.246.41, 2620:1ec:bdf::41
Connecting to launcher.mojang.com (launcher.mojang.com)|13.107.246.41|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 37961464 (36M) [application/zip]
Saving to: โ€˜minecraft_serverโ€™

minecraft_server          100%[===================================>]  36.20M  8.76MB/s    in 4.1s    

2024-05-28 14:02:43 (8.76 MB/s) - โ€˜minecraft_serverโ€™ saved [37961464/37961464]

root@AIML:~/minecraft_server# 

Step 3 – Set Up the Minecraft Server:

  • Open a new screen session
Bash
screen
  • Now start the jar file. Dont worry, It will always fail on the first run
Bash
java -Xmx1024M -Xms1024M -jar minecraft_server.jar noguiย  # Run once to generate files
  • Agree to the EULA in the eula.txt file.
Bash
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account>
#Tue May 28 14:15:43 UTC 2024
eula=true 
  • Edit the server.properties file to customize server settings.
Bash
nano server.properties
  • I recommend setting the server properties as follows:

  • Server Properties (server.properties):
    • motd: Set the message of the day.
    • gamemode: Choose the default game mode (survival, creative, etc.).
    • difficulty: Set the difficulty level.
    • white-list: Enable/disable the whitelist.
    • max-players: Define the maximum number of players.
    • Many other options are available for fine-tuning your server.

Step 4Run the Server:

  • Im now going to start the server using 8GB RAM
Bash
java -Xms1024M -Xmx4G -jar minecraft_server.jar nogui

  • You should see output similar to this:

It will take a few minutes to fully start the server:

Bash
Starting net.minecraft.server.Main
[14:33:01] [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'
[14:38:45] [Worker-Main-6/INFO]: Loaded 7 recipes
[14:39:04] [Worker-Main-6/INFO]: Loaded 1141 advancements
[14:41:55] [Server thread/INFO]: Starting minecraft server version 1.18.2
[14:41:55] [Server thread/INFO]: Loading properties
[14:41:55] [Server thread/INFO]: Default game type: SURVIVAL
[14:41:55] [Server thread/INFO]: Generating keypair
[14:42:23] [Server thread/INFO]: Starting Minecraft server on *:25565
[14:42:40] [Server thread/INFO]: Using epoll channel type
[14:43:08] [Server thread/INFO]: Preparing level "world"
[14:55:48] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[14:58:29] [Worker-Main-22/INFO]: Preparing spawn area: 0%
[14:58:29] [Worker-Main-22/INFO]: Preparing spawn area: 1%
[14:58:29] [Worker-Main-22/INFO]: Preparing spawn area: 1%
[14:58:29] [Worker-Main-22/INFO]: Preparing spawn area: 1%
[14:58:29] [Worker-Main-22/INFO]: Preparing spawn area: 1%
[14:58:29] [Worker-Main-22/INFO]: Preparing spawn area: 1%
[14:58:29] [Worker-Main-22/INFO]: Preparing spawn area: 4%
[14:58:34] [Worker-Main-13/INFO]: Preparing spawn area: 4%
[14:58:34] [Worker-Main-22/INFO]: Preparing spawn area: 5%
[14:58:34] [Worker-Main-13/INFO]: Preparing spawn area: 5%
[14:58:34] [Worker-Main-22/INFO]: Preparing spawn area: 5%
[14:58:34] [Worker-Main-22/INFO]: Preparing spawn area: 5%
[14:58:34] [Worker-Main-22/INFO]: Preparing spawn area: 5%
[14:58:34] [Worker-Main-22/INFO]: Preparing spawn area: 6%
[14:58:34] [Worker-Main-22/INFO]: Preparing spawn area: 6%
[14:58:34] [Worker-Main-13/INFO]: Preparing spawn area: 6%
[14:58:34] [Worker-Main-24/INFO]: Preparing spawn area: 6%
[14:58:34] [Worker-Main-24/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-22/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-13/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-22/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-22/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-22/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-22/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-13/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-13/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-13/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-13/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-13/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-13/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-24/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-24/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-24/INFO]: Preparing spawn area: 24%
[14:58:42] [Worker-Main-23/INFO]: Preparing spawn area: 24%
[14:58:49] [Worker-Main-25/INFO]: Preparing spawn area: 24%
[14:58:49] [Worker-Main-25/INFO]: Preparing spawn area: 24%
[14:58:49] [Worker-Main-23/INFO]: Preparing spawn area: 24%
[14:58:49] [Worker-Main-23/INFO]: Preparing spawn area: 24%
[14:58:49] [Worker-Main-25/INFO]: Preparing spawn area: 24%
[14:58:49] [Worker-Main-25/INFO]: Preparing spawn area: 24%
[14:58:49] [Worker-Main-23/INFO]: Preparing spawn area: 24%
[14:58:49] [Worker-Main-25/INFO]: Preparing spawn area: 24%
[14:58:49] [Worker-Main-25/INFO]: Preparing spawn area: 24%
[14:58:49] [Worker-Main-23/INFO]: Preparing spawn area: 24%
[14:58:49] [Worker-Main-23/INFO]: Preparing spawn area: 24%
[14:58:49] [Worker-Main-13/INFO]: Preparing spawn area: 24%
[14:58:49] [Worker-Main-22/INFO]: Preparing spawn area: 24%
[14:58:50] [Worker-Main-22/INFO]: Preparing spawn area: 24%
[14:58:50] [Worker-Main-13/INFO]: Preparing spawn area: 24%
[14:58:50] [Worker-Main-13/INFO]: Preparing spawn area: 24%
[14:58:53] [Worker-Main-25/INFO]: Preparing spawn area: 24%
[14:58:53] [Worker-Main-25/INFO]: Preparing spawn area: 24%
[14:58:54] [Worker-Main-24/INFO]: Preparing spawn area: 24%
[14:58:54] [Worker-Main-25/INFO]: Preparing spawn area: 24%
[14:58:54] [Worker-Main-24/INFO]: Preparing spawn area: 24%
[14:58:54] [Worker-Main-25/INFO]: Preparing spawn area: 24%
[14:58:54] [Worker-Main-22/INFO]: Preparing spawn area: 24%
[14:58:54] [Worker-Main-13/INFO]: Preparing spawn area: 24%
[14:58:55] [Worker-Main-13/INFO]: Preparing spawn area: 25%
[14:58:55] [Worker-Main-22/INFO]: Preparing spawn area: 25%
[14:58:56] [Worker-Main-24/INFO]: Preparing spawn area: 25%
[14:58:56] [Worker-Main-24/INFO]: Preparing spawn area: 26%
[14:58:57] [Worker-Main-13/INFO]: Preparing spawn area: 26%
[14:58:57] [Worker-Main-24/INFO]: Preparing spawn area: 27%
[14:58:58] [Worker-Main-23/INFO]: Preparing spawn area: 28%
[14:58:58] [Worker-Main-13/INFO]: Preparing spawn area: 29%
[14:58:59] [Worker-Main-23/INFO]: Preparing spawn area: 30%
[14:58:59] [Worker-Main-24/INFO]: Preparing spawn area: 30%
[14:59:00] [Worker-Main-13/INFO]: Preparing spawn area: 31%
[14:59:00] [Worker-Main-13/INFO]: Preparing spawn area: 32%
[14:59:05] [Worker-Main-23/INFO]: Preparing spawn area: 33%
[14:59:05] [Worker-Main-25/INFO]: Preparing spawn area: 33%
[14:59:05] [Worker-Main-25/INFO]: Preparing spawn area: 33%
[14:59:05] [Worker-Main-22/INFO]: Preparing spawn area: 33%
[14:59:05] [Worker-Main-22/INFO]: Preparing spawn area: 33%
[14:59:05] [Worker-Main-22/INFO]: Preparing spawn area: 33%
[14:59:05] [Worker-Main-24/INFO]: Preparing spawn area: 33%
[14:59:05] [Worker-Main-24/INFO]: Preparing spawn area: 34%
[14:59:05] [Worker-Main-25/INFO]: Preparing spawn area: 34%
[14:59:07] [Worker-Main-24/INFO]: Preparing spawn area: 34%
[14:59:07] [Worker-Main-22/INFO]: Preparing spawn area: 34%
[14:59:07] [Worker-Main-22/INFO]: Preparing spawn area: 34%
[14:59:07] [Worker-Main-13/INFO]: Preparing spawn area: 34%
[14:59:07] [Worker-Main-22/INFO]: Preparing spawn area: 34%
[14:59:08] [Worker-Main-22/INFO]: Preparing spawn area: 35%
[14:59:08] [Worker-Main-22/INFO]: Preparing spawn area: 35%
[14:59:09] [Worker-Main-13/INFO]: Preparing spawn area: 36%
[14:59:09] [Worker-Main-23/INFO]: Preparing spawn area: 37%
[14:59:10] [Worker-Main-22/INFO]: Preparing spawn area: 39%
[14:59:10] [Worker-Main-24/INFO]: Preparing spawn area: 40%
[14:59:11] [Worker-Main-23/INFO]: Preparing spawn area: 40%
[14:59:11] [Worker-Main-22/INFO]: Preparing spawn area: 41%
[14:59:17] [Worker-Main-24/INFO]: Preparing spawn area: 41%
[14:59:17] [Worker-Main-24/INFO]: Preparing spawn area: 41%
[14:59:17] [Worker-Main-25/INFO]: Preparing spawn area: 41%
[14:59:17] [Worker-Main-25/INFO]: Preparing spawn area: 41%
[14:59:17] [Worker-Main-13/INFO]: Preparing spawn area: 41%
[14:59:17] [Worker-Main-23/INFO]: Preparing spawn area: 41%
[14:59:17] [Worker-Main-24/INFO]: Preparing spawn area: 41%
[14:59:17] [Worker-Main-24/INFO]: Preparing spawn area: 41%
[14:59:17] [Worker-Main-24/INFO]: Preparing spawn area: 41%
[14:59:17] [Worker-Main-24/INFO]: Preparing spawn area: 41%
[14:59:17] [Worker-Main-24/INFO]: Preparing spawn area: 41%
[14:59:17] [Worker-Main-23/INFO]: Preparing spawn area: 42%
[14:59:18] [Worker-Main-25/INFO]: Preparing spawn area: 44%
[14:59:18] [Worker-Main-13/INFO]: Preparing spawn area: 46%
[14:59:19] [Worker-Main-22/INFO]: Preparing spawn area: 47%
[14:59:19] [Worker-Main-13/INFO]: Preparing spawn area: 48%
[14:59:20] [Worker-Main-22/INFO]: Preparing spawn area: 49%
[14:59:20] [Worker-Main-24/INFO]: Preparing spawn area: 50%
[14:59:21] [Worker-Main-23/INFO]: Preparing spawn area: 51%
[14:59:21] [Worker-Main-22/INFO]: Preparing spawn area: 53%
[14:59:22] [Worker-Main-25/INFO]: Preparing spawn area: 55%
[14:59:22] [Worker-Main-24/INFO]: Preparing spawn area: 56%
[14:59:23] [Worker-Main-24/INFO]: Preparing spawn area: 57%
[14:59:23] [Worker-Main-24/INFO]: Preparing spawn area: 58%
[14:59:24] [Worker-Main-22/INFO]: Preparing spawn area: 60%
[14:59:24] [Worker-Main-22/INFO]: Preparing spawn area: 62%
[14:59:25] [Worker-Main-13/INFO]: Preparing spawn area: 63%
[14:59:25] [Worker-Main-13/INFO]: Preparing spawn area: 65%
[14:59:26] [Worker-Main-25/INFO]: Preparing spawn area: 66%
[14:59:26] [Worker-Main-23/INFO]: Preparing spawn area: 67%
[14:59:27] [Worker-Main-23/INFO]: Preparing spawn area: 68%
[14:59:27] [Worker-Main-23/INFO]: Preparing spawn area: 69%
[14:59:28] [Worker-Main-22/INFO]: Preparing spawn area: 71%
[14:59:28] [Worker-Main-25/INFO]: Preparing spawn area: 73%
[14:59:29] [Worker-Main-25/INFO]: Preparing spawn area: 75%
[14:59:29] [Worker-Main-23/INFO]: Preparing spawn area: 76%
[14:59:30] [Worker-Main-22/INFO]: Preparing spawn area: 77%
[14:59:30] [Worker-Main-13/INFO]: Preparing spawn area: 78%
[14:59:31] [Worker-Main-24/INFO]: Preparing spawn area: 80%
[14:59:31] [Worker-Main-24/INFO]: Preparing spawn area: 81%
[14:59:32] [Worker-Main-24/INFO]: Preparing spawn area: 82%
[14:59:32] [Worker-Main-25/INFO]: Preparing spawn area: 83%
[14:59:33] [Worker-Main-22/INFO]: Preparing spawn area: 85%
[14:59:33] [Worker-Main-25/INFO]: Preparing spawn area: 87%
[14:59:34] [Worker-Main-22/INFO]: Preparing spawn area: 88%
[14:59:34] [Worker-Main-23/INFO]: Preparing spawn area: 88%
[14:59:35] [Worker-Main-23/INFO]: Preparing spawn area: 89%
[14:59:35] [Worker-Main-23/INFO]: Preparing spawn area: 90%
[14:59:36] [Worker-Main-22/INFO]: Preparing spawn area: 92%
[14:59:36] [Worker-Main-25/INFO]: Preparing spawn area: 94%
[14:59:37] [Worker-Main-22/INFO]: Preparing spawn area: 95%
[14:59:37] [Worker-Main-13/INFO]: Preparing spawn area: 96%
[14:59:38] [Worker-Main-23/INFO]: Preparing spawn area: 97%
[14:59:38] [Worker-Main-25/INFO]: Preparing spawn area: 98%
[14:59:39] [Server thread/INFO]: Time elapsed: 230952 ms
[14:59:39] [Server thread/INFO]: Done (990.542s)! For help, type "help"

Step 5 – Connect to the Server:

Local: If playing on the same machine, use localhost as the server address in Minecraft.

Remote:

  • Find your server’s public IP address (e.g., using a site like https://whatismyipaddress.com/)
  • Port Forwarding: Configure your router to forward port 25565 to your server’s local IP address.

Important Additional Considerations:

  • Firewall: Ensure that port 25565 (or the port you’ve configured) is open in your firewall for incoming connections. (UFW command: sudo ufw allow 25565)
  • System Resources: Allocate enough RAM for your server. The -Xmx and -Xms flags in the launch script control maximum and initial memory allocation. Adjust them based on your system’s capabilities.
  • Backups: Regularly back up your server’s world files to prevent data loss.
  • Security: Keep your server software and plugins updated. Use a strong password if you enable online mode.

Additional Tips:

  • Consider using screen or tmux to keep the server running in the background.
  • Use a firewall to restrict access to your server.
  • Install mods or plugins for added functionality (optional).
  • Explore server management tools like Multicraft or McMyAdmin.

Thanks for taking the time to read this article. if you have any questions or feedback, please write in the comment section below.

Richard.Bailey

Richard Bailey, a seasoned tech enthusiast, combines a passion for innovation with a knack for simplifying complex concepts. With over a decade in the industry, he's pioneered transformative solutions, blending creativity with technical prowess. An avid writer, Richard's articles resonate with readers, offering insightful perspectives that bridge the gap between technology and everyday life. His commitment to excellence and tireless pursuit of knowledge continues to inspire and shape the tech landscape.

Leave a Reply

Your email address will not be published. Required fields are marked *

Translate ยป