RHEL7 yum源配置
This system is not registered with an entitlement server. You can use subscription-manager to register.
由于redhat?的更新包只對注冊的用戶生效,所以需要自己手動更改成CentOS?的更新包,CentOS幾乎和redhat是一樣的,所以無需擔(dān)心軟件包是否可安裝,安裝之后是否有問題。
| 操作系統(tǒng):Red Hat Enterprise Linux Server release 7.9 (Maipo) |
1.?????首先查看redhat 7.9系統(tǒng)本身所安裝的那些yum?軟件包
| [root@rhel7 ~]#??rpm -qa | grep yum yum-rhn-plugin-2.0.1-10.el7.noarch yum-3.4.3-168.el7.noarch PackageKit-yum-1.1.10-2.el7.x86_64 yum-langpacks-0.4.2-7.el7.noarch yum-utils-1.1.31-54.el7_8.noarch yum-metadata-parser-1.1.4-10.el7.x86_64 |
2.?????卸載這些軟件包
| [root@rhel7 ~]#??rpm -e yum-rhn-plugin-2.0.1-10.el7.noarch --nodeps [root@rhel7 ~]#??rpm -e yum-3.4.3-168.el7.noarch --nodeps [root@rhel7 ~]#??rpm -e PackageKit-yum-1.1.10-2.el7.x86_64 --nodeps [root@rhel7 ~]#??rpm -e yum-langpacks-0.4.2-7.el7.noarch --nodeps 警告:/etc/yum/pluginconf.d/langpacks.conf?已另存為?/etc/yum/pluginconf.d/langpacks.conf.rpmsave [root@rhel7 ~]#??rpm -e yum-utils-1.1.31-54.el7_8.noarch --nodeps [root@rhel7 ~]#??rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps |
3.?????保證本機電腦能上網(wǎng)
| [root@rhel7 ~]#??ping mirrors.163.com PING mirrors.163.com (106.225.229.135) 56(84) bytes of data. 64 bytes from mirrors.163.com (106.225.229.135): icmp_seq=1 ttl=128 time=4.64 ms 64 bytes from mirrors.163.com (106.225.229.135): icmp_seq=2 ttl=128 time=5.34 ms 64 bytes from mirrors.163.com (106.225.229.135): icmp_seq=3 ttl=128 time=4.72 ms |
4.?????進入以下網(wǎng)站上面查看軟件包的版本是否升級或者找到自己系統(tǒng)所對應(yīng)的文件包版本更新
| 網(wǎng)易開源鏡像站: 清華大學(xué)開源軟件鏡像站: |
5.?????找到自己所需要的版本下載
| [root@rhel7 ~]#??wget 7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm [root@rhel7 ~]#??wget 7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm [root@rhel7 ~]#??wget 7/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm [root@rhel7 ~]#??wget 7/os/x86_64/Packages/yum-updateonboot-1.1.31-54.el7_8.noarch.rpm [root@rhel7 ~]#??wget 7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm |
6.?????查看下載完成結(jié)果
| [root@rhel7 ~]#??ll *rpm -rw-r--r-- 1 root root 1298856 10?月?15 2020 yum-3.4.3-168.el7.centos.noarch.rpm -rw-r--r-- 1 root root???28348 7?月???4 2014 yum-metadata-parser-1.1.4-10.el7.x86_64.rpm -rw-r--r-- 1 root root???35216 5?月??14 2020 yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm -rw-r--r-- 1 root root???28024 5?月??14 2020 yum-updateonboot-1.1.31-54.el7_8.noarch.rpm -rw-r--r-- 1 root root??124852 5?月??14 2020 yum-utils-1.1.31-54.el7_8.noarch.rpm |
7.?????安裝軟件包
| [root@rhel7 ~]#??rpm -ivh yum-* 警告:yum-3.4.3-168.el7.centos.noarch.rpm:?頭V3 RSA/SHA256 Signature,?密鑰?ID f4a80eb5: NOKEY 準(zhǔn)備中...??????????????????????????################################# [100%] 正在升級/安裝... ???1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 20%] ???2:yum-plugin-fastestmirror-1.1.31-5################################# [ 40%] ???3:yum-3.4.3-168.el7.centos?????????################################# [ 60%] ???4:yum-updateonboot-1.1.31-54.el7_8 ################################# [ 80%] ???5:yum-utils-1.1.31-54.el7_8????????################################# [100%] |
8.?????新建repo?配置文件
| [root@rhel7 ~]# vim /etc/yum.repos.d/CentOS7-Base-163.repo # CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client.??You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-7.9.2009 - Base - 163.com #mirrorlist= baseurl=7.9.2009/os/$basearch/ gpgcheck=1 gpgkey=RPM-GPG-KEY-CentOS-7 ? #released updates [updates] name=CentOS-7.9.2009 - Updates - 163.com #mirrorlist= baseurl=7.9.2009/updates/$basearch/ gpgcheck=1 gpgkey=RPM-GPG-KEY-CentOS-7 ? #additional packages that may be useful [extras] name=CentOS-7.9.2009 - Extras - 163.com #mirrorlist= baseurl=7.9.2009/extras/$basearch/ gpgcheck=1 gpgkey=RPM-GPG-KEY-CentOS-7 ? #additional packages that extend functionality of existing packages [centosplus] name=CentOS-7.9.2009 - Plus - 163.com baseurl=7.9.2009/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=RPM-GPG-KEY-CentOS-7 |
9.?????至此YUM?網(wǎng)絡(luò)源已經(jīng)安裝完成,運行以下命令生成緩存
| [root@rhel7 ~]#??yum clean all 已加載插件:fastestmirror, product-id, search-disabled-repos, subscription-manager ? This system is not registered with an entitlement server. You can use subscription-manager to register. ? 正在清理軟件源:?base extras updates [root@rhel7 ~]#??yum makecache 已加載插件:fastestmirror, product-id, search-disabled-repos, subscription-manager ? This system is not registered with an entitlement server. You can use subscription-manager to register. ? Determining fastest mirrors base?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????| 3.6 kB??00:00:00???? extras???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????| 2.9 kB??00:00:00???? updates??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????| 2.9 kB??00:00:00???? (1/10): base/x86_64/group_gz?????????????????????????????????????????????????????????????????????????????????????????????????????????????????| 153 kB??00:00:00???? (2/10): base/x86_64/filelists_db?????????????????????????????????????????????????????????????????????????????????????????????????????????????| 7.2 MB??00:00:02???? (3/10): base/x86_64/primary_db???????????????????????????????????????????????????????????????????????????????????????????????????????????????| 6.1 MB??00:00:01???? (4/10): extras/x86_64/primary_db?????????????????????????????????????????????????????????????????????????????????????????????????????????????| 242 kB??00:00:00???? (5/10): extras/x86_64/filelists_db???????????????????????????????????????????????????????????????????????????????????????????????????????????| 235 kB??00:00:00???? (6/10): base/x86_64/other_db?????????????????????????????????????????????????????????????????????????????????????????????????????????????????| 2.6 MB??00:00:01???? (7/10): extras/x86_64/other_db???????????????????????????????????????????????????????????????????????????????????????????????????????????????| 143 kB??00:00:00???? (8/10): updates/x86_64/primary_db????????????????????????????????????????????????????????????????????????????????????????????????????????????| 9.6 MB??00:00:02???? (9/10): updates/x86_64/filelists_db??????????????????????????????????????????????????????????????????????????????????????????????????????????| 5.5 MB??00:00:02???? (10/10): updates/x86_64/other_db?????????????????????????????????????????????????????????????????????????????????????????????????????????????| 706 kB??00:00:00???? 元數(shù)據(jù)緩存已建立 |
10.????測試安裝是否正常
| [root@rhel7 ~]#??yum -y install gcc 已加載插件:fastestmirror, product-id, search-disabled-repos, subscription-manager ? This system is not registered with an entitlement server. You can use subscription-manager to register. ? Loading mirror speeds from cached hostfile 正在解決依賴關(guān)系 -->??正在檢查事務(wù) --->??軟件包?gcc.x86_64.0.4.8.5-44.el7?將被 安裝 -->??正在處理依賴關(guān)系?cpp = 4.8.5-44.el7,它被軟件包?gcc-4.8.5-44.el7.x86_64?需要 -->??正在處理依賴關(guān)系?glibc-devel >= 2.2.90-12,它被軟件包?gcc-4.8.5-44.el7.x86_64?需要 -->??正在檢查事務(wù) --->??軟件包?cpp.x86_64.0.4.8.5-44.el7?將被 安裝 --->??軟件包?glibc-devel.x86_64.0.2.17-324.el7_9?將被 安裝 -->??正在處理依賴關(guān)系?glibc-headers = 2.17-324.el7_9,它被軟件包?glibc-devel-2.17-324.el7_9.x86_64?需要 -->??正在處理依賴關(guān)系?glibc = 2.17-324.el7_9,它被軟件包?glibc-devel-2.17-324.el7_9.x86_64?需要 -->??正在處理依賴關(guān)系?glibc-headers,它被軟件包?glibc-devel-2.17-324.el7_9.x86_64?需要 -->??正在檢查事務(wù) --->??軟件包?glibc.x86_64.0.2.17-317.el7?將被 升級 -->??正在處理依賴關(guān)系?glibc = 2.17-317.el7,它被軟件包?glibc-common-2.17-317.el7.x86_64?需要 --->??軟件包?glibc.x86_64.0.2.17-324.el7_9?將被 更新 --->??軟件包?glibc-headers.x86_64.0.2.17-324.el7_9?將被 安裝 -->??正在處理依賴關(guān)系?kernel-headers >= 2.2.1,它被軟件包?glibc-headers-2.17-324.el7_9.x86_64?需要 -->??正在處理依賴關(guān)系?kernel-headers,它被軟件包?glibc-headers-2.17-324.el7_9.x86_64?需要 -->??正在檢查事務(wù) --->??軟件包?glibc-common.x86_64.0.2.17-317.el7?將被 升級 --->??軟件包?glibc-common.x86_64.0.2.17-324.el7_9?將被 更新 --->??軟件包?kernel-headers.x86_64.0.3.10.0-1160.36.2.el7?將被 安裝 -->??解決依賴關(guān)系完成 ? 依賴關(guān)系解決 ? ==================================================================================================================================================================== ?Package???????????????????????????????????架構(gòu)?????????????????????????????版本?????????????????????????????????????????????源?????????????????????????????????大小 ==================================================================================================================================================================== 正在安裝: ?gcc??????????????????????????????????????x86_64???????????????????????????4.8.5-44.el7?????????????????????????????????????base???????????????????????????????16 M 為依賴而安裝: ?cpp??????????????????????????????????????x86_64???????????????????????????4.8.5-44.el7?????????????????????????????????????base??????????????????????????????5.9 M ?glibc-devel??????????????????????????????x86_64???????????????????????????2.17-324.el7_9???????????????????????????????????updates???????????????????????????1.1 M ?glibc-headers????????????????????????????x86_64???????????????????????????2.17-324.el7_9???????????????????????????????????updates???????????????????????????691 k ?kernel-headers???????????????????????????x86_64???????????????????????????3.10.0-1160.36.2.el7?????????????????????????????updates???????????????????????????9.0 M 為依賴而更新: ?glibc????????????????????????????????????x86_64???????????????????????????2.17-324.el7_9???????????????????????????????????updates???????????????????????????3.6 M ?glibc-common?????????????????????????????x86_64???????????????????????????2.17-324.el7_9???????????????????????????????????updates????????????????????????????12 M ? 事務(wù)概要 ==================================================================================================================================================================== 安裝??1?軟件包?(+4?依賴軟件包) 升級???????????( 2?依賴軟件包) ? 總下載量:48 M Downloading packages: No Presto metadata available for updates 警告:/var/cache/yum/x86_64/$releasever/updates/packages/glibc-2.17-324.el7_9.x86_64.rpm:?頭V3 RSA/SHA256 Signature,?密鑰?ID f4a80eb5: NOKEY |??18 MB??00:00:05 ETA glibc-2.17-324.el7_9.x86_64.rpm??的公鑰尚未安裝 (1/7): glibc-2.17-324.el7_9.x86_64.rpm???????????????????????????????????????????????????????????????????????????????????????????????????????| 3.6 MB??00:00:02???? cpp-4.8.5-44.el7.x86_64.rpm??的公鑰尚未安裝rpm???????????????????????42% [========================?????????????????????????????????] 5.5 MB/s |??20 MB??00:00:04 ETA (2/7): cpp-4.8.5-44.el7.x86_64.rpm???????????????????????????????????????????????????????????????????????????????????????????????????????????| 5.9 MB??00:00:02???? (3/7): glibc-common-2.17-324.el7_9.x86_64.rpm????????????????????????????????????????????????????????????????????????????????????????????????|??12 MB??00:00:04???? (4/7): glibc-devel-2.17-324.el7_9.x86_64.rpm?????????????????????????????????????????????????????????????????????????????????????????????????| 1.1 MB??00:00:02???? (5/7): gcc-4.8.5-44.el7.x86_64.rpm???????????????????????????????????????????????????????????????????????????????????????????????????????????|??16 MB??00:00:04???? (6/7): glibc-headers-2.17-324.el7_9.x86_64.rpm???????????????????????????????????????????????????????????????????????????????????????????????| 691 kB??00:00:00???? (7/7): kernel-headers-3.10.0-1160.36.2.el7.x86_64.rpm????????????????????????????????????????????????????????????????????????????????????????| 9.0 MB??00:00:05???? -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 總計????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????4.8 MB/s |??48 MB??00:00:10???? 從?RPM-GPG-KEY-CentOS-7?檢索密鑰 導(dǎo)入?GPG key 0xF4A80EB5: ??用戶ID?????: "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>" ??指紋???????: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5 ??來自???????: RPM-GPG-KEY-CentOS-7 Running transaction check Running transaction test Transaction test succeeded Running transaction 警告:RPM?數(shù)據(jù)庫已被非?yum?程序修改。 **??發(fā)現(xiàn)?2?個已存在的?RPM?數(shù)據(jù)庫問題,?'yum check'?輸出如下: PackageKit-1.1.10-2.el7.x86_64??有缺少的需求?PackageKit-backend rhn-check-2.0.2-24.el7.x86_64??有缺少的需求?yum-rhn-plugin >= ('0', '1.6.4', '1') ???正在更新????: glibc-common-2.17-324.el7_9.x86_64??????????????????????????????????????????????????????????????????????????????????????????????????????????????1/9 ???正在更新????: glibc-2.17-324.el7_9.x86_64?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????2/9 ???正在安裝????: cpp-4.8.5-44.el7.x86_64?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????3/9 ???正在安裝????: kernel-headers-3.10.0-1160.36.2.el7.x86_64??????????????????????????????????????????????????????????????????????????????????????????????????????4/9 ???正在安裝????: glibc-headers-2.17-324.el7_9.x86_64?????????????????????????????????????????????????????????????????????????????????????????????????????????????5/9 ???正在安裝????: glibc-devel-2.17-324.el7_9.x86_64???????????????????????????????????????????????????????????????????????????????????????????????????????????????6/9 ???正在安裝????: gcc-4.8.5-44.el7.x86_64?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????7/9 ???清理????????: glibc-common-2.17-317.el7.x86_64????????????????????????????????????????????????????????????????????????????????????????????????????????????????8/9 ???清理????????: glibc-2.17-317.el7.x86_64???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????9/9 ???驗證中??????: glibc-2.17-324.el7_9.x86_64?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????1/9 ???驗證中??????: glibc-headers-2.17-324.el7_9.x86_64?????????????????????????????????????????????????????????????????????????????????????????????????????????????2/9 ???驗證中??????: cpp-4.8.5-44.el7.x86_64?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????3/9 ???驗證中??????: glibc-devel-2.17-324.el7_9.x86_64???????????????????????????????????????????????????????????????????????????????????????????????????????????????4/9 ???驗證中??????: gcc-4.8.5-44.el7.x86_64?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????5/9 ???驗證中??????: kernel-headers-3.10.0-1160.36.2.el7.x86_64??????????????????????????????????????????????????????????????????????????????????????????????????????6/9 ???驗證中??????: glibc-common-2.17-324.el7_9.x86_64??????????????????????????????????????????????????????????????????????????????????????????????????????????????7/9 ???驗證中??????: glibc-2.17-317.el7.x86_64???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????8/9 ???驗證中??????: glibc-common-2.17-317.el7.x86_64????????????????????????????????????????????????????????????????????????????????????????????????????????????????9/9 ? 已安裝: ??gcc.x86_64 0:4.8.5-44.el7????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ? 作為依賴被安裝: ??cpp.x86_64 0:4.8.5-44.el7?????glibc-devel.x86_64 0:2.17-324.el7_9?????glibc-headers.x86_64 0:2.17-324.el7_9?????kernel-headers.x86_64 0:3.10.0-1160.36.2.el7??? ? 作為依賴被升級: ??glibc.x86_64 0:2.17-324.el7_9?????????????????????????????????????????????????glibc-common.x86_64 0:2.17-324.el7_9??????????????????????????????????????????????? ? 完畢! |
到這里安裝完成,以后安裝所需包,可以不用本地yum源了,直接使用網(wǎng)絡(luò)yum源。
總結(jié)
以上是生活随笔為你收集整理的RHEL7 yum源配置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何更改 Mac 上的光标颜色
- 下一篇: Linux磁盘分区了解多少?Linux入