一聚教程网:一个值得你收藏的教程网站

热门教程

总结CentOS yum 错误分析解决

时间:2022-06-30 20:56:48 编辑:袖梨 来源:一聚教程网

一、今天技安在yum自己的小云主机的时候,出现了一下错误:

$ yum -y update
rpmdb: Thread/process 28636/139844750771968 failed: Thread died in Berkeley DB library
error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 - (-30974)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:
Error: rpmdb open failed

大致的意思是rpmdb打开失败。于是google了一下

解决办法:

# 清除缓存
rm /var/lib/rpm/__db*
# 重建
rpm --rebuilddb
之后就可以正常的update了。


二、在centOs上安装软件时。提示报错信息:


Could not retrieve mirrorlisthttp://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was

14: PYCURL ERROR 6 - "Couldn't resolvehost 'mirrorlist.centos.org'"

Could not retrieve mirrorlisthttp://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras errorwas

14: PYCURL ERROR 6 - "Couldn't resolvehost 'mirrorlist.centos.org'"

Could not retrieve mirrorlisthttp://mirrorlist.centos.org/?release=6&arch=x86_64&repo=updates errorwas

14: PYCURL ERROR 6 - "Couldn't resolvehost 'mirrorlist.centos.org'"

http://mirrors.163.com/centos/6.2/os/x86_64/repodata/repomd.xml:[Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.163.com'"

Trying other mirror.

Error: Cannot retrieve repository metadata(repomd.xml) for repository: base. Please verify its path and try again

[root@hbase01-222 ~]# service iptables stop

[root@hbase01-222 ~]# nslookup  mirrorlist.centos.org

;; connection timed out; no servers couldbe reached

到这里发现问题了,我的域名解析不了,yum的配置文件里指向的域名就识别不了了。重新设置下dns指向。

[root@hbase01-222 ~]# vim /etc/resolv.conf

# Generated by NetworkManager

 

nameserver 8.8.8.8

[root@hbase01-222 ~]# yum install gcc-c++

解决Centos yum 更新出错

显示错误如下:

Loaded plugins: fastestmirror, langpacks

1、dns问题

2、镜像连接错误

 

DNS问题

先说dns问题,测试方法就是ping外网,发现ping不通就是这个问题。

解决方法:

echo "nameserver 8.8.8.8">>/etc/resolv.conf

 

镜像连接错误

如果是第二个问题,就考虑使用国内的镜像,比如163镜像。

解决方法:

这里以centos 7为例,其他版本把数字改下就好,取大版本号

cd /etc/yum.repos.d

mv CentOS-Base.repo CentOS-Base.repo.bak

vi CentOS-Base.repo

[base]
name=Red Hat Enterprise Linux 7.0 -Base
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
[update]
name=Red Hat Enterprise Linux 7.0 -Updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
[extras]
name=Red Hat Enterprise Linux 7.0 -Extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
保存即可。

热门栏目