红帽7.5更换yum源

红帽7.5更换yum源

Redhat 7自带的yum源需要付费注册才可以使用,未注册情况下会报如下错误
一般更换yum源都是网易、清华、阿里;也可以在这个网站上下载免费源http://vault.centos.org/

卸载原有的yum

#sudo rpm -qa|grep yum
    yum-utils-1.1.31-34.el7.noarch
    yum-3.4.3-132.el7.centos.0.1.noarch
    PackageKit-yum-1.0.7-5.el7.centos.x86_64
    yum-langpacks-0.4.2-4.el7.noarch
    yum-plugin-fastestmirror-1.1.31-34.el7.noarch
    yum-metadata-parser-1.1.4-10.el7.x86_64

#rpm -qa|grep yum|xargs rpm -e --nodeps

下载、安装yum依赖包

安装相应的yum的rpm安装包
http://vault.centos.org/7.5.1804/os/x86_64/Packages/
(1):#sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm

(2):#sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

(3):#sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm

(4):#sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm

(5):#sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm

下载完成后,进行安装

1.#sudo rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
Preparing… ################################# [100%]
package python-iniparse-0.4-9.el7.noarch is already installed

2.#sudo rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm
#安装时报错,提示系统上已经安装了一个版本,需要卸载之前的,如下报错
Preparing… ################################# [100%]
file /usr/lib/python2.7/site-packages/urlgrabber/grabber.py from install of python-urlgrabber- 3.10-8.el7.noarch conflicts with file from package python-urlgrabber-3.10-7.el7.noarch
file /usr/lib/python2.7/site-packages/urlgrabber/grabber.pyc from install of python-urlgrabber-3.10-8.el7.noarch conflicts with file from package python-urlgrabber-3.10-7.el7.noarch
file /usr/lib/python2.7/site-packages/urlgrabber/grabber.pyo from install of python-urlgrabber-3.10-8.el7.noarch conflicts with file from package python-urlgrabber-3.10-7.el7.noarch

2.1#rpm -qa python-urlgrabber python-urlgrabber-3.10-7.el7.noarch
查看已安装的包
2.2 #rpm -e python-urlgrabber --nodeps
卸载已安装的包

2.3#sudo rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm
#重新安装
Preparing… ################################# [100%]
Updating / installing…
1:python-urlgrabber-3.10-8.el7 ################################# [100%]

3.#sudo rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

剩下的这两个包需要一起安装

4.#sudo rpm -ivh yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm yum-3.4.3-158.el7.centos.noarch.rpm
#提示rpm版本太低,需要升级,大家可以一开始就下载
error: Failed dependencies:
rpm >= 0:4.11.3-22 is needed by yum-3.4.3-158.el7.centos.noarch

4.1#sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/rpm-4.11.3-32.el7.x86_64.rpm
下载安装包

4.2#rpm -Uvh rpm-4.11.3-32.el7.x86_64.rpm --nodeps
升级rpm安装包

4.3 #sudo rpm -ivh yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm yum-3.4.3-158.el7.centos.noarch.rpm
重新安装剩下的两个包
Preparing… ################################# [100%]
Updating / installing…
1:yum-3.4.3-158.el7.centos ################################# [ 50%]
2:yum-plugin-fastestmirror-1.1.31-4################################# [100%]

5.运行查看yum版本
#yum -v

下载yum源

6.下载Centos7 repo模板
#cd /etc/yum.repos.d/

6.1#mv * /tmp/ 先把原来的做备份

6.2#sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
下载repo文件,并进行修改

6.3#修改这个模板的内容 如下:
[base]
name=CentOS- r e l e a s e v e r − B a s e b a s e u r l = h t t p : / / v a u l t . c e n t o s . o r g / 7.5.1804 / o s / releasever - Base baseurl=http://vault.centos.org/7.5.1804/os/ releaseverBasebaseurl=http://vault.centos.org/7.5.1804/os/basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/7.5.1804/os/x86_64/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS- r e l e a s e v e r − U p d a t e s b a s e u r l = h t t p : / / v a u l t . c e n t o s . o r g / 7.5.1804 / u p d a t e s / releasever - Updates baseurl=http://vault.centos.org/7.5.1804/updates/ releaseverUpdatesbaseurl=http://vault.centos.org/7.5.1804/updates/basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/7.5.1804//os/x86_64/RPM-GPG-KEY-CentOS-7

[extras]
name=CentOS- r e l e a s e v e r − E x t r a s b a s e u r l = h t t p : / / v a u l t . c e n t o s . o r g / 7.5.1804 / / e x t r a s / / releasever - Extras baseurl=http://vault.centos.org/7.5.1804//extras// releaseverExtrasbaseurl=http://vault.centos.org/7.5.1804//extras//basearch/
gpgcheck=1
gpgkey=http://vault.centos.org/7.5.1804/os/x86_64/RPM-GPG-KEY-CentOS-7

[centosplus]
name=CentOS- r e l e a s e v e r − P l u s b a s e u r l = h t t p : / / v a u l t . c e n t o s . o r g / 7.5.1804 / c e n t o s p l u s / / releasever - Plus baseurl=http://vault.centos.org/7.5.1804/centosplus// releaseverPlusbaseurl=http://vault.centos.org/7.5.1804/centosplus//basearch/
gpgcheck=1
enabled=0

6.4#sudo yum clean all && yum makecache
释放yum的缓存

6.5#yum -y install lrzsz yum就可以使用了

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 技术工厂 设计师:CSDN官方博客 返回首页