Use this AlmaLinux guide if you want a Minecraft Java server on a RHEL-style system using dnf and firewalld. If your service is one of our Minecraft server hosting plans, follow How to create a Minecraft Server instead, as the control panel handles the server setup for you.
For a manual install, choose hardware based on your world size, view distance, player count, and any plugins you plan to add later. A Gaming VPS, VPS, or Dedicated Server can be used depending on how much headroom you need.
Prepare AlmaLinux
- Log in over SSH with a user that can run sudo commands.
- Update the system and install Java 21, curl, jq, and screen:
sudo dnf update -y sudo dnf install -y java-21-openjdk-headless curl jq screen
- Create the Minecraft directory:
mkdir -p ~/minecraft cd ~/minecraft
Create the server files
- Fetch the latest official Vanilla server jar from Mojang:
LATEST=$(curl -fsSL https://piston-meta.mojang.com/mc/game/version_manifest_v2.json | jq -r '.latest.release') VERSION_URL=$(curl -fsSL https://piston-meta.mojang.com/mc/game/version_manifest_v2.json | jq -r --arg VERSION "$LATEST" '.versions[] | select(.id == $VERSION) | .url') SERVER_URL=$(curl -fsSL "$VERSION_URL" | jq -r '.downloads.server.url') curl -fLo server.jar "$SERVER_URL"
If you want a specific Minecraft version instead of the latest release, set VERSION to the version you want, then download the matching server jar:
VERSION="1.21.1" VERSION_URL=$(curl -fsSL https://piston-meta.mojang.com/mc/game/version_manifest_v2.json | jq -r --arg VERSION "$VERSION" '.versions[] | select(.id == $VERSION) | .url') SERVER_URL=$(curl -fsSL "$VERSION_URL" | jq -r '.downloads.server.url') curl -fLo server.jar "$SERVER_URL"
- Run Minecraft once so the first files are generated:
java -Xms1G -Xmx2G -jar server.jar nogui
- If you accept the Minecraft EULA, set eula=true:
sed -i 's/eula=false/eula=true/' eula.txt
- Launch the server in screen:
screen -S minecraft java -Xms1G -Xmx2G -jar server.jar nogui
- Detach from screen with CTRL + A, then D. The server stays online after you disconnect.
Open the port
- If firewalld is active, open port 25565 for Minecraft. Some AlmaLinux installs use another firewall or upstream filtering, so adjust this to match your setup:
sudo firewall-cmd --permanent --add-port=25565/tcp sudo firewall-cmd --reload
- Attach back to the running console when needed:
screen -r minecraft
Once the server has finished starting, players can join with your server IP. The default Minecraft Java port is 25565.
With AlmaLinux, remember that you are also maintaining the operating system. Keep Java updated, check logs after crashes, and make sure you have a backup plan before changing server files.
