redhat 7.5 更換 yum源

  • 由於 redhat 的 yum 是收費,因此須要換成 Centos 的 yum 才能夠

  • 首先,卸載 redhat 的 yum 軟件

    sudo rpm -qa|grep yum
  • 其次,下載 Centos yum rpm 包, 並安裝

    sudo wget  http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm
    sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
    sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
    sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
    sudo wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
    sudo rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm 
    sudo rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm 
    sudo  rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm 
    sudo rpm -ivh yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm  yum-3.4.3-158.el7.centos.noarch.rpm
  • 運行查看 yum 版本

    yum -v
  • 下載一個 Centos7 repo 模板

    sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  • 修改這個模板的內容 以下:

    [base]
    name=CentOS-$releasever - Base
    baseurl=http://vault.centos.org/7.5.1804/os/$basearch/
    gpgcheck=1
    gpgkey=http://vault.centos.org/7.5.1804/os/x86_64/RPM-GPG-KEY-CentOS-7
    
    
    #released updates
    [updates]
    name=CentOS-$releasever - Updates
    baseurl=http://vault.centos.org/7.5.1804/updates/$basearch/
    gpgcheck=1
    gpgkey=http://vault.centos.org/7.5.1804//os/x86_64/RPM-GPG-KEY-CentOS-7
    
    
    [extras]
    name=CentOS-$releasever - Extras
    baseurl=http://vault.centos.org/7.5.1804//extras//$basearch/
    gpgcheck=1
    gpgkey=http://vault.centos.org/7.5.1804/os/x86_64/RPM-GPG-KEY-CentOS-7
    
    [centosplus]
    name=CentOS-$releasever - Plus
    baseurl=http://vault.centos.org/7.5.1804/centosplus//$basearch/
    gpgcheck=1
    enabled=0
  • 執行更新源的操做

    sudo yum clean all && yum makecache
  • 註釋:

    一開始我原本想使用 163 或者是清華或者是阿里的,可是找了一下,這三個 7.5的源都沒有文件了。後面找了一下  http://vault.centos.org/ 這個網站纔有
    後面有更換源的操做,能夠參考上面,只要把版本換一下就能夠了。
相關文章
相關標籤/搜索