• 前言
  • 设置网卡开机自动启动
  • 设置国内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. Delphi新手跟我学写CALL,附完整原程序

    在开始进入正题前先罗嗦几句: 1.本人也刚学Delphi不久,也刚通过<诛仙>游戏的绝大部分CALL不久.所以在以下所说所列举的例子并不算是名门正中的写法,如有不当,请各位原谅. 2.本人 ...

  2. 欢迎来到Swift天地(Welcome to Swift)

    期待已久的WWDC真的是不管是什么硬件更新,没有太多的开发者,本次会议是还是很有亮点.水果给我们带来了一种新的语言Swift.种无比简洁高效的语言,并且新的 Swift 语言依然会和 C 与 Obje ...

  3. Network management system scheduling for low power and lossy networks

    In one embodiment, a network management system (NMS) determines an intent to initialize a request-re ...

  4. New in 10.2.2: C++ and Debugger Improvements

    In RAD Studio 10.2.2, we've made a number of great quality improvements for the C++ toolchain and fo ...

  5. Twitter "like" 动画实战

    http://zhuanlan.zhihu.com/FrontendMagazine/20486738

  6. centos 7 构造iptables开放80port

    centos7默认是使用firewalld托管防火墙. 安装后centos7后,已安装nginxserver,但同样没有在一个局域网访问,我哥哥告诉我,我应该是一个防火墙以打开.防火墙关闭就可以了. ...

  7. go 工具链目前[不支持编译 windows 下的动态链接库][1],不过[支持静态链接库][2]

    go 工具链目前[不支持编译 windows 下的动态链接库][1],不过[支持静态链接库][2].想要产生dll,可以这样 workaround ,参考 golang [issuse#11058][ ...

  8. 机器学习、深度学习实战细节(batch norm、relu、dropout 等的相对顺序)

    cost function,一般得到的是一个 scalar-value,标量值: 执行 SGD 时,是最终的 cost function 获得的 scalar-value,关于模型的参数得到的: 1. ...

  9. 简明Python3教程 9.函数

    简介 函数是程序的可复用片段,允许你为语句块赋予名字之后在程序的任何地方运行它们任意次,这称做函数调用. 我们已经使用过一些内建函数,例如len和range等. 函数也许是任何有意义的软件中最重要的构 ...

  10. AutoEncoder一些实验结果,并考虑

    看之前Autoencoder什么时候,我做了一些练习这里:http://ufldl.stanford.edu/wiki/index.php/Exercise:Sparse_Autoencoder .其 ...