Red Hat Enterprise Linux 7.3更换CentOS 7 yum源

85530494 2018-12-14

RedHat yum源是收费的,没有注册的Redhat机器是不能使用yum源的。

1、当前系统环境:

系统版本:Red Hat Enterprise Linux Server release 7.3 (Maipo)

软件环境:系统默认是自带了yum程序的,需要卸载,安装CentOS的

2、更换yum源:

1) 卸载本地yum:

# rpm -qa|grep yum      #查看本地yum

 Red Hat Enterprise Linux 7.3更换CentOS 7 yum源

# rpm -qa|grep yum|xargs rpm -e --nodeps       #卸载本地yum,不检查依赖性,卸载yum程序

# rpm -qa | grep Python-urlgrabber | xargs rpm -e --nodeps   

Red Hat Enterprise Linux 7.3更换CentOS 7 yum源

2) 下载CentOS yum程序

#  wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm     

#  wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm     

#  wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm     

使用wget命令下载,也可以用浏览器下载。rpm包下载地址http://mirrors.163.com/centos/7/os/x86_64/Packages/ ,包的版本会有更新,选择最新版本下载

安装CentOS yum程序

为避免他们之间互相依赖,三个程序一起安装

# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm   

 Red Hat Enterprise Linux 7.3更换CentOS 7 yum源

安装报错,依赖软件版本不兼容,

警告:yum-3.4.3-161.el7.centos.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY   
错误:依赖检测失败:                                                                                                                                   
python-urlgrabber >= 3.10-8 被 yum-3.4.3-161.el7.centos.noarch 需要                                                         
rpm >= 0:4.11.3-22 被 yum-3.4.3-161.el7.centos.noarch 需要                                                                       

重新下载新版本的依赖软件,安装更新

#  wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-35.el7.x86_64.rpm   

#  wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-libs-4.11.3-35.el7.x86_64.rpm   

#  wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-build-libs-4.11.3-35.el7.x86_64.rpm   

#  wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-python-4.11.3-35.el7.x86_64.rpm   

#  wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/python-chardet-2.2.1-1.el7_1.noarch.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-urlgrabber-3.10-9.el7.noarch.rpm   

#  wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm   

#  wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-35.el7.x86_64.rpm   

#  wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-sign-4.11.3-35.el7.x86_64.rpm     

#  wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-build-4.11.3-35.el7.x86_64.rpm     

更新依赖软件:

# rpm –ivh python-* 

# rpm -ivh libxml*   

# rpm –Uvh rpm*   

 Red Hat Enterprise Linux 7.3更换CentOS 7 yum源

再次安装yum程序

# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm     

安装报错:

 Red Hat Enterprise Linux 7.3更换CentOS 7 yum源

错误:依赖检测失败:                                                                                   
python-urlgrabber >= 3.10-8 被 yum-3.4.3-161.el7.centos.noarch 需要       

Python-urlgrabber版本不兼容,下载对应的版本。

#  wget  ftp://ftp.icm.edu.pl/vol/rzm3/linux-centos-altarch/7.5.1804/os/armhfp/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm     

安装:

# rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm   

 Red Hat Enterprise Linux 7.3更换CentOS 7 yum源

再次安装yum程序

# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm   

 Red Hat Enterprise Linux 7.3更换CentOS 7 yum源

安装成功。

3) repo 配置文件

下载配置文件

#  cd /etc/yum.repos.d/  #进入到yum配置文件目录

#  wget http://mirrors.163.com/.help/CentOS7-Base-163.repo    #下载配置文件

设置配置文件

# sed -i "s;\$releasever;7;g" CentOS7-Base-163.repo   

替换新的repo文件

# mv redhat.repo redhat.repo.bak   

配置文件内容如下:

[base]
name=CentOS-7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-7 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

更新yum缓存

# yum clean all  #清除yum缓存

 Red Hat Enterprise Linux 7.3更换CentOS 7 yum源

# yum makecache    #更新yum缓存

 Red Hat Enterprise Linux 7.3更换CentOS 7 yum源

执行yumrepolist查看,如果显示出repo仓库列表并显示软件包数量则OK。

#  yum  repolist   

 Red Hat Enterprise Linux 7.3更换CentOS 7 yum源

至此yum源更换完成。

相关推荐

DelphiTeacher / 0评论 2016-05-21