RHEl7的yum源i替换成CENTOS7的yum源
1.刚装的RHEL7使用命令yum update升级时会提示This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
2.删除自带的YUM包
1.rpm -qa | grep yum | xargs rpm -e --nodeps
2.rpm -qa | grep python-urlgrabber | xargs rpm -e --nodeps
3.进入以下网站,找到对应的安装包
阿里云网络源地址:https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
网易163网络源地址:http://mirrors.163.com/
CentOS网络源地址:http://centos.ustc.edu.cn/centos/
使用CTRL+F输入关键字查找对应的安装包即可。
yum,yum-plugin-fastestmirror,yum-metadata-parser,yum-utils,yum-updateonboot
4.找到安装包并下载下来
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-163.el7.centos.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-52.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-52.el7.noarch.rpm
5.安装
[root@localhost package]# rpm -ivh --force *
warning: yum-3.4.3-163.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: Failed dependencies:
python-urlgrabber >= 3.10-8 is needed by yum-3.4.3-163.el7.centos.noarch
rpm >= 0:4.11.3-22 is needed by yum-3.4.3-163.el7.centos.noarch
python-kitchen is needed by yum-utils-1.1.31-52.el7.noarch
# 有依赖问题,找到对应的依赖包下载并安装
wget https://mirrors.aliyun.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/rpm-4.11.3-40.el7.x86_64.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-chardet-2.2.1-3.el7.noarch.rpm
6.下载新的repo文件
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #wget工具自行下载安装,rpm -ivh wget.xxx.rpm
sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo #把环境变量变为7
yum clean all
yum list
7.验证是否成功
yum install -y tree
yum install -y vim
8.vim 查看一下/etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
2 #
3 # The mirror system uses the connecting IP address of the client and the
4 # update status of each mirror to pick mirrors that are updated to and
5 # geographically close to the client. You should use this for CentOS updates
6 # unless you are manually picking other mirrors.
7 #
8 # If the mirrorlist= does not work for you, as a fall back you can try the
9 # remarked out baseurl= line instead.
10 #
11 #
12
13 [base]
14 name=CentOS-7 - Base - mirrors.aliyun.com
15 failovermethod=priority
16 baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
17 http://mirrors.aliyuncs.com/centos/7/os/$basearch/
18 http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/
19 gpgcheck=1
20 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
21
22 #released updates
23 [updates]
24 name=CentOS-7 - Updates - mirrors.aliyun.com
25 failovermethod=priority
26 baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
27 http://mirrors.aliyuncs.com/centos/7/updates/$basearch/
28 http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/
29 gpgcheck=1
30 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
31
32 #additional packages that may be useful
33 [extras]
34 name=CentOS-7 - Extras - mirrors.aliyun.com
35 failovermethod=priority
36 baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
37 http://mirrors.aliyuncs.com/centos/7/extras/$basearch/
38 http://mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/
39 gpgcheck=1
40 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7