You can install Java JDK 8 on CentOS by following these steps:
1. Install Java JDK 8:
sudo yum install java-1.8.0-openjdk-devel
2. Check Java version:
java -version
If the installation is successful, you should see version information similar to the following:
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
3. Set the JAVA_HOME environment variable:
Edit the /etc/profile file and add the following lines to the bottom of the file:
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export PATH=$JAVA_HOME/bin:$PATH
4. Make it effective:
Execute the following command to make it effective:
source /etc/profile
In this way, you can successfully install and configure Java JDK 8.