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

  • 相关阅读:
    (C#)Windows Shell 外壳编程系列3 上下文菜单(iContextMenu)(一)右键菜单
    修改BlogEngine.NET:给摘要显示添加图片显示的另一种方法
    (C#)Windows Shell 外壳编程系列8 同后缀名不同图标?
    Win2k下isapi dll调试设置
    战争机器作弊码
    使用Windows系统提供的IP控件
    Delphi中TUDPSocket的使用
    Delphi字符串、PChar与字符数组之间的转换
    Delphi高效的字符串处理
    (C#)Windows Shell 外壳编程系列4 上下文菜单(iContextMenu)(二)嵌入菜单和执行命令
  • 原文地址:https://www.cnblogs.com/yilichentu/p/13356429.html
Copyright © 2011-2022 走看看