让 CentOS 使用 yum

孤者浪人 提交于 2019-12-03 06:46:56
  1. 下载安装 yum

Download CentOS6.3 yum i386: wget http://mirrors.163.com/centos/6.3/os/i386/Packages/yum-3.2.29-30.el6.centos.noarch.rpm wget http://mirrors.163.com/centos/6.3/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm wget http://mirrors.163.com/centos/6.3/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm wget http://mirrors.163.com/centos/6.3/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

x86_64: wget http://mirrors.163.com/centos/6.3/os/x86_64/Packages/yum-3.2.29-30.el6.centos.noarch.rpm wget http://mirrors.163.com/centos/6.3/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm wget http://mirrors.163.com/centos/6.3/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm wget http://mirrors.163.com/centos/6.3/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

Install CentOS6.3 yum i386: rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm rpm -ivh yum-metadata-parser-1.1.2-16.el6.i686.rpm rpm -ivh yum-3.2.29-30.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm (Must install both at the same time.)

x86_64: 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-30.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

  1. 配置 新建 /etc/yum.repos.d/CentOS5-Base.repo 一个文件,内容如下:
# 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.
#
#  file: /etc/yum.repos.d/CentOS5-Base.repo
#  yum clean all
#  yum makecache
#

[base]
name=CentOS-5.10 - Base
mirrorlist=http://mirrorlist.centos.org/?release=5.10&arch=x86_64&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#released updates 
[updates]
name=CentOS-5.10 - Updates
mirrorlist=http://mirrorlist.centos.org/?release=5.10&arch=x86_64&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-5.10 - Addons
mirrorlist=http://mirrorlist.centos.org/?release=5.10&arch=x86_64&repo=addons
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-5.10 - Extras
mirrorlist=http://mirrorlist.centos.org/?release=5.10&arch=x86_64&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5.10 - Plus
mirrorlist=http://mirrorlist.centos.org/?release=5.10&arch=x86_64&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-5.10 - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=5.10&arch=x86_64&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

其中 版本为 : 5.10, arch 为 x86_64, 请自己修改相应的版本号

我们看到,http://mirrorlist.centos.org/?release=5.10&arch=x86_64&repo=os 对应下面的mirror列表

  1. 然后运行下面的目录,更新 yum repo
# yum clean all
# yum make clean
  1. 然后就可以使用 yum 了
# yum search xxx
# yum install xxx
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!