Redhat7.2换Centos7的yum源
Redhat7.2(未注册用户)换Centos7的yum源
1、查看redhat7.2中yum的包版本
[root@localhost jiayimeng]# rpm -qa | grep yum
yum-rhn-plugin-2.0.1-5.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-langpacks-0.4.2-4.el7.noarch
yum-utils-1.1.31-34.el7.noarch
yum-3.4.3-132.el7.noarch
2、删除原有的yum包
[root@localhost jiayimeng]# rpm -e yum-rhn-plugin-2.0.1-5.el7.noarch yum-metadata-parser-1.1.4-10.el7.x86_64 yum-langpacks-0.4.2-4.el7.noarch yum-utils-1.1.31-34.el7.noarch yum-3.4.3-132.el7.noarch --nodeps
警告:/etc/yum/pluginconf.d/langpacks.conf 已另存为 /etc/yum/pluginconf.d/langpacks.conf.rpmsave
3、下载依赖包
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.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/rpm-4.11.3-40.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-163.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-163.el7.centos.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 http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
4、安装依赖包
rpm -Uvh *.rpm --nodeps
5、删除原redhat在yum源
rm /etc/yum.repos.d/redhat.repo
6、生成centos的yum源
vim /etc/yum.repos.d/CentOS-Base.repo
#++++++++++++++++++++++++ CentOS-Base.repo start ++++++++++++++++++++++# # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # [base] name=CentOS-$7 - Base - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&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=$7&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=$7&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 #++++++++++++++++++++++++ CentOS-Base.repo end ++++++++++++++++++++++#
7、清除yum缓存
yum clean
8、生成缓存
yum makecache
9、更新yum
yum update