1. Download jdk7 (download it on the official website)
Download address:
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
1.1 before downloading, check whether the system is 32-bit or 64 bit
[root@redis ~]# getconf LONG_BIT
64
I am 64 bit here, so I choose to download jdk-7u80-linux-x64.tar.gz
2.2 download tar package:
Select Accept and download jdk-7u80-linux-x64.tar.gz
When downloading, you need to log in to the oracle account. On the CSDN, the old brother provides an account: "the mouse swipes the knife all over the street to find the cat":
Account No.: 2696671285@qq.com
Password: Oracle123
Blog address: http://blog.csdn.net/linbilin_/article/details/50217541
After logging in, you can download it.
2. Import tar package into Linux
yum install -y lrzsz
Use the rz tool to import the downloaded installation package.
3. To install the jdk:
3.1 decompression:
tar -zxvf jdk-7u80-linux-x64.tar.gz -C /usr/local/
cd /usr/local/jdk1.7.0_80/
[root@redis jdk1.7.0_80]# ll
total 19800
drwxr-xr-x 2 uucp 143 4096 Apr 10 2015 bin
-r--r--r-- 1 uucp 143 3339 Apr 10 2015 COPYRIGHT
drwxr-xr-x 4 uucp 143 4096 Apr 10 2015 db
drwxr-xr-x 3 uucp 143 4096 Apr 10 2015 include
drwxr-xr-x 5 uucp 143 4096 Apr 10 2015 jre
drwxr-xr-x 5 uucp 143 4096 Apr 10 2015 lib
-r--r--r-- 1 uucp 143 40 Apr 10 2015 LICENSE
drwxr-xr-x 4 uucp 143 4096 Apr 10 2015 man
-r--r--r-- 1 uucp 143 114 Apr 10 2015 README.html
-rw-r--r-- 1 uucp 143 499 Apr 10 2015 release
-rw-r--r-- 1 uucp 143 19947513 Apr 10 2015 src.zip
-rw-r--r-- 1 uucp 143 110114 Mar 16 2015 THIRDPARTYLICENSEREADME-JAVAFX.txt
-r--r--r-- 1 uucp 143 173571 Apr 10 2015 THIRDPARTYLICENSEREADME.txt
3.2 modify environment variables:
[root@redis jdk1.7.0_80]# vim /etc/profile
Add on the last face
export JAVA_HOME=/usr/local/jdk1.7.0_80
export JRE_HOME=/usr/local/jdk1.7.0_80/jre
export PATH=$PATH:/usr/local/jdk1.7.0_80/bin
export CLASSPATH=./:/usr/local/jdk1.7.0_80/lib:/usr/local/jdk1.7.0_80/jre/lib
Or:
JAVA_HOME=/usr/local/jdk1.7.0_80
JRE_HOME=/usr/local/jdk1.7.0_80/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
Reload:
# source /etc/profile
4. Check whether the java version is installed successfully
[root@redis jdk1.7.0_80]# java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
[root@redis jdk1.7.0_80]# which java
/usr/local/jdk1.7.0_80/bin/java
The jdk installation is now complete.
Special thanks: thanks for the oracle account provided by the old brother "the mouse wring the knife all over the street looking for the cat".