yum无法使用解决办法

yum无法使用解决方法(比较全,以后如果遇到别的问题还会添加)
yum无法使用解决方法(比较全,以后如果遇到别的问题还会添加)

  • 如下,新装的linux虚拟机,yum安装wget报错

Cannot find a valid baseurl for repo: base/7/x86_64

[root@baty opt]# yum install wget
已加载插件:fastestmirror
Determining fastest mirrors

 One of the configured repositories failed (未知),
 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. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, 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>
        or
            subscription-manager repos --disable=<repoid>

     5. 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

Cannot find a valid baseurl for repo: base/7/x86_64

复制代码

######最新方法##### 绝对有用

后来发现是新装的CentoS7系统不管是什么包,网卡配置都是有问题的。新装完之后如果虚拟机是桥接模式需要修改网卡配置的,需要修改网卡ONBOOT=yes 激活网卡,才能联网更新。

找到原网卡配置文件vi  /etc/sysconfig/network-scripts/ifcfg-ens33

修改:ONBOOT=YES

重启network: systemctl restart network

至此执行:yum update 一路畅通无阻

#####以下为旧方法,如果上述方法不起作用看下面

解决方法1: 最简单粗暴的方法就是把/etc/yum.repos.d下的文件全部删除,然后将能正常使用yum的同类服务器的这个目录下的文件全部拷贝过来,然后yum clean all 和yum makecache 即可(这是之前我研究了很久这个问题之后一个大佬告诉我的,如果急需使用yum可以用这个方法!当然,最好还是备份文件夹之后再删除,以免发生意外,这个说多了都是泪!)

解决方法2:有网友说修改/etc/yum/pluginconf.d/fastestmirror.conf  配置文件的enable=1 改成enable=0 , 以及修改/ect/yum.conf  将plugins=1改成0 (当然我通过这个方法没有解决)

解决方法3:更换yum源,然后一搜换源都是 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo    大哥我就是yum install wget报的错,你让我去哪里用wget! 然后我想到了直接下载拷贝上来。下面是操作方法。

解决办法:安装这个源
[root@bastion-IDC yum.repos.d]# rpm -ivh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

[root@bastion-IDC yum.repos.d]# yum clean all
[root@bastion-IDC yum.repos.d]# yum makecache //将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度
[root@bastion-IDC yum.repos.d]# yum update

最后再次使用yum就ok了

解决方法4:之前提到/etc/yum.repos.d 这个文件夹 ,进入这个文件夹之后发现有几个文件

问题就出在这个CentOS-Base.repo上面,有说因为这个文件的问题 ,通过mv命令修改使这文件无效就行。(我也是没有行得通,贼气)

解决方法5:有人说网卡设置的问题,桥接模式改为NAT模式就能成功

Cannot find a valid baseurl for repo: base/7/x86_64这个错误是因为虚拟机连不上外网,不信的可ping www.baidu.com 看看能不能通,如果是这个原因的话修改虚拟机模式
从桥接模式变为NAT模式就可以解决问题。(如果虚拟机能连上外网的话请看1-4的解决方法)
Linux操作系统的CPU使用过高时,可以采取以下解决办法: 1. 使用系统监控工具:使用工具如top或htop等来查看系统进程中CPU利用率最高的进程。这可以帮助我们确定导致CPU使用率高的原因,并且可以进一步采取适当的措施进行解决。 2. 杀死高CPU利用率的进程:通过终止或重启造成高CPU利用率的进程来降低系统的负载。可以使用命令如kill或pkill来停止指定的进程。 3. 优化系统配置:通过优化应用程序或系统配置来减少CPU压力。例如,增加系统内存、调整系统参数或减少并发连接等。 4. 检查恶意软件:进行系统病毒扫描,以确保系统没有受到恶意软件或病毒的感染。恶意软件可能会导致CPU使用率高。 5. 更新软件包:升级或更新软件包可以修复性能问题并提供更好的优化。通过使用系统包管理器如yum或apt-get等来更新和升级软件包。 6. 启用系统定时任务: 手动清理系统日志和临时文件可能会很麻烦,可以通过设置自动任务定期清理来优化系统性能。 7. 检查硬件问题:有时CPU使用率高可能是由于硬件问题引起的。确保CPU风扇运行正常,散热良好,所有硬件组件正确插入,并消除硬件故障。 8. 监控系统性能:通过使用工具如sar、vmstat等来对系统资源使用情况进行监控,以便及时发现CPU使用过高的问题,及时采取相应的解决措施。 总结起来,解决Linux操作系统CPU使用过高的问题,需要综合考虑软件配置和硬件情况,通过优化系统配置、优化应用程序、杀死高CPU利用率的进程、更新软件包等多种手段来降低系统负载和提升性能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值