uf123 发表于 2018-5-10 08:03:25

RedHat 6.3配置使用Centos的yum源

  1、检查是否安装了yum包 # rpm -qa |grep yum
  2、卸载RedHat自带的yum# rpm -qa | grep yum | xargs rpm -e --nodeps
  注:a) xargs是一条Unix和类Unix操作系统的常用命令。它的作用是将参数列表转换成小块分段传递给 其他命令,以避免参数列表过长的问题
  b) --nodeps强制卸载,不管依赖性
  3、到http://mirrors.163.com/centos中使用命令下载软件包
  wgethttp://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
  wgethttp://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
  wgethttp://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
  wgethttp://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
[注]:本文示例为linux 6.4 x86_64位版本,若是32位的即x86的则将上述路径中”x86_64”改成i386,若为6.5版的可以直接将上面的6改成6.5,软件包不一定要最新的,一般来说6.4与6.5的软件包是通用的,本人没有测试过,若遇到改成6.5无法下载可以尝试直接按照上述路径下载
  如以上链接无法直接下载请进百度网盘下载直接copy进去,但是请注意权限设置,下载地址如下:http://pan.baidu.com/s/1eQwfAtO
  4、安装下载的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、下载CentOS6-Base-163.repo文件,存放到 /etc/yum.repo.d中
  wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
  6、编辑CentOS6-Base-163.repo文件,将其中的$releasever更改为centos的版本号,6.4版的则改成6,若是6.5版的则改成6.5,见下面红色标出的数字 # vim CentOS6-Base-163.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.
  #

  name=CentOS-6 - Base - 163.com
  baseurl=http://mirrors.163.com/centos/6/os/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
  gpgcheck=1
  gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
  #released updates

  name=CentOS-6 - Updates - 163.com
  baseurl=http://mirrors.163.com/centos/6/updates/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
  gpgcheck=1
  gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
  #additional packages that may be useful

  name=CentOS-6 - Extras - 163.com
  baseurl=http://mirrors.163.com/centos/6/extras/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
  gpgcheck=1
  gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
  #additional packages that extend functionality of existing packages

  name=CentOS-6 - Plus - 163.com
  baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
  gpgcheck=1
  enabled=0
  gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
  #contrib - packages by Centos Users

  name=CentOS-6 - Contrib - 163.com
  baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
  gpgcheck=1
  enabled=0
  gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
  7、# yum clean all 清除原有缓存
  8、# yum makecache
  获取yum列表:出现右侧提示表示yum更改完成:Metadata Cache Created
页: [1]
查看完整版本: RedHat 6.3配置使用Centos的yum源