当前位置: 移动技术网 > 科技>操作系统>Linux > Redhat7.3更换CentOS7 yum源

Redhat7.3更换CentOS7 yum源

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

 

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

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

2) 下载centos yum程序

#  wget       

#  wget       

#  wget       

使用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   

 

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

警告: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     

#  wget     

#  wget     

#  wget     

#  wget     

#  wget     

#  wget     

#  wget     

#  wget     

#  wget       

#  wget       

更新依赖软件:

# rpm –ivh python-*  

# rpm -ivh libxml*   

# rpm –uvh rpm*   

 

再次安装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     

安装报错:

 

错误:依赖检测失败:                                                                                   
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    

 

再次安装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   

 

安装成功。

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    

 

配置文件内容如下:

 1 [base]
 2 name=centos-7 - base - 163.com
 3 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
 4 baseurl=http://mirrors.163.com/centos/7/os/$basearch/
 5 gpgcheck=1
 6 gpgkey=http://mirrors.163.com/centos/rpm-gpg-key-centos-7
 7 
 8 #released updates
 9 [updates]
10 name=centos-7 - updates - 163.com
11 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
12 baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
13 gpgcheck=1
14 gpgkey=http://mirrors.163.com/centos/rpm-gpg-key-centos-7
15 
16 #additional packages that may be useful
17 [extras]
18 name=centos-7 - extras - 163.com
19 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
20 baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
21 gpgcheck=1
22 gpgkey=http://mirrors.163.com/centos/rpm-gpg-key-centos-7
23 
24 #additional packages that extend functionality of existing packages
25 [centosplus]
26 name=centos-7 - plus - 163.com
27 baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
28 gpgcheck=1
29 enabled=0
30 gpgkey=http://mirrors.163.com/centos/rpm-gpg-key-centos-7

更新yum缓存

# yum clean all  #清除yum缓存

 

# yum makecache    #更新yum缓存

 

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

#  yum  repolist   

 

至此yum源更换完成。

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网