zoukankan      html  css  js  c++  java
  • CentOS 7配置网卡信息,并设置yum为阿里云的镜像源

    一、问题场景

      使用virtualbox创建的centos 7版本的linux虚拟机,使用ping mirrors.aliyun.com有返回,但是wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo报超时。

    二、网卡配置(wifi模式)

      虚拟机需要关机

      1.配置网卡1,使虚拟机可以访问互联网

      

       2.配置网卡2,使虚拟机可以与本机建立通信,并且可以访问局域网(wifi模式设置为桥接网卡)

      

      配置好之后就可以启动虚拟机了,这个时候可以在虚拟机里面ping 本机的ip,同时执行wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo能够下载成功(注意:如果单只是配置了桥接网卡,而没有配网络地址转换则会出现笔者的这种情况

    三、配置yum阿里云镜像

      1.禁用yum插件fastestmirror

        1) 修改插件的配置文件

          # cp /etc/yum/pluginconf.d/fastestmirror.conf /etc/yum/pluginconf.d/fastestmirror.conf.bak     (备份)

          # vi  /etc/yum/pluginconf.d/fastestmirror.conf

          #  修改enabled的值,由1改为0,禁用该插件

        2) 修改yum的配置文件

          # cp /etc/yum.conf /etc/yum.conf.bak       (备份)

          # vi /etc/yum.conf

          #  修改plugins的值,由1改为0,不使用该插件

      2.下载阿里云repo覆盖本地配置

        1) 备份CentOS-Base.repo文件

          #  cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

        2) 下载并覆盖

          #  wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

        3) 备份epel.repo文件(本地可能没有,如果本地没有可以不用执行备份操作)

          #  cp /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak

        4) 下载并覆盖

          #  wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

      3.清除原来的缓存并生成新的缓存

        #  yum clean all

        #  yum makecache

  • 相关阅读:
    POJ3122贪心或者二分(分蛋糕)
    POJ2118基础矩阵快速幂
    POJ2118基础矩阵快速幂
    POJ1328贪心放雷达
    POJ1328贪心放雷达
    hdu4642博弈(矩阵)
    hdu4642博弈(矩阵)
    POJ1042 贪心钓鱼
    POJ3160强连通+spfa最长路(不错)
    POJ3114强连通+spfa
  • 原文地址:https://www.cnblogs.com/yilichentu/p/13356429.html
Copyright © 2011-2022 走看看