思路:解除安裝redhat自帶yum,然後下載下傳centos的yum,安裝後修改配置檔案
必要下載下傳的軟體包有(以64位系統為例):
a python-iniparse-0.3.1-2.1.el6.noarch.rpm
b yum-3.2.29-40.el6.centos.noarch.rpm
c yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
d yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
下載下傳指令:
[注] :版本不一定要最新的
2、解除安裝RedHat自帶的yum
rpm -qa | grep yum | xargs rpm -e --nodeps
注:
b、--nodeps 強制解除安裝,不管依賴性
3、安裝下載下傳的centos的yum包:
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
[注] :最後2個需要一起安裝,否則會出現依賴性錯誤
5、編輯CentOS7-Base-163.repo檔案,
将其中的$releasever更改為centos的版本号,這裡修改為7
# CentOS-Base.repo
#
# 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
gpgcheck=1
#released updates
[updates]
name=CentOS-7 - Updates - 163.com
#additional packages that may be useful
[extras]
name=CentOS-7 - Extras - 163.com
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus - 163.com
enabled=0
#contrib - packages by Centos Users
[contrib]
name=CentOS-7 - Contrib - 163.com
6、yum clean all 清除原有緩存
7、yum makecache 擷取yum清單
出現下面提示,表示yum更改完成:
Metadata Cache Created
本文轉自 yuanzhitang 51CTO部落格,原文連結:http://blog.51cto.com/yuanzhitang/1846849,如需轉載請自行聯系原作者