当前位置: 代码迷 >> 综合 >> 配置 Redhat6 yum 更新源
  详细解决方案

配置 Redhat6 yum 更新源

热度:28   发布时间:2024-01-16 21:22:22.0
  • 由于 redhat 的 yum 在线更新是收费的,如果没有注册的话不能使用,如果要使用,需将 redhat 的 yum 卸载后,重启安装,再配置其他源.
  1. 删除 redhat 原有 yum
    1. rpm -aq | grep yum | xargs rpm -e --nodeps
  2. 下载 yum 安装文件(如果下载时找不到文件,就登录到:http://mirrors.163.com/centos/6/os/x86_64/ 上查找相应的文件,然后再下载)
    1. wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
      wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
      wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
      wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
  3. 安装yum
    1. 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
  4. 更新 repo 文件(目录 /etc/yum.repos.d/ 下原来的文件都是可以删除的)
    1. vim /etc/yum.repos.d/rhel-debuginfo.repo
    2. 写入如下内容:
      1. [base]
        name=CentOS-$releasever - Base
        baseurl=http://mirrors.163.com/centos/6/os/$basearch/
        gpgcheck=1
        gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6#released updates
        [updates]
        name=CentOS-$releasever - Updates
        baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
        gpgcheck=1
        gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6#packages used/produced in the build but not released
        #[addons]
        #name=CentOS-$releasever - Addons
        #baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
        #gpgcheck=1
        #gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
        #additional packages that may be useful
        [extras]
        name=CentOS-$releasever - Extras
        baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
        gpgcheck=1
        gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
        #additional packages that extend functionality of existing packages
        [centosplus]
        name=CentOS-$releasever - Plus
        baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
        gpgcheck=1
        enabled=0
  5. yum clean all
  6. update/install vim 测试下
    1. yum -y install vim
  7. yum 的相关配置可以在文件 /etc/yum.conf 中来指定,具体解释见下截图:


    1. 默认设置是这样的


      1. 则下载安装过的安装包可以在目录  /var/cache/yum/x86_64/$releasever/base/packages 下找到