真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

CentOS7上以rpm方式安裝JDK8

CentOS 7 安裝成功后可能已經(jīng)默認安裝了OpenJDK的JRE,但平時進行JAVA開發(fā)時需要用完整的JDK,所以為了避免以后不必要的麻煩,在此卸載了OpenJDK的JRE,并重新安裝了Oracle的JDK8

創(chuàng)新互聯(lián)公司堅持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:做網(wǎng)站、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的卓資網(wǎng)站設(shè)計、移動媒體設(shè)計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

1.安裝說明

系統(tǒng)環(huán)境:CentOS 7

安裝方式:rpm

安裝包:jdk-8u131-linux-x64.rpm

2.檢查系統(tǒng)原安裝版本

[hadoop@centos7-1 ~]$ java -version
OpenJDK Version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
[hadoop@centos7-1 ~]$ rpm -qa|grep java
libvirt-java-devel-0.4.9-4.el7.noarch
tzdata-java-2017b-1.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.131-3.b12.el7_3.x86_64
java-1.7.0-openjdk-1.7.0.141-2.6.10.1.el7_3.x86_64
libvirt-java-0.4.9-4.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
java-1.7.0-openjdk-headless-1.7.0.141-2.6.10.1.el7_3.x86_64
java-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64
python-javapackages-3.4.1-11.el7.noarch
[hadoop@centos7-1 ~]$ 

3.卸載系統(tǒng)已安裝的openjdk

libvirt-java-devel-0.4.9-4.el7.noarch
libvirt-java-0.4.9-4.el7.noarch
tzdata-java-2017b-1.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.131-3.b12.el7_3.x86_64
java-1.7.0-openjdk-1.7.0.141-2.6.10.1.el7_3.x86_64
java-1.7.0-openjdk-headless-1.7.0.141-2.6.10.1.el7_3.x86_64
java-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64

以root身份運行以下命令

[root@centos7-1 hadoop]# rpm -e --nodeps libvirt-java-devel-0.4.9-4.el7.noarch
[root@centos7-1 hadoop]# rpm -e --nodeps libvirt-java-0.4.9-4.el7.noarch
[root@centos7-1 hadoop]# rpm -e --nodeps tzdata-java-2017b-1.el7.noarch
[root@centos7-1 hadoop]# rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.141-2.6.10.1.el7_3.x86_64
[root@centos7-1 hadoop]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.141-2.6.10.1.el7_3.x86_64
[root@centos7-1 hadoop]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.131-3.b12.el7_3.x86_64
[root@centos7-1 hadoop]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64

4.安裝jdk

[root@centos7-1 local]# ll /usr/local/jdk-8u131-linux-x64.rpm 
 -rw-r--r--. 1 root root 169983496 6月 12 23:17 /usr/local/jdk-8u131-linux-x64.rpm
[root@centos7-1 local]# rpm -ivh jdk-8u131-linux-x64.rpm 
 Preparing...             ################################# [100%]
 Updating / installing...
  1:jdk1.8.0_131-2000:1.8.0_131-fcs ################################# [100%]
 Unpacking JAR files...
  tools.jar...
  plugin.jar...
  javaws.jar...
  deploy.jar...
  rt.jar...
  jsse.jar...
  charsets.jar...
  localedata.jar...
[root@centos7-1 local]# 

jdk默認安裝到了 /usr/java/ 下面

[root@centos7-1 local]# ll /usr/java/
total 0
lrwxrwxrwx. 1 root root 16 6月 12 23:18 default -> /usr/java/latest
drwxr-xr-x. 9 root root 268 6月 12 23:18 jdk1.8.0_131
lrwxrwxrwx. 1 root root 22 6月 12 23:18 latest -> /usr/java/jdk1.8.0_131
[root@centos7-1 local]# 

5.驗證安裝

[root@centos7-1 local]# ll /usr/bin/java
lrwxrwxrwx. 1 root root 22 6月 12 23:18 /usr/bin/java -> /etc/alternatives/java
[root@centos7-1 local]# ll /etc/alternatives/java
lrwxrwxrwx. 1 root root 35 6月 12 23:18 /etc/alternatives/java -> /usr/java/jdk1.8.0_131/jre/bin/java
[root@centos7-1 local]# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
[root@centos7-1 local]# 

6.配置環(huán)境變量

[hadoop@centos7-1 ~]$ whoami
hadoop
[hadoop@centos7-1 ~]$ vi ~/.bashrc

設(shè)置JAVA_HOME,并將它加到PATH中

JAVA_HOME=/usr/java/default
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME PATH

運行source命令,使修改生效。輸出JAVA_HOME, PATH確認修改是否生效。

[hadoop@centos7-1 ~]$ source ~/.bashrc
[hadoop@centos7-1 ~]$ echo $JAVA_HOME
/usr/java/default
[hadoop@centos7-1 ~]$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/hadoop/.local/bin:/home/hadoop/bin:/usr/java/default/bin

至此,CentOS 7上安裝JDK8順利完畢,更多關(guān)于linux下安裝JDK的文章請查看下面相關(guān)鏈接


本文名稱:CentOS7上以rpm方式安裝JDK8
當前網(wǎng)址:http://weahome.cn/article/pjggsc.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部