5.1. CentOS@ install JDK1.8 graphic tutorial
One, the first method windows download##
1. Download the tar package of jdk###
Website: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
![](/img/cce8bf7a9be4590ac71624358b8207c6/evfv6ejlyx.png)
2. Click Accept License Agreement
![](/img/cce8bf7a9be4590ac71624358b8207c6/fjn89aaxr9.png)
3. Select jdk-8u171-linux-x64.tar.gz to download###
![](/img/cce8bf7a9be4590ac71624358b8207c6/az8fxp263u.png)
4. Waiting...
![](/img/cce8bf7a9be4590ac71624358b8207c6/xjwcnbexuu.png)
5. Downloaded
![](/img/cce8bf7a9be4590ac71624358b8207c6/nx3vo8lbgc.png)
6. Open VMware, select the virtual machine you want to use, and click to open this virtual machine###
![](/img/cce8bf7a9be4590ac71624358b8207c6/m5e10fy9wj.png)
7. For removable devices that pop up, tick Don’t show this reminder and click OK###
![](/img/cce8bf7a9be4590ac71624358b8207c6/nuahwv9may.png)
8. Minimize the virtual machine and leave it alone
![](/img/cce8bf7a9be4590ac71624358b8207c6/p7duisjd8x.png)
9. Open xshell, select the session corresponding to the virtual machine ip, and click connect
![](/img/cce8bf7a9be4590ac71624358b8207c6/igerf774z7.png)
10. The connection is successful
![](/img/cce8bf7a9be4590ac71624358b8207c6/2f0vrm0atk.png)
11. Check whether jdk has been installed through the rpm -qa | grep java command
![](/img/cce8bf7a9be4590ac71624358b8207c6/kee6vxa6oe.png)
12. My display is not installed. If it is installed, use the rpm -e xxx --nodeps command to load and unload. xxx means the name of the installation package you found through the rpm -qa | grep java command
![](/img/cce8bf7a9be4590ac71624358b8207c6/bmvzasq59o.png)
12. Return to the root directory by cd / command###
![](/img/cce8bf7a9be4590ac71624358b8207c6/vltj2qoite.png)
13. Enter the local directory under the usr directory under the root directory through the cd usr/local/ command. This directory is for storing some local shared resources
14. Use the ll command to check the directory structure in the current directory. The ll command is short for the ls -l command, which is equivalent to the dir command in dos
![](/img/cce8bf7a9be4590ac71624358b8207c6/2jwe6k33t6.png)
15. Create a directory named java in the current directory with the mkdir java command###
![](/img/cce8bf7a9be4590ac71624358b8207c6/rv9r1m9txk.png)
16. Use the ll command to check the directory structure in the current directory, the java directory just created has
![](/img/cce8bf7a9be4590ac71624358b8207c6/npkqli5hd1.png)
17. Enter the java directory through the cd java command###
![](/img/cce8bf7a9be4590ac71624358b8207c6/4asmhcj8k3.png)
18. Use the ll command to check the directory structure in the current directory###
![](/img/cce8bf7a9be4590ac71624358b8207c6/y0988ermg3.png)
19. Click on the window -->> Transfer the new file, and transfer the just downloaded jdk tar package to the CentOS7 system through the ftp protocol
![](/img/cce8bf7a9be4590ac71624358b8207c6/hl7kihloyu.png)
20. The left side represents your computer system, and the right side represents the CentOS7 system
![](/img/cce8bf7a9be4590ac71624358b8207c6/sjx5ubm046.png)
21. Find the download directory of your jdk tar package on the left###
![](/img/cce8bf7a9be4590ac71624358b8207c6/b3ktl6306h.png)
22. Right-click on the file you want to transfer and click Transfer###
![](/img/cce8bf7a9be4590ac71624358b8207c6/5xxg99r24p.png)
23. After the upload is successful, close the ftp transfer tool
![](/img/cce8bf7a9be4590ac71624358b8207c6/k768if89i5.png)
24. Use the ll command to check the directory structure in the current directory, and a tar package named jdk-8u171-linux-x64.tar.gz appears
![](/img/cce8bf7a9be4590ac71624358b8207c6/ltwsd6ufor.png)
25. Decompress the tar package by tar -xvf jdk-8u171-linux-x64.tar.gz###
![](/img/cce8bf7a9be4590ac71624358b8207c6/3bc55dw136.png)
26. Use the ll command to check the directory structure in the current directory###
![](/img/cce8bf7a9be4590ac71624358b8207c6/0xp9lu8xh2.png)
27. Delete the tar package through the rm -rf jdk-8u171-linux-x64.tar.gz command###
![](/img/cce8bf7a9be4590ac71624358b8207c6/sa7sbar4ry.png)
28. Use the ll command to check the directory structure in the current directory###
![](/img/cce8bf7a9be4590ac71624358b8207c6/jdl2w7ib9j.png)
29. Clear the screen through the clear command, which is equivalent to the cls command in dos
![](/img/cce8bf7a9be4590ac71624358b8207c6/dnguf4uij8.png)
30. Enter the jdk installation directory through the cd jdk1.8.0_171/ command###
![](/img/cce8bf7a9be4590ac71624358b8207c6/kjjj79jcya.png)
31. Display the current directory through the pwd command, copy the current directory, because you will configure environment variables
![](/img/cce8bf7a9be4590ac71624358b8207c6/dq6ba2c37n.png)
32. Edit the configuration file of environment variables through the vim /etc/profile command###
![](/img/cce8bf7a9be4590ac71624358b8207c6/gu1qtib4vz.png)
33. Prompt that the command is not found. Install the vim text editor through the yum -y install vim command. I don’t use the vi text editor because I like highlighting###
![](/img/cce8bf7a9be4590ac71624358b8207c6/in2w8obf5g.png)
34. Continue to edit the configuration file of environment variables through the vim /etc/profile command. Press the up key on the small keyboard to find the command you just entered, which is almost the same as dos
![](/img/cce8bf7a9be4590ac71624358b8207c6/s96kb1516z.png)
35. Press the down key of the small keyboard to come to the bottom of the configuration file###
36. Click the i button to enter the insert mode, and start a new line to be written into the environment variable configuration of java###
![](/img/cce8bf7a9be4590ac71624358b8207c6/g3ob5bygot.png)
37. Write the following content, the value of JAVA_HOME is the path of the current directory displayed by the pwd command just now, if you forgot to see step 31###
export JAVA_HOME=/usr/local/java/jdk1.8.0_121
export CLASSPATH=.:JAVA_HOME/lib/tools.jar:JAVA_HOME/jre/lib/rt.jar
export PATH=JAVA_HOME/bin:PATH
![](/img/cce8bf7a9be4590ac71624358b8207c6/t8us5f1cne.png)
38. Click the ESC key to exit insert mode
![](/img/cce8bf7a9be4590ac71624358b8207c6/nf1kyegoqs.png)
39. Click the: button, type wq and press Enter to save and exit, and: is ### in English
![](/img/cce8bf7a9be4590ac71624358b8207c6/9dqz169osx.png)
40. Clear the screen with the clear command
![](/img/cce8bf7a9be4590ac71624358b8207c6/40tc52vuvm.png)
41. Use the source /etc/profile command to make the changed configuration take effect immediately
![](/img/cce8bf7a9be4590ac71624358b8207c6/oqncga6f1n.png)
42. Use the java -version command and javac -version command to check whether the jdk is installed successfully
![](/img/cce8bf7a9be4590ac71624358b8207c6/rnlinfudwj.png)
Second, the second method CentOS download
wget http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz?AuthParam=1534129356_6b3ac55c6a38ba5a54c912855deb6a22
Third, the third method yum download
1、 Search jdk installation package
# yum search java|grep jdk
![](/img/cce8bf7a9be4590ac71624358b8207c6/mj68f7rs52.png)
2、 Download jdk1.8, the default directory after downloading is: /usr/lib/jvm/
# yum install java-1.8.0-openjdk
![](/img/cce8bf7a9be4590ac71624358b8207c6/a4fjxph3lj.png)