Too young, too simple. Sometimes, naive & stupid

RHEL使用Centos的yum源

查看系统自带的yum组件

1
2
3
4
5
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组件

1
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其他版本对应修改操作系统的大版本号

修改后

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[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目录下,
测试

1
2
yum clean all
yum update

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