Want to explore a private world with your friends but don’t have a stable and customizable Minecraft server?
Good news — as long as you have a Linux server, you can easily build your own Minecraft server.
This guide will walk you through everything from scratch. Ready?
Let’s begin our creative adventure!
Install Java JDK on Linux
Use the following commands to install Java JDK.
Note: Minecraft version 1.21 requires Java JDK 21 or newer.
sudo apt update
sudo apt install openjdk-21-jdk
Verify that Java is installed correctly:
java -version
If you see output similar to the example below, the installation was successful:
Download the Minecraft Server
Create a directory to store your server files:
mkdir minecraft
cd minecraft
Download the Minecraft server JAR file from the official site:
https://www.minecraft.net/en-us/download/server
Or download directly:
wget https://piston-data.mojang.com/v1/objects/95495a7f485eedd84ce928cef5e223b757d2f764/server.jar
Start the server using the command below:-Xmx2G sets the maximum allocated memory to 2G.-Xms1G sets the minimum allocated memory to 1G.
java -Xmx2G -Xms1G -jar server.jar --nogui
You will see the message:
You need to agree to the EULA in order to run the server.
Open eula.txt and change: eula=false to: eula=true
Run the server again.
When you see:
Done! For help, type "help"
Congratulations — your server is running!
You can now connect using: Server IP:25565
But wait — we still have some setup left!
Run the Server in the Background Using Screen
You can run the server in the background in other ways, but screen allows you to re-enter the console at any time to run Minecraft commands.
Install screen:
sudo apt install screen
Start a screen session and run the server:
screen -S minecraft
java -Xmx2G -Xms1G -jar server.jar --nogui
Detach from screen without stopping the server: Ctrl + A then press D
Re-enter the running session:
screen -r minecraft
Now you can enter Minecraft console commands anytime you need.