1、mkdir /rhe17.3/ 創建一個文件夾充當掛載點

2、mount
/iso/rhel-server-7.3-x86_64-dvd.iso /rhe17.3/ 將/iso目錄下的鏡像掛載到/rhe17.3/文件上

3、cd /etc/yum.repos.d/ 進入到這個文件

4、rm -fr * 刪除目錄下所有文件

5、vim yum.repo 編輯文件內容,后綴不能改變【沒有這個文件會自動創建】

6、將以下內容寫入文件保存退出

[rhe17.3] 說明
name=rhe17.3 名稱
baseurl=file:///rhe17.3 位置
gpgcheck=0 跳過來源檢查
7、yum clean all 清除記錄

8、yum search jdk 搜索有關jdk的文件

9、yum install JAVA-1.6.0-openjdk.x86_64 安裝這個軟件

此時輸入y確認安裝,d為下載,N為取消安裝

10、yum install -y java-1.6.0-openjdk.x86_64 跳過詢問直接安裝

11、yum remove java-1.6.0-openjdk.x86_64

刪除這個軟件

如果報錯
已加載插件:product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
設置安裝進程
file:///mnt/RHEL6.8/repodata/repomd.xml: [Errno 14] Could not open/read file:///mnt/RHEL6.8/repodata/repomd.xml
嘗試其他鏡像。
錯誤:Cannot retrieve repository metadata (repomd.xml) for repository: redhat6.8. Please verify its path and try again
執行:mount /dev/cdrom /mnt