yum命令常用的报错现象以及解决方案

故障现象yum命令报错

注:yum安装时报错,提示/var/run/yum.pid 已被锁定,PID为另一个程序正在运行。

解决方案

输入这个命令先删除,再重新yum安装。

rm -f /var/run/yum.pid

注:如yum instal 安装时会因为网络、配置问题导致报错

[root@localhost yum.repos.d]# yum list
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"

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

解决方案

清理缓存

yum clean al

查看网卡配置信息是否有误

[root@localhost yum.repos.d]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 
'根据自己网卡选择'

'查看onboot,如果为no,改为yes,wq保存后重启网卡即可'

ONBOOT="yes"

在/etc/resokv.conf中添加nameserver 114.114.114.114或者8.8.8.8,确保ping通。再进行yum clean all ,然后yum list或者yum makecache

猜你喜欢

转载自blog.csdn.net/weixin_50344807/article/details/112914669
今日推荐