• 前言
  • 设置网卡开机自动启动
  • 设置国内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. 课后作业11--使用SQL语句创建一个数据库

    use master if db_id ('test') is not null--判断test数据库是否存在 drop database [test]--如果存在 删除test go--完成查找删除 ...

  2. Method and system for implementing mandatory file access control in native discretionary access control environments

    A method is provided for implementing a mandatory access control model in operating systems which na ...

  3. [MFC]SDI在图片背景上实现文本跟随鼠标移动

    SDI是单文档接口应用程序的简称.本文要实现的是在视图区域显示一张图片,然后在图片表层显示文字,并且文字跟随鼠标移动.思考一下,可以判断这个问题一共分为以下几个部分:1.显示图片:2.找到鼠标的位置: ...

  4. FreeBSD 5.0中强制访问控制机制的使用与源代码分析【转】

    本文主要讲述FreeBSD 5.0操作系统中新增的重要安全机制,即强制访问控制机制(MAC)的使用与源代码分析,主要包括强制访问控制框架及多级安全(MLS)策略两部分内容.这一部分讲述要将MAC框架与 ...

  5. oracle 数组

    定义一个长度为5的字符串数组 type str_array is varray(5) of varchar2(30); v_str_array str_array := expr_key_array( ...

  6. ie height

    苦恼我许久了,为啥在IE中设置div的height属性无效呢... 在网上查了,常用解决是设置line-height或者设置overflow:hidden,不过我这个div用来定位的,一是里面没文字, ...

  7. 解决:eth0安装插卡无法自己主动,网卡的配置信息不network-scripts于

    问题方案:eth0安装插卡无法自己主动,网卡的配置信息不network-scripts于 解决: 1>vi /etc/rc.d/rc.loacl 最后加 ifup eth0 2>reboo ...

  8. 理解 iOS 和 macOS 的内存管理

    在 iOS 和 macOS 应用的开发中,无论是使用 Objective-C 还是使用 swift 都是通过引用计数策略来进行内存管理的,但是在日常开发中80%(这里,我瞎说的,8020 原则嘛

  9. Android官方教程翻译(3)——创建一个简单的用户界面

    转载请注明出处:http://blog.csdn.net/dawanganban/article/details/9839523 Building a Simple User Interface 创建 ...

  10. 1.开始第一个MVC项目

    安装就不说了 1.在指定路径创建好项目文件夹之后,打开cmd,进去这个文件夹路径下 输入命令 dotnet new mvc 就会在文件夹内创建一个mvc项目 2.创建好项目之后 直接在这个路径下输入 ...