Redhat 7 yum源換成centos的YUM 源

來源:互聯網
上載者:User

標籤:min   鏡像   hat   avg   png   查看   images   lease   1.3   

背景:作者打算在Redhat 做kvm虛擬化的時候在安裝 virt-manager發現 提示要註冊紅帽的yum源,簡單說要錢唄。要錢那是不可能給你的,所以有以下有centos的yum源替換redhat7的yum源。

前景概括(步驟總結)

  1. 卸載原有的yum的rpm包
  2. 去阿里鏡像站下載centos必要的yum包
  3. rpm -ivh yum- 安裝相對應的rpm
  4. 去阿里鏡像站下載 centos-base.repo,並修改
  5. 清楚yum緩衝,再重建緩衝
  6. 測試 使用 yum -y install xxx

詳細步驟:
查看 原有的yum
[[email protected] yum.repos.d]# rpm -qa |grep yum
yum-3.4.3-158.el7.centos.noarch
yum-plugin-fastestmirror-1.1.31-45.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-utils-1.1.31-45.el7.noarch
yum-updateonboot-1.1.31-45.el7.noarch
[[email protected] yum.repos.d]#

卸載以上安裝包
rpm -qa | grep yum | xargs rpm -e --nodeps

再次查看是否刪除完成
[[email protected] yum.repos.d]# rpm -qa |grep yum

保證主機可以上網(為了去阿里鏡像站裡下載對應的rpm包:https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/)
[[email protected] yum.repos.d]# ping www.hao123.com
PING hao123.n.shifen.com (112.34.111.167) 56(84) bytes of data.
64 bytes from 112.34.111.167: icmp_seq=1 ttl=128 time=55.8 ms
64 bytes from 112.34.111.167: icmp_seq=2 ttl=128 time=54.2 ms
64 bytes from 112.34.111.167: icmp_seq=3 ttl=128 time=48.1 ms
^C
--- hao123.n.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 48.114/52.736/55.804/3.326 ms

下載在本地:如:

安裝下載的軟體包
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.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-3.4.3-158.el7.centos.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-45.el7.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
之後就是直接安裝 rpm -ivh yum-*

之後發現提示有問題

後來發現是python-urlgrabber和rpm版本過低;所以可以去下載的版本的,或者直接更新
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
然後更新
rpm -Uvh rpm-4.11.3-32.el7.x86_64.rpm --nodeps
rpm -Uvh python-urlgrabber-3.10-8.el7.noarch.rpm --nodeps

然後再次執行 yum -y install yum-*

查看是否安裝好以上rpm包

去阿里鏡像站下載centos-7.repo
CentOS 7

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

vim /etc/yum.repos.d/CentOS-Base.repo
把releasever替換成現有系統的版本號碼(7)
vim替換命令
:%s/$releasever/7/g

最後執行 yum clean all 清除緩衝
yum makecahe 再產生緩衝

Redhat 7 yum源換成centos的YUM 源

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.