centos7操作yum命令失败

news/2024/10/17 6:32:27/
  • 前言
  • 设置网卡开机自动启动
  • 设置国内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 onlysafe 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 workingupstream. This is most often useful if you are using a newerdistribution release than is supported by the repository (and thepackages for the previous distribution release still work).3. Disable the repository, so yum won't use it by default. Yum will thenjust 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 muchslower). If it is a very temporary problem though, this is often a nicecompromise: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" 。

 


http://www.ppmy.cn/news/51205.html

相关文章

Android之 颜色选择器

一&#xff0c;简介 1.1 计算机的颜色通常有两种表示方式&#xff1a; 光源模式RGB(Red红, Green绿, Blue蓝)&#xff0c;数值0-255 印刷模式CMYK(Cyan青, Magenta品红, Yellow黄, Black黑)&#xff0c;数值1-100 任何颜色都是由RGB或CMYK混合出来的&#xff0c;再加上透明度…

C++基础知识-2

本期我们接着来讲C的基础知识&#xff0c;没有看过的朋友可以先看看上一期 (16条消息) C基础知识-----命名空间_KLZUQ的博客-CSDN博客 目录 4.缺省参数 5.函数重载 6.引用 7.内联函数 8.auto关键字&#xff08;C11&#xff09; 9. 基于范围的for循环(C11) 10.指针空值nul…

WPF教程(七)--依赖属性(3)--附加属性

一、 只读依赖属性 以前在对于非WPF的功能来说&#xff0c;对于类的属性的封装中&#xff0c;经常会对那些希望暴露给外界只读操作的字段封装成只读属性&#xff0c;同样在WPF中也提供了只读属性的概念&#xff0c;如一些 WPF控件的依赖属性是只读的&#xff0c;它们经常用于报…

安卓Socket客户端(及刷新页面)

前言:最近学习了一波java语言和基础安卓开发,综合运用写一段安卓Socket客户端,实现控制小车的前进、后退、左转、右转,具体实现代码记录在下面代码 一、安卓Socket客户端 MainActivity.java package com.example.zyf;import java.io.IOException; import java.io.Output…

Python requests模块:发送HTTP请求和处理响应

目录 前言一、requests模块二、requests携带参数的方式三、get请求URL解码编码四、post请求携带数据编码格式五、get请求携带请求头六、post请求携带参数七、requests.session的使用(可以不用带cookie)八、requests模块其他参数九、response对象十、最后 前言 爬虫是什么&…

026:Mapbox GL加载矢量切片数据源

第026个 点击查看专栏目录 本示例的目的是介绍演示如何在vue+mapbox中加载矢量切片数据源。将矢量源添加到地图。使用其 tileset URL(mapbox:// + tileset ID)添加任何 Mapbox 托管的 tileset。 直接复制下面的 vue+mapbox源代码,操作2分钟即可运行实现效果 文章目录 示例…

ABAP常用系统变量 (SY-)及SY-SUBRC

abap系统变量在syst结构里面可以找到 SY-SUBRC: 系统执行某指令后,表示执行成功与否的变量,0表示成功 SY-DBLNT: 被处理过的记录的笔数 SY-UNAME: 当前使用者登入SAP的USERNAME SY-DATUM: 当前系统日期 SY-UZEIT: 当前系统时间 SY-TCODE: 当前执行程序的Transaction code …

《类和对象》(下篇)

本文主要讲解类和对象的一些其他小知识。 文章目录 前情回顾一、用运算符重载写一个输入流和输出流①流插入②流提取③流提取和流插入的优化 二、const成员三、用运算符重载改变数组 1、再谈构造函数1.1 构造函数体赋值(不相当于初始化)1.2 初始化列表①引出初始化列表②怎么用…