• 前言
  • 设置网卡开机自动启动
  • 设置国内dns服务器系统
  • 修改CentOS-Base.repo中的地址
  • 所参考的文章地址

前言
刚安装完的CentOS7的系统,发现无法使用yum命令进行更新,在更新的时候会出现下面这种内容,为此问题有以下这些解决方案可以尝试。
 One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work). 3. Disable the repository, so yum won't use it by default. Yum will then
just ignore the repository until you permanently enable it again or use
--enablerepo for temporary usage: yum-config-manager --disable <repoid> 4. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise: yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
24
 
1
 One of the configured repositories failed (Unknown),
2
 and yum doesn't have enough cached data to continue. At this point the only
3
 safe thing yum can do is fail. There are a few ways to work "fix" this:
4

5
     1. Contact the upstream for the repository and get them to fix the problem.
6

7
     2. Reconfigure the baseurl/etc. for the repository, to point to a working
8
        upstream. This is most often useful if you are using a newer
9
        distribution release than is supported by the repository (and the
10
        packages for the previous distribution release still work).
11

12
     3. Disable the repository, so yum won't use it by default. Yum will then
13
        just ignore the repository until you permanently enable it again or use
14
        --enablerepo for temporary usage:
15

16
            yum-config-manager --disable <repoid>
17

18
     4. Configure the failing repository to be skipped, if it is unavailable.
19
        Note that yum will try to contact the repo. when it runs most commands,
20
        so will have to try and fail each time (and thus. yum will be be much
21
        slower). If it is a very temporary problem though, this is often a nice
22
        compromise:
23

24
            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true



设置网卡开机自动启动
针对这个问题首先要确认网卡是否已经启动了,CentOS7最开始安装完的时候网卡可能会是关闭的,需要自己自行开启。
确保自己使用的是root账号,若不是,请自行更换。
1、进入/etc/sysconfig/network-scripts 目录。即输入命令 "cd /etc/sysconfig/network-scripts" ,使用命令 "ls -a" 可以查看该目录下的所有文件。
2、修改ifcfg-ens33的网卡配置文件(CentOS7修改了网卡命名规则,不再是eth0了,而是ifcfg-eno+数字)。输入命令 "vi ifcfg-ens33" 进入vi编辑器,按下"i"或者"insert"键进入编辑模式。
3、将 "ONBOOT" 的值修改为 "yes" ,之后按esc退出编辑模式,输入 ":wq" 保存退出
4、重启系统或者重启网卡,输入命令 "reboot" 或 "service network restart"。


设置国内dns服务器
若已经开启了网卡还是存在该问题可以尝试配置下国内的dns。
1、输入命令 "vi /etc/resolv.conf" 
2、添加 "nameserver 114.114.114.114" 
3、保存后,重启系统或者重启网卡,输入命令 "reboot" 或 "service network restart"。


修改CentOS-Base.repo中的地址
若上述方法还是无效可以尝试修改CentOS-Base.repo中的地址
1、进入 "/etc/yum.repos.d" 。
2、编辑 "vi CentOS-Base.repo" 。
3、将所有的 "mirrorlist" 注释掉,将所有的 "baseurl" 取消注释。
4、保存后,重启系统,输入命令 "reboot" 。


参考文章



CentOS7 无法使用yum命令,无法更新解决方法的更多相关文章

  1. Red Hat Linux 无法使用yum命令

    一:首先提供部分Red Hat 镜像下载地址 1.rhel-server-6.8-i386-dvd.iso 链接: https://pan.baidu.com/s/18VqxRgBMuAJE7Ty0H ...

  2. CentOS忘记密码修改方案以及centos卡在开机登录界面,命令失效的解决方法

    CentOS忘记密码修改方案 应用场景 linux管理员忘记root密码,需要进行找回操作. 注意事项:本文基于CentOS7.2环境进行操作的,由于CentOS的版本之间是有差异的,继续之前请先确定 ...

  3. CentOS7使用yum命令安装Java1.8

    CentOS7使用yum命令安装Java1.8 首先更新已安装的包:#yum update查看系统当前的java版本:#java -version==================== CentOS ...

  4. Linux yum操作无效的解决方法

    1.没网,试着:ping www.baidu.com 如果显示没有连接的话,就说明没网,也就无法使用yum 命令. 2.ping通了的话,还是是用不了yum命令,说明是yum镜像没有了,那么就得下载一 ...

  5. Oracle数据导入导出imp/exp sp2-0734:未知的命令开头'imp...解决方法

    Oracle数据导入导出imp/exp sp2-0734:未知的命令开头'imp...解决方法   sp2-0734:未知的命令开头'imp 忽略了剩余行默认分类   www.2cto.com  应该 ...

  6. 02: 安装epel 解决centos7无法使用yum安装nginx

    参考网址: http://www.mamicode.com/info-detail-1671603.html 1.yum命令安装 yum install epel-release -y 2.更新数据 ...

  7. 安装redis 执行make命令时报错解决方法

    一.未安装GCC 解决方法:执行yum install gcc-c++命令安装GCC,完成后再次执行make命令 yum install gcc-c++ Linux无法连接网络 http://www. ...

  8. CentOS系统找不到setup命令工具的解决方法

    如果你的CentOS系统中没有setup命令,很有可能是因为你安装CentOS系统时采用了最小化安装(minimal).这时,你执行setup命令时,就会报错: 错误信息: 1[root@localh ...

  9. NAT模式下VMware中CentOS7无法连接外网的解决方法

    故障现象 ----------------------------------------------------------------------------------------------- ...

随机推荐

  1. Opencv光流运动物体追踪

    光流的概念是由一个叫Gibson的哥们在1950年提出来的.它描述是空间运动物体在观察成像平面上的像素运动的瞬时速度,利用图像序列中像素在时间域上的变化以及相邻帧之间的相关性来找到上一帧跟当前帧之间存 ...

  2. sqoop 1.4.7 安装配置/连接测试

    环境: hadoop2.7.7 mysql 8 zk 3.4.10 hive 3 1.上传并解压tar包后进入conf目录 拷贝sqoop-env-template.sh并重命名为sqoop-env. ...

  3. Starting MySQL.. ERROR! The server quit without updating PID file (/usr/local/mysql/data/vm10-0-0-19

    输入:service mysqld start 报错: Starting MySQL.. ERROR! The server quit without updating PID file (/usr/ ...

  4. 卷积神经网络(CNN)的细节问题(滤波器的大小选择)

    0. 滤波器的大小选择 大部分卷积神经网络都会采用逐层递增(1⇒ 3 ⇒ 5 ⇒ 7)的方式. 每经过一次池化层,卷积层过滤器的深度都会乘以 2: 1. 权值共享:减轻过拟合 & 降低计算量 ...

  5. Mac 开发PhoneGap 应用,怎样加入插件 barcodescaner

    搞了两天,最终悟出来了 PhoneGap 与 Cordova 的关系了,有人说是WebKit 与 Chrome 的关系,但我个人理解,两个东西再干一件事情,另外 PhoneGap 被Apache 收购 ...

  6. WPF 从程序集中检索图片资源stream给Image控件使用

    原文:WPF 从程序集中检索图片资源stream给Image控件使用 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/nihang1234/artic ...

  7. .net命名空间和程序集详解

    命名空间是一种用于将逻辑上相似的类按层次结构分组的机制.这种机制防止了命名冲突.在这种结构化采用被点号"."分隔的单词来实现.通常最顶层的命名空间是System,例如System; ...

  8. Android开发之 shape的使用

    android shape的使用 shape用于设定形状,能够在selector,layout等里面使用,有6个子标签,各属性例如以下: <?xml version="1.0" ...

  9. Javascript中的类实现

    Javascript本身并不支持面向对象,它没有访问控制符,它没有定义类的关键字class,它没有支持继承的extend或冒号,它也没有用来支持虚函数的virtual,不过,Javascript是一门 ...

  10. 主干(trunk)、分支(branch )、标记(tag)

    主干(trunk).分支(branch ).标记(tag) 用法示例 + 图解   以svn为例,git的master相当于trunk,dev分支相当于branches --------------- ...