Download JDK
1 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Two kinds of installation methods:
The first type: *tar.gz compile and install
1. Create a Java file
1 [[email protected] ~]# CD/usr #进入usr目录 2 [[email protected] usr]# mkdir java #创建java文件
2. Copy the downloaded file to the/usr/java directory:
[Email protected] java]# cp/root/desktop/jdk-8u161-linux-x64.tar.gz/usr/java/
3. Unzip the JDK to the current directory: Get a/usr/java/jdk1.8.0_161/directory
4. Configure Environment variables
[Email protected] java]# vim/etc/profile# file end add java_home=/usr/java/jdk1.8.0_161/classpath= $JAVA _home/lib/path=$ Path: $JAVA _home/binexport path Java_home CLASSPATH
5. Restart the host or execute the command: Source/etc/profile
sudo shutdown-r now
6. View installation Status
[Email protected] java]# java-"1.8.0_161"1.8. 0_161- 25.161-b12, Mixed mode)
The second type: RPM package
The other steps are the same
4. Installing the JDK
1 cd/usr/java23 rpm-ivh jdk-8u161-linux-x64.rpm
Linux Java Environment installation configuration record