替換Centos7源安裝OracleJDK__Oracle

來源:互聯網
上載者:User
安裝Centos7 64位作業系統(略)

注意:我本人安裝時選擇的時帶GUI的伺服器,並且勾選了開發工具選項 替換Centos7 原有源為阿里源 首先備份
cd /etc/yum.repos.d/
mv CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 下載阿里源repo檔案
wget http://mirrors.aliyun.com/repo/Centos-7.repo 插入代碼
mv Centos-7.repo CentOS-Base.repo 更新系統
yum clean all
yum makecache
yum update 重啟系統
init 6 卸載openjdk,安裝Oracle的jdk

1.下載jdk-8u161-linux-x64.tar.gz(oracle官網下載)
2.使用xshell上傳jdk至Centos7中的 /usr/local/java

    cd /usr/local/    mkdir java    上傳jdk-8u161-linux-x64.tar.gz

3.卸載openjdk

    [1]使用rpm -qa | grep java 查詢系統內建jdk    [2]卸載非noarch檔案        1)、rpm -e --nodeps java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64        2)、rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.131-11.b12.el7.x86_64    [3]rpm -qa | grep java 命令來查詢出是否刪除掉

4.安裝sun的jdk

    [1]cd /usr/local/java/    [2]tar xvf jdk-8u161-linux-x64.tar.gz    [3]rm -f jdk-8u161-linux-x64.tar.gz    [4]編輯/etc/profile 中的內容        1)、vim /etc/profile 按i之後進入insert模式,在檔案末尾添加環境變數            export JAVA_HOME=/usr/local/java/jdk1.8.0_161            export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar            export PATH=$PATH:$JAVA_HOME/bin        2)、儲存並退出             方式一:按ESC鍵後輸入 :wq            方式二:按住shift 鍵然後連按兩次Z    [5]重啟profile檔案        source /etc/profile    [6]測試jdk        1)、javac        2)、java -version

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.