Debian/Ubuntu & others derivatives
First of all, you need to update and upgrade your system
sudo apt update && sudo apt upgrade
After that, you'll need to check if you have already Java installed on your system
If it returns nothing, you can proceed to the installation on java.
Java 8 is recommended for Networks who will run 1.7.10 to 1.10.2 Minecraft versions.
sudo apt install openjdk-8-jdk
Java 11 is recommended for Networks who will run 1.10.2 to 1.16 Minecraft versions.
sudo apt install openjdk-11-jdk
Java 17 is recommended for Networks who will run 1.16 and further Minecraft versions.
sudo apt install openjdk-17-jdk
Update your system
sudo yum -y update
sudo yum install java-1.8.0-openjdk
sudo yum install java-11-openjdk
sudo yum -y install wget curl
sudo tar xvf openjdk-17_linux-x64_bin.tar.gz
sudo mv jdk-17 /opt/
echo "export JAVA_HOME=/opt/jdk-17 export PATH=$PATH:$JAVA_HOME/bin" >> ~/.bashrc