Minecraft is a sandbox video game. The creative and building aspects of Minecraft enable players to build constructions out of textured cubes in a 3D procedurally generated world. Other activities in the game include exploration, resource gathering, crafting, and combat.
1. Update your system
sudo apt update && sudo apt upgrade -y
2. Open the firewall
If you use UFW, allow the default port.
sudo ufw allow 25565/tcp sudo ufw status
If you use IPtables, run these commands:
sudo iptables -A INPUT -p tcp --dport 25565 -m conntrack --ctstate NEW -j ACCEPT
sudo ip6tables -A INPUT -p tcp --dport 25565 -m conntrack --ctstate NEW -j ACCEPT
Save changes in IPtables:
sudo apt install -y iptables-persistent
sudo netfilter-persistent save
sudo systemctl enable netfilter-persistent
3. Install Java 21
sudo apt install -y curl unzip openjdk-21-jdk
4. Create a dedicated user
sudo adduser minecraft
Follow the prompts: create password for your user and enter other details.
5. Download the Minecraft server
Switch to the minecraft user:
su minecraft
Prepare a folder:
mkdir -p ~/minecraft-server
cd ~/minecraft-server
From the official page copy the current server jar link and download it with wget (the link may differ from the link in our example):
curl -L 'https://piston-data.mojang.com/v1/objects/95495a7f485eedd84ce928cef5e223b757d2f764/server.jar' -o minecraft_server.jar
6. Accept the EULA
echo "eula=true" > eula.txt
By proceeding you agree to Mojang’s EULA from the official server page. (Minecraft.net)
7. Start the server
java -Xmx2G -Xms2G -jar minecraft_server.jar nogui
Important: The Xmx2G and Xms2G flags define the minimum and maximum amount of RAM the Minecraft server will use. Adjust these values to fit your needs.
8. Configure server properties
nano server.properties
Tweak game mode, difficulty, white list, and view distance, then save.
9. Connect to your Minecraft Server
In Minecraft Java Edition choose Multiplayer then Add Server, set the server name and use your public IP address. If you play on the same machine use localhost.


