RHEl7的yum源i替換成CENTOS7的yum源


RHEl7的yum源i替換成CENTOS7的yum源

1.剛裝的RHEL7使用命令yum update升級時會提示This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

2.刪除自帶的YUM包

1.rpm -qa | grep yum | xargs rpm -e --nodeps
2.rpm -qa | grep python-urlgrabber | xargs rpm -e --nodeps

3.進入以下網站,找到對應的安裝包

​ 阿里雲網絡源地址:https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
​ 網易163網絡源地址:http://mirrors.163.com/
​ CentOS網絡源地址:http://centos.ustc.edu.cn/centos/
使用CTRL+F輸入關鍵字查找對應的安裝包即可。

yum,yum-plugin-fastestmirror,yum-metadata-parser,yum-utils,yum-updateonboot

4.找到安裝包並下載下來

wget  https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-163.el7.centos.noarch.rpm 
wget  https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm 
wget  https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget  https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-52.el7.noarch.rpm 
wget  https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-52.el7.noarch.rpm 

5.安裝

[root@localhost package]# rpm -ivh --force *
warning: yum-3.4.3-163.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: Failed dependencies:
        python-urlgrabber >= 3.10-8 is needed by yum-3.4.3-163.el7.centos.noarch
        rpm >= 0:4.11.3-22 is needed by yum-3.4.3-163.el7.centos.noarch
        python-kitchen is needed by yum-utils-1.1.31-52.el7.noarch
# 有依賴問題,找到對應的依賴包下載並安裝
wget  https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-40.el7.x86_64.rpm 
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm
 wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-chardet-2.2.1-3.el7.noarch.rpm 

6.下載新的repo文件

 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo    #wget工具自行下載安裝,rpm -ivh  wget.xxx.rpm
 sed -i  's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo   #把環境變量變為7
 yum clean all
 yum list

7.驗證是否成功

yum install -y tree
yum install -y vim

8.vim 查看一下/etc/yum.repos.d/CentOS-Base.repo

# CentOS-Base.repo
      2 #
      3 # The mirror system uses the connecting IP address of the client and the
      4 # update status of each mirror to pick mirrors that are updated to and
      5 # geographically close to the client.  You should use this for CentOS updates
      6 # unless you are manually picking other mirrors.
      7 #
      8 # If the mirrorlist= does not work for you, as a fall back you can try the
      9 # remarked out baseurl= line instead.
     10 #
     11 #
     12 
     13 [base]
     14 name=CentOS-7 - Base - mirrors.aliyun.com
     15 failovermethod=priority
     16 baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
     17         http://mirrors.aliyuncs.com/centos/7/os/$basearch/
     18         http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/
     19 gpgcheck=1
     20 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
     21 
     22 #released updates
     23 [updates]
     24 name=CentOS-7 - Updates - mirrors.aliyun.com
     25 failovermethod=priority
     26 baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
     27         http://mirrors.aliyuncs.com/centos/7/updates/$basearch/
     28         http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/
     29 gpgcheck=1
     30 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
     31 
     32 #additional packages that may be useful
     33 [extras]
     34 name=CentOS-7 - Extras - mirrors.aliyun.com
     35 failovermethod=priority
     36 baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
     37         http://mirrors.aliyuncs.com/centos/7/extras/$basearch/
     38         http://mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/
     39 gpgcheck=1
     40 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM