redhat 的更新包只對(duì)注冊(cè)的用戶生效,所以我們自己手動(dòng)更改成CentOS 的更新包,CentOS幾乎和redhat是一樣的,所以無需擔(dān)心軟件包是否可安裝,安裝之后是否有問題。
1、首先刪除redhat原有的yum ,因?yàn)閞edhat 原本的yum 沒有注冊(cè)為redhat用戶是用不了的。
rpm -aq|grep yum|xargs rpm -e --nodeps
rpm -aq|grep python-iniparse|xargs rpm -e --nodeps
2、下載163的yum 安裝包
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-150.el7.centos.noarch.rpm
# 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/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
# wget http://mirrors.163.com/centos/7/os/x86_64/yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
3、安裝下載的rpm包
rpm -ivh *.rpm
4、創(chuàng)建文件/etc/yum.repos.d/rhel-debuginfo.repo并寫入,若沒有vim時(shí)使用下面方法創(chuàng)建rhel-debuginfo.repo文件
echo '[base]' >rhel-debuginfo.repo
echo 'name=CentOS-$releasever - Base' >>rhel-debuginfo.repo
echo 'baseurl=http://mirrors.163.com/centos/7/os/$basearch/' >>rhel-debuginfo.repo
echo 'gpgcheck=1' >>rhel-debuginfo.repo
echo 'gpgkey=/tupian/20230522/RPM-GPG-KEY-CentOS-7' >>rhel-debuginfo.repo
echo '#released updates' >>rhel-debuginfo.repo
echo '[updates]' >>rhel-debuginfo.repo
echo 'name=CentOS-$releasever - Updates' >>rhel-debuginfo.repo
echo 'baseurl=http://mirrors.163.com/centos/7/updates/$basearch/' >>rhel-debuginfo.repo
echo 'gpgcheck=1' >>rhel-debuginfo.repo
echo 'gpgkey=/tupian/20230522/RPM-GPG-KEY-CentOS-7' >>rhel-debuginfo.repo
echo '[extras]' >>rhel-debuginfo.repo
echo 'name=CentOS-$releasever - Extras' >>rhel-debuginfo.repo
echo 'baseurl=http://mirrors.163.com/centos/7/extras//$basearch/' >>rhel-debuginfo.repo
echo 'gpgcheck=1' >>rhel-debuginfo.repo
echo 'gpgkey=/tupian/20230522/RPM-GPG-KEY-CentOS-7' >>rhel-debuginfo.repo
echo '[centosplus]' >>rhel-debuginfo.repo
echo 'name=CentOS-$releasever - Plus' >>rhel-debuginfo.repo
echo 'baseurl=http://mirrors.163.com/centos/7/centosplus//$basearch/' >>rhel-debuginfo.repo
echo 'gpgcheck=1' >>rhel-debuginfo.repo
echo 'enabled=0' >>rhel-debuginfo.repo
6、 yum clean all
7、 yum update 測(cè)試。
8、 安裝 epel 源
# yum install epel-release