RHEL使用Centos的yum源

一、查看系统自带的yum组件

rpm -qa | grep yum

yum-rhn-plugin-2.0.1-5.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-125.el7.noarch

二、卸载自带yum组件

rpm -aq|grep yum|xargs rpm -e --nodeps

三、下载rpm包

yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-150.el7.centos.noarch
yum-plugin-fastestmirror-1.1.31-40.el7.noarch
如果最小化安装可能需要安装依赖
Python-urlgrabber-3.10-8.el7.noarch.rpm
python-kitchen-1.1.1-5.el7.noarch.rpm
python-iniparse-0.4-9.el7.noarch.rpm

少哪些依赖包会有显示, 直接到镜像站下载包即可,最方便的办法就是提示缺哪个依赖,去镜像站复制rpm包链接 直接在rpm -ivh命令后面加包的链接,(加到不提示依赖为之)

四、修改yum.repo文件

安装完yum组件之后
下载一份镜像站的repo文件,
这里需要修改一个地方
将$releasever 修改为 7
rhel其他版本对应修改操作系统的大版本号

*修改后 *

[base]
name=CentOS-$releasever - 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-$releasever - 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-$releasever - 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-$releasever - 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

将修改后的文件放在/etc/yum.repos目录下,
测试

yum clean all
yum update

镜像站地址
yum.repo文件下载地址

posted @ 2018-09-16 11:16  __Porter  阅读(355)  评论(0编辑  收藏  举报