yum源修改

目的:将yum源改为阿里云

步骤:

  1. 卸载默认的yum源
    rpm -qa | grep yum | xargs rpm -e --nodeps
    rpm -qa | grep python-urlgrabber | xargs rpm -e --nodeps
  2. 下载阿里云yum包
    去阿里云资源找,版本看系统,本次为RHEL7:https://mirrors.aliyun.com/centos/

    yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
    yum-3.4.3-154.el7.centos.noarch.rpm
    yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm
    yum-utils-1.1.31-42.el7.noarch.rpm
    python-urlgrabber-3.10-8.el7.noarch.rpm

  3. 安装yum包
    rpm -ivh 上面下载的5个文件名,每个空格分开 --nodeps
  4. 修改配置(即跟换yum源)
    vim /etc/yum.repos.d/birdteam.repo 输入以下配置
    #---更换 yum Start---
    [base]
    name=CentOS-7 - Base - mirrors.aliyun.com
    baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
    gpgcheck=0
    [updates]
    name=CentOS-7 - Updates - mirrors.aliyun.com
    baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
    gpgcheck=0
    [extras]
    name=CentOS-7 - Extras - mirrors.aliyun.com
    baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
    gpgcheck=0
    #---更换 yum End---
  5. 清除yum数据,检验 (出现很多包和版本即为更改成功 )

    yum clean all
    yum list

猜你喜欢

转载自www.cnblogs.com/hunter-007/p/11131640.html