安装RPM套件rpm-build错误解决:NOKEY、elfutils is needed
---
这是我在测试Vbird的自制作rpm套件时遇到的问题,当时作好的套件源文件(/usr/src/redhat/SOURCES),和设定文件(/usr/src/redhat/SPECS),准备打包生成rpm文件时,忽然发现系统中没有rpmbuild命令……
[root@localhost SPECS]# rpmbuild -bb showvbird.spec
bash: rpmbuild: command not found
--查询得知:这个命令要安装rpm-build*.rpm包……
--据说在安装包里有,查找一下:
[root@localhost SPECS]# find /media/CDROM -name "*rpm*build*"
/media/CDROM/Server/rpm-build-4.4.2-37.el5.i386.rpm
--果然有,CP过来
[root@localhost SPECS]# cp /media/CDROM/Server/rpm-build-4.4.2-37.el5.i386.rpm /root/
--安装RPM
[root@localhost SPECS]# rpm -ivh /root/rpm-build-4.4.2-37.el5.i386.rpm
warning: /root/rpm-build-4.4.2-37.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
elfutils is needed by rpm-build-4.4.2-37.el5.i386
-->报错……一头雾水……虽然看了鸟哥的部分教程……
--又被卡住了,没有一件事情是顺利的,是我太笨了么,还是我太不走运了呢……下定决心要解决……
--网上资料1
(((
http://blog.sina.com.cn/s/blog_4a071ed80100h7je.html
在CentOS下有的时候用yum安装软件的时候最后会提示:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID*****
这是由于yum安装了旧版本的GPG keys造成的,解决办法就是:
rpm --import /etc/pki/rpm-gpg/RPM*
再安装软件就不会有这个错误提示了。
)))
--网上资料2
(((
在安装rpm包时,可能会出现NOKEY的提示
[root@meccn linux]# rpm -ivh gcc-4.1.1-52.2.1.i386.rpm
warning: gcc-4.1.1-52.2.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
error: cannot create %sourcedir /usr/src/asianux/SOURCES
错误解决办法 在rpm 命令后添加 --force --nodeps也就是强制进行安装
)))
--资料2没有敢试:
--试了一下网上资料1:
[root@localhost SPECS]# rpm --import /etc/pki/rpm-gpg/RPM*
You have new mail in /var/spool/mail/root
[root@localhost SPECS]# rpm -ivh /root/rpm-build-4.4.2-37.el5.i386.rpm
error: Failed dependencies:
elfutils is needed by rpm-build-4.4.2-37.el5.i386
[root@localhost SPECS]#
--NOKEY消失了,看来这一招管用
--剩下就是“elfutils is needed”问题了……
--论坛发帖子,群里问高手……
--得到结论:这是需要安装依赖elfutils
--怎样安装elfutils呢,有人建议用yum解决,因为yum会帮助解决依赖关系.也用yum查了一下:
yum install rpm-build
yum list | grep elfutils
yum install elfutils......
--又听说REDHAT的YUM需要注册了才能用,REDHAT的YUM不能直接用,在线升级属于服务,是要收钱的.放弃。
--最终听了杭州-哇嘎达(41105780) 10:37:06的建议:直接到安装介质上找到elfutils*.rpm并且安装就好了
[root@localhost SPECS]# find /media/CDROM -name "elfutils*.rpm"
/media/CDROM/Server/elfutils-devel-0.125-3.el5.i386.rpm
/media/CDROM/Server/elfutils-libs-0.125-3.el5.i386.rpm
/media/CDROM/Server/elfutils-libelf-0.125-3.el5.i386.rpm
/media/CDROM/Server/elfutils-devel-static-0.125-3.el5.i386.rpm
/media/CDROM/Server/elfutils-libelf-devel-static-0.125-3.el5.i386.rpm
/media/CDROM/Server/elfutils-0.125-3.el5.i386.rpm
/media/CDROM/Server/elfutils-libelf-devel-0.125-3.el5.i386.rpm
[root@localhost SPECS]# rpm -ivh /media/CDROM/Server/elfutils*.rpm
Preparing... ########################################### [100%]
package elfutils-libelf-0.125-3.el5 is already installed
--也不知道哪个安装成功了
[root@localhost SPECS]# find /media/CDROM -name "rpm-build*.rpm"
/media/CDROM/Server/rpm-build-4.4.2-37.el5.i386.rpm
[root@localhost SPECS]# rpm -ivh /media/CDROM/Server/rpm-build-4.4.2-37.el5.i386.rpm
error: Failed dependencies:
elfutils is needed by rpm-build-4.4.2-37.el5.i386
--安装rpm-build还是不成功……
--用以下命令逐个重新安装elfutils
rpm -ivh /media/CDROM/Server/elfutils-devel-0.125-3.el5.i386.rpm
rpm -ivh /media/CDROM/Server/elfutils-libs-0.125-3.el5.i386.rpm --OK
rpm -ivh /media/CDROM/Server/elfutils-libelf-0.125-3.el5.i386.rpm --OK
rpm -ivh /media/CDROM/Server/elfutils-devel-static-0.125-3.el5.i386.rpm
rpm -ivh /media/CDROM/Server/elfutils-libelf-devel-static-0.125-3.el5.i386.rpm
rpm -ivh /media/CDROM/Server/elfutils-0.125-3.el5.i386.rpm --OK
rpm -ivh /media/CDROM/Server/elfutils-libelf-devel-0.125-3.el5.i386.rpm
--逐个安装:
[root@localhost SPECS]# rpm -ivh /media/CDROM/Server/elfutils-devel-0.125-3.el5.i386.rpm
error: Failed dependencies:
elfutils-devel-static = 0.125-3.el5 is needed by elfutils-devel-0.125-3.el5.i386
elfutils-libelf-devel = 0.125-3.el5 is needed by elfutils-devel-0.125-3.el5.i386
elfutils-libs = 0.125-3.el5 is needed by elfutils-devel-0.125-3.el5.i386
libdw.so.1 is needed by elfutils-devel-0.125-3.el5.i386
--1
[root@localhost SPECS]# rpm -ivh /media/CDROM/Server/elfutils-libs-0.125-3.el5.i386.rpm
Preparing... ########################################### [100%]
1:elfutils-libs ########################################### [100%]
--2
[root@localhost SPECS]# rpm -ivh /media/CDROM/Server/elfutils-libelf-0.125-3.el5.i386.rpm
Preparing... ########################################### [100%]
package elfutils-libelf-0.125-3.el5 is already installed
--3
[root@localhost SPECS]# rpm -ivh /media/CDROM/Server/elfutils-devel-static-0.125-3.el5.i386.rpm
error: Failed dependencies:
elfutils-devel = 0.125-3.el5 is needed by elfutils-devel-static-0.125-3.el5.i386
elfutils-libelf-devel-static = 0.125-3.el5 is needed by elfutils-devel-static-0.125-3.el5.i386
--4
[root@localhost SPECS]# rpm -ivh /media/CDROM/Server/elfutils-libelf-devel-static-0.125-3.el5.i386.rpm
error: Failed dependencies:
elfutils-libelf-devel = 0.125-3.el5 is needed by elfutils-libelf-devel-static-0.125-3.el5.i386
--5,我觉得这个是重要的了!
[root@localhost SPECS]# rpm -ivh /media/CDROM/Server/elfutils-0.125-3.el5.i386.rpm
Preparing... ########################################### [100%]
1:elfutils ########################################### [100%]
--6
[root@localhost SPECS]# rpm -ivh /media/CDROM/Server/elfutils-libelf-devel-0.125-3.el5.i386.rpm
error: Failed dependencies:
elfutils-libelf-devel-static = 0.125-3.el5 is needed by elfutils-libelf-devel-0.125-3.el5.i386
--安装成功3个……
--再安装rpm-build
[root@localhost SPECS]# find /media/CDROM -name "rpm-build*.rpm"
/media/CDROM/Server/rpm-build-4.4.2-37.el5.i386.rpm
[root@localhost SPECS]# rpm -ivh /media/CDROM/Server/rpm-build-4.4.2-37.el5.i386.rpm
Preparing... ########################################### [100%]
1:rpm-build ########################################### [100%]
[root@localhost SPECS]#
--居然就这样成功了……
--查询一下:
[root@localhost SPECS]# rpm -qa |grep rpm
rpm-4.4.2-37.el5
rpm-python-4.4.2-37.el5
rpm-libs-4.4.2-37.el5
rpm-build-4.4.2-37.el5
[root@localhost SPECS]# rpm -ql rpm-build |grep rpmbuild
/usr/bin/rpmbuild --命令已经生成!
/usr/share/man/man8/rpmbuild.8.gz
总结:
[root@localhost SPECS]# rpm -ivh /root/rpm-build-4.4.2-37.el5.i386.rpm
warning: /root/rpm-build-4.4.2-37.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
elfutils is needed by rpm-build-4.4.2-37.el5.i386
这里有两个错误:
1,NOKEY
--这是由于yum安装了旧版本的GPG keys造成的,解决办法就是:rpm --import /etc/pki/rpm-gpg/RPM*。再安装软件就不会有这个错误提示了。
2,elfutils
--这是需要安装依赖elfutils,请直接到安装盘上找到elfutils*.rpm,重新安装一下就好了。我觉得elfutils-0.125-3.el5.i386.rpm这个是最重要的了,但要安装这个也需要安装其他的包……
3,虽然可以用强制选项--force --nodeps来安装,但还是尽量不要这么做啊……
===
yum install rpm-build
yum list | grep elfutils
yum install elfutils......
[root@localhost SPECS]# yum list | grep elfutils
This system is not registered with RHN.
RHN support will be disabled.
No Repositories Available to Set Up
elfutils-libelf.i386 0.125-3.el5 installed
[root@localhost SPECS]# yum install rpm-build
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
No Repositories Available to Set Up
Reading repository metadata in from local files
Parsing package install arguments
Setting up repositories
No Repositories Available to Set Up
Reading repository metadata in from local files
No Match for argument: rpm-build
Nothing to do
[root@localhost SPECS]#
[root@localhost SPECS]# yum install elfutils
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
No Repositories Available to Set Up
Reading repository metadata in from local files
Parsing package install arguments
Setting up repositories
No Repositories Available to Set Up
Reading repository metadata in from local files
No Match for argument: elfutils
Nothing to do
[root@localhost SPECS]# rpm -qpR /root/rpm-build-4.4.2-37.el5.i386.rpm
/bin/bash
/bin/sh
/usr/bin/perl
elfutils
file
libbeecrypt.so.6
libbz2.so.1
libc.so.6
libc.so.6(GLIBC_2.0)
libc.so.6(GLIBC_2.1)
libc.so.6(GLIBC_2.2)
libc.so.6(GLIBC_2.3)
libc.so.6(GLIBC_2.3.4)
libc.so.6(GLIBC_2.4)
libdl.so.2
libelf.so.1
libm.so.6
libpopt.so.0
libpthread.so.0
libpthread.so.0(GLIBC_2.0)
librpm-4.4.so
librpmbuild-4.4.so
librpmdb-4.4.so
librpmio-4.4.so
librt.so.1
libselinux.so.1
libsqlite3.so.0
libz.so.1
patch >= 2.5
perl >= 0:5.006001
perl(File::Basename)
perl(Getopt::Long)
perl(strict)
rpm = 4.4.2-37.el5
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(VersionedDependencies) <= 3.0.3-1
rtld(GNU_HASH)