Skip to content

Instantly share code, notes, and snippets.

@alkavan
Last active May 19, 2024 16:53
Show Gist options
  • Save alkavan/8d74303a661a0b47a6b222cb0436f182 to your computer and use it in GitHub Desktop.
Save alkavan/8d74303a661a0b47a6b222cb0436f182 to your computer and use it in GitHub Desktop.
Instructions to install Minecraft server on Rocky Linux.

Install Minecraft Server on Rocky Linux 9

Initial System Setup

Update system.

dnf update -y

Set your timezone.

timedatectl set-timezone UTC
date

Set the machine hostname.

hostnamectl set-hostname minecraft1

Install nano text editor and some other tools.

dnf install -y nano tmux git

Reboot system, login back to server (as root).

reboot

Install Firewall and Open Server Ports

Install Firewall

You might need to install the service.

dnf install firewalld

Check firewall status (should be off in most cases).

firewall-cmd --state

If firewall not running start it.

systemctl start firewalld.service

Check the current state of firewall (ssh should be enabled):

firewall-cmd --get-active-zones
firewall-cmd --list-all

Open add minecraft port rule to public zone of the firewall:

firewall-cmd --zone=public --add-port=25565/tcp
firewall-cmd --zone=public --add-port=25565/tcp --permanent

List firewall rules again to make sure the port is open:

firewall-cmd --list-all

Minecraft User Creation

Create non-root superuser

Create yourself a user.

adduser minecraft

Copy root key to user home (you can remove it from the root user later).

cp -r -p /root/.ssh/ /home/minecraft/
chown -R minecraft:minecraft /home/minecraft/.ssh

Add your user to wheel group (as supplementary group, primary group still minecraft).

usermod -a -G wheel minecraft

For using sudo without requiring a password create the following configuration:

nano /etc/sudoers.d/wheel

Then add the following line:

# allow wheel group use without password
%wheel  ALL=(ALL)       NOPASSWD: ALL

Logout server the server.

exit

Minecraft Server Installation

Login back to the server as minecraft user (ssh minecraft@<you_server_ip>).

Install OpenJDK 21:

dnf install -y java-21-openjdk java-21-openjdk-static-libs

Create solder for the server:

mkdir server && cd server

Download version 1.20.6 of the Minecraft server (Java Edition).

curl https://piston-data.mojang.com/v1/objects/145ff0858209bcfc164859ba735d4199aafa1eea/server.jar \
-o minecraft_1.20.6_server.jar

Create a tmux session (to be able exit ssh session without closing server):

tmux

Run The server.

java -jar minecraft_1.20.6_server.jar

To detach the active tmux session press CTRL+B then D, to restore type tmux at.

Spigot Minecraft High-Performance Server Installation

Download the latests BuildTools.jar from the Jenkins Build Page.

Run the build procedure:

java -jar BuildTools.jar --rev 1.20.6

Run the Spigot server:

java -jar spigot-1.20.6.jar

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment