YUM
yum:Yellowdog Updater modified。
它是redhat和centos系统中shell软件包的一种前端管理器。它所管理的软件包为.rpm格式。它跟rpm相比,最大的好处就是解决了rpm程序安装的依赖关系,简化程序安装的过程。在一个能上网的环境下,可以直接安装我们想要的程序包,那是相当不错的。它的工作过程主要是通过用户指定的路径去某个指定的站点搜索自己想要的rpm包程序来安装和维护(站点包括:file(本地)、ftp、http、nfs、其他互联网站点)。
yum的优点:
解决rpm包安装时的依赖性;
方便添加、删除、更新rpm包;
可以同时批量安装rpm程序包;
更加方便程序安装后的维护;
yum服务的两种配置文件:主要是配合yum这个程序更好的工作,方便用户管理它。
1、/etc/yum.conf
主要针对yum服务的,具体内容如下:
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http:///set_project.php?project_id=19&ref=http:///bug_report_page.php?category=yum
distroverpkg=centos-release
[man]:主配置段,主要起标识作用;
cachedir:缓存目录。从站点上下载的程序包为了加速访问,需要指定一个本地缓存的地方;
keepcache:是否保存安装后的包和首部的缓存。默认为1,0代表否;
debuglevel:调试输出等级,1-10个级别,默认为2;
logfile:记录yum的日志文件;
exactarch:表示在升级程序的时候,符合硬件平台才升级,默认为1;
obsoletes:升级程序后,安装的包会被删除,默认为1;
gpgcheck:安装rpm程序包时,是否开启gpg检测,默认为0不检测,1为检测;
plugins:yum插件是否可用,默认为0,不可用;
installonly_limit:限制内核数量上限的,一般为5;
2、/etc/yum.repos.d/*repo (重要)
这是yum的源仓库的配置文件。有了程序的仓库,就不怕找不到想要的程序包了。
[base]
name=CentOS-$releasever - Base
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[*]:源仓库的名字,可随意写;
name:源仓库的描述信息,也可随意写;
baseurl:这个是仓库的具体路径,必须正确;
gpgcheck:这个是否开启gpg检测,1为开启,0为关闭;
gpgkey:这个是指定gpg检测时使用的key路径。使用前提是gpgcheck=1。/etc/pki/rpm-gpg 目录下存放的是key文件;
当我想要使用yum安装程序的时候,yum会首先搜索/etc/yum.repos.d/这个配置文件下的*.repo文件中仓库的baseurl路径,从而找到程序包,并缓存到本地。默认,系统携带CentOS-Base.repo、CentOS-fasttrack.repo、CentOS-Vault.repo、CentOS-Debuginfo.repo、CentOS-Media.repo 这么几个仓库配置文件。这些配置文件中包含的baseurl是互联网站点,因此,当我的linux主机能上Inter网,那么这些默认的配置文件就能派上用场了。 某些时候,我们无法上网,就需要在/etc/yum.repos.d/目录下面自己手动创建yum的源仓库了。
yum命令的内部执行过程:
打上yum命令之后,yum开始寻找本地仓库配置文件中指定给它的可用yum仓库地址;
把那些仓库中的各个元数据文件下载并缓存到本地,以便快速分析;
根据分析结果,查看当前系统上要安装的程序de依赖包安装到还剩多少没有安装;
统计还没有安装的依赖包,下载,并一起安装;
yum仓库的几种路径(baseurl=?)
ftp方式:ftp ://server-ip-address/path/to/repo;
http方式:http ://server-ip-address/path/to/repo;
nfs方式:nfs: //server-ip-address/path/to/repo;
本地方式:file: ///path/to/repo。(前两个//是协议分隔符);
yum客户端的工作:
存有yum的源仓库配置文件:指定各个可用的yum仓库地址,可以多个;
yum缓存元数据:yum回到各个可用yum仓库获取元数据,并缓存至本地。默认/var/cache/yum/目录下;
分析元数据:根据具体的操作请求,完成元数据分析,可能包括检查依赖关系、文件列表等;
执行具体操作;
yum源的搭建:
前提:yum在有网络的时候,是很好用的。但是,某些客观情况下,我们不能接入互联网络。怎么办?
通过光盘,使用rpm命令进行安装--安装过程繁杂,无法自行解决依赖关系;
自己手动搭建一个yum源仓库--部署过程繁杂,但是安装过程更简单;
yum源的组成部分:
yum仓库=rpm程序包+元数据(程序包索引)+md5校验值+gpgkey(可选)
yum源的搭建方式:
file:本地;
ftp:文件协议;
http:web;
yum仓库元数据和md5校验值的创建命令:createrepo
createrepo命令也是一个rpm程序,系统必须提前安装才行;
createrepo + rpm程序所在目录 (生成)===> 元数据(程序索引)和md5值; (关键)
搭建步骤:
一、使用本地访问的方式自定义搭建yum源仓库:
1、首先,我们得要搜集rpm包程序,(这里我们用centos系统光盘中的rpm包)把他们集中放在一个固定目录下,该目录就当作一个仓库根目录来使用了;
[root@localhost /]# mount /dev/cdrom /media/
mount: block device /dev/sr0 is write-protected, mounting read-only :把光盘挂到/media/下面;
[root@localhost /]#
[root@localhost /]# mkdir /yum/server -p :新建两个目录,作为仓库的根目录;
[root@localhost /]#
[root@localhost /]# cp /media/Packages/* /yum/server/ :把光盘中的rpm程序包都复制到根目录下面去;
[root@localhost /]# ls /yum/server/ | wc -l
4185 :复制完成之后,可以看到有4千多行了;
[root@localhost /]#
2、修改yum的服务端配置文件,关闭gpg检测;
vim /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=0 :修改yum的服务端配置文件,将gpg检测关掉;(此步骤也可在*.repo下去改)
3、安装createrepo程序,创建一个光盘yum源仓库
因为要安装createrepo这个程序才能创建源仓库的索引和md5校验值,因此,要么使用rpm,直接去光盘中找到对应的那个rpm包安装即可,要么把光盘制作成yum源仓库来进行安装。后者稍复杂,但解决了依赖关系,选后者额;
[root@localhost /]# vim /etc/yum.repos.d/test.repo :在本地自定义一个仓库配置文件,test.repo
gpgkey=ftp://172.16.16.11/pub/ftp-yum/RPM-GPG-KEY-CentOS-6
[test]
name=test
baseurl=file:///media/ :将仓库的路径写到本地的光盘挂载目录下面;
enabled=1 :开启此仓库;
gpgcheck=0 :关闭gpg校验。(本地路径一般不需要)
[root@localhost media]# ls
CentOS_BuildTag GPL Packages RPM-GPG-KEY-CentOS-6 RPM-GPG-KEY-CentOS-Testing-6
EFI p_w_picpaths RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Debug-6 TRANS.TBL
EULA isolinux repodata RPM-GPG-KEY-CentOS-Security-6
[root@localhost media]#
为什么我们要写到/media/目录呢?
因为系统光盘本身就是rpm包+元数据(程序包索引)+md5校验值+gpgkey 的组成,它符合yum仓库的要求,因此,只要把路径指到光盘目录即可;
“Packages ”:放rpm程序包;
“repodata”:里面存放的将就是createrepo命令创建的元数据+md5校验值了;
[root@localhost media]# cd repodata/
[root@localhost repodata]#
[root@localhost repodata]# ls
036dd72d77ba4abf25f5583b7973558f5f7a6bc90ee18be1f27a9d93072313f8-primary.sqlite.bz2
1449a8ec2555257108f11679628d0f70e57031a4be8adc73456443a0462a1b65-primary.xml.gz
3dd75f6c0394f9a55bd6d15102dc023d27c057c99182cca8b0d3c8f71912fc62-filelists.sqlite.bz2
460862ca0e99160b41eecc41b944eb2abc0b82609bd12407bc5609922627eac4-c6-x86_64-comps.xml.gz
7fe6caf79ef1ada2e8f84ad92cd6568ac508d38d3c31dba907832ba7058ebb77-filelists.xml.gz
99b1dfe7d6129ba0fe7c019459b4a8594b74c5d3dacae9511afda520f6912660-other.xml.gz
9a5c649c5eb8b0b1365aa19954766d0ea80ee59b701b41a555792443456557f3-other.sqlite.bz2
9e2ddcc42b44eb150ebc61dde29c997318d8330b92205b3dbb3a87bcc06d10be-c6-x86_64-comps.xml
repomd.xml
TRANS.TBL
“repomd.xml”:就是rpm包的索引。其他红色部分就是rpm包的md5值了;
4、repo配置文件指定好之后,开始验证光盘仓库是否能正常工作;
[root@localhost /]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
repo id repo name status
test test 4,184
repolist: 4,184
[root@localhost /]#
:显示了4184个rpm程序包,说明光盘仓库搭建完成了;
5、 现在利用yum,来安装createrepo程序:
[root@localhost /]# yum install createrepo
6、利用createrepo命令和程序包来创建元数据和md5校验;
[root@CentOS6 ~]# createrepo /yum/server/
Spawning worker 0 with 4184 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete :提示成功了;
[root@CentOS6 ~]#
7、修改本地仓库配置文件,让它指到我们自定义的仓库路径下:
[root@localhost /]# vim /etc/yum.repos.d/test.repo
[test] :此处注意,不可跟系统中其他仓库名有冲突,不然无效;
name=test
baseurl=file:///yum/server/
enabled=1
gpgcheck=0 完成。
8、装包验证:
[root@CentOS6 ~]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
test | 2.9 kB 00:00 ...
test/primary_db | 3.4 MB 00:00 ...
repo id repo name status
test createrepo 4,184
repolist: 4,184
[root@CentOS6 ~]# :test.repo里的仓库路径被识别了!
[root@CentOS6 ~]# yum list available | less
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Available Packages
389-ds-base.x86_64 1.2.11.15-46.el6 test
389-ds-base-libs.i686 1.2.11.15-46.el6 test
389-ds-base-libs.x86_64 1.2.11.15-46.el6 test
DeviceKit-power.i686 014-3.el6 test
ElectricFence.i686 2.2.2-28.el6 test
ElectricFence.x86_64 2.2.2-28.el6 test
分页显示yum仓库中没有被安装的程序包;
[root@CentOS6 ~]# yum install xsettings-kde
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package xsettings-kde.x86_64 0:0.11-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================
Package Arch Version Repository Size
==================================================================================================================
Installing:
xsettings-kde x86_64 0.11-1.el6 test 23 k
Transaction Summary
==================================================================================================================
Install 1 Package(s)
Total download size: 23 k
Installed size: 47 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : xsettings-kde-0.11-1.el6.x86_64 1/1
Verifying : xsettings-kde-0.11-1.el6.x86_64 1/1
Installed:
xsettings-kde.x86_64 0:0.11-1.el6
Complete!
[root@CentOS6 ~]# 测试一个,安装成功,本地源仓库就搭建完毕了;
二、使用ftp访问的方式自定义搭建yum源仓库:
当公司使用一台ftp服务器,集中管理rpm程序的时候,ftp作为yum源仓库就是很好的选择了;
1、使用rpm,在光盘中找到vsftpd程序,并安装、开启ftp服务;
[root@localhost Packages]# rpm -ivh vsftpd-2.2.2-12.el6_5.1.x86_64.rpm
Preparing... ########################################### [100%]
1:vsftpd ########################################### [100%]
[root@localhost Packages]#
[root@localhost Packages]# service vsftpd start
[root@localhost Packages]# netstat -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
2、配置ftp。在ftp根目录下面自定义一个目录,将yum源仓库放到ftp根目录下面。
[root@localhost /]# mkdir /var/ftp/pub/yum
[root@localhost /]# cp -r /media/Packages/* /var/ftp/pub/yum/
[root@localhost /]#
3、创建源仓库的程序元数据和md5值
[root@CentOS6 ~]# createrepo /var/ftp/pub/ftp-yum/
Spawning worker 0 with 4184 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
4、修改本地yum仓库路径:
[root@CentOS6 ~]# vim /etc/yum.repos.d/test.repo
[test]
name=createrepo
baseurl=ftp://172.16.16.11/pub/ftp-yum/
enable=1
#gpgcheck=1
#gpgkey=ftp://172.16.16.11/pub/ftp-yum/RPM-GPG-KEY-CentOS-6
5、验证:
[root@CentOS6 ~]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
test | 2.9 kB 00:00
test/primary_db | 3.4 MB 00:00
repo id repo name status
test createrepo 4,184
repolist: 4,184
[root@CentOS6 ~]#
[root@CentOS6 ~]# yum install qperf
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package qperf.x86_64 0:0.4.9-1.el6 will be installed
--> Processing Dependency: .1(RDMACM_1.0)(64bit) for package: qperf-0.4.9-1.el6.x86_64
--> Processing Dependency: .1(IBVERBS_1.1)(64bit) for package: qperf-0.4.9-1.el6.x86_64
--> Processing Dependency: .1(IBVERBS_1.0)(64bit) for package: qperf-0.4.9-1.el6.x86_64
--> Processing Dependency: .1()(64bit) for package: qperf-0.4.9-1.el6.x86_64
--> Processing Dependency: .1()(64bit) for package: qperf-0.4.9-1.el6.x86_64
--> Running transaction check
---> Package libibverbs.x86_64 0:1.1.8-3.el6 will be installed
---> Package librdmacm.x86_64 0:1.0.18.1-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================
Package Arch Version Repository Size
==================================================================================================================
Installing:
qperf x86_64 0.4.9-1.el6 test 55 k
Installing for dependencies:
libibverbs x86_64 1.1.8-3.el6 test 52 k
librdmacm x86_64 1.0.18.1-1.el6 test 57 k
Transaction Summary
==================================================================================================================
Install 3 Package(s)
Total download size: 165 k
Installed size: 386 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): libibverbs-1.1.8-3.el6.x86_64.rpm | 52 kB 00:00
(2/3): librdmacm-1.0.18.1-1.el6.x86_64.rpm | 57 kB 00:00
(3/3): qperf-0.4.9-1.el6.x86_64.rpm | 55 kB 00:00
------------------------------------------------------------------------------------------------------------------
Total 1.6 MB/s | 165 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libibverbs-1.1.8-3.el6.x86_64 1/3
Installing : librdmacm-1.0.18.1-1.el6.x86_64 2/3
Installing : qperf-0.4.9-1.el6.x86_64 3/3
Verifying : librdmacm-1.0.18.1-1.el6.x86_64 1/3
Verifying : qperf-0.4.9-1.el6.x86_64 2/3
Verifying : libibverbs-1.1.8-3.el6.x86_64 3/3
Installed:
qperf.x86_64 0:0.4.9-1.el6
Dependency Installed:
libibverbs.x86_64 0:1.1.8-3.el6 librdmacm.x86_64 0:1.0.18.1-1.el6
Complete!
[root@CentOS6 ~]# 结束;
三、使用http访问的方式自定义搭建yum源仓库:
http方式的yum源仓库主要为一些开源组织或软件开发商等使用,主要放在外网站点。如果放在内部使用,建议还是ftp效率更高一点。
1、需要安装httpd程序,以提供http功能,默认系统基本都会安装好,如没有安装,就需要自行安装了。
[root@CentOS6 Packages]# rpm -ivh httpd-2.2.15-39.el6.centos.x86_64.rpm
warning: httpd-2.2.15-39.el6.centos.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
package httpd-2.2.15-39.el6.centos.x86_64 is already installed
[root@CentOS6 Packages]#
我这因为安装过,所以提示已安装。
2、安装好http服务之后,当我远程http://主机ip时,会默认访问http的根目录。因此,在此为了测试,我们在http的根目录下创建一个空目录,并制作成仓库目录:(默认访问http时,访问的就是http服务端下的,/var/www/html/)
[root@localhost ~]# mkdir /var/www/html/yum
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# ls /var/www/html/
yum
[root@localhost ~]#
[root@localhost ~]# cp /media/Packages/* /var/www/html/yum/
[root@localhost ~]#
[root@localhost ~]# ls /var/www/html/yum/ | wc -l
4185
[root@localhost ~]#
[root@CentOS6 /]# service httpd start
Starting httpd:
[root@CentOS6 /]#
[root@CentOS6 /]#
[root@CentOS6 /]# netstat -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:55031 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 :::49141 :::* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:631 :::* LISTEN
tcp 0 0 :::111 :::* LISTEN
tcp 0 0 :::80 :::* LISTEN
[root@CentOS6 /]#
3、准备好rpm包和要创建目录之后,使用createrepo命令生成rpm包的元数据索引和md5校验值。
[root@localhost ~]# createrepo /var/www/html/yum/
Spawning worker 0 with 4184 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@localhost ~]#
4、http服务端的yum源配置完成了。接下来该去客户端上修改yum仓库配置文件了。(注意服务端防火墙配置)
[root@CentOS6 /]# vim /etc/yum.repos.d/
aa/ test.repo
[root@CentOS6 /]# vim /etc/yum.repos.d/test.repo
[test]
name=test
baseurl=http://1.1.1.2/yum/ :注意,只要写到/yum/即可,前面ip对应的就是/var/www/html/;
gpgcheck=0
5、安装检测:
[root@CentOS6 /]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
repo id repo name status
test test 4,184
repolist: 4,184
[root@CentOS6 /]# yum list available | less
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Available Packages
389-ds-base.x86_64 1.2.11.15-46.el6 test
389-ds-base-libs.i686 1.2.11.15-46.el6 test
389-ds-base-libs.x86_64 1.2.11.15-46.el6 test
DeviceKit-power.i686 014-3.el6 test
ElectricFence.i686 2.2.2-28.el6 test
ElectricFence.x86_64 2.2.2-28.el6 test
GConf2.i686 2.28.0-6.el6 test
GConf2-devel.i686 2.28.0-6.el6 test
GConf2-devel.x86_64 2.28.0-6.el6 test
ImageMagick.i686 6.5.4.7-7.el6_5 test
ImageMagick.x86_64 6.5.4.7-7.el6_5 test
ImageMagick-c++.x86_64 6.5.4.7-7.el6_5 test
MySQL-python.x86_64 1.2.3-0.3.c1.1.el6 test
NetworkManager-glib.i686 1:0.8.1-75.el6 test
NetworkManager-openswan.x86_64 0.8.0-8.el6 test
ORBit2.i686 2.14.17-5.el6 test
ORBit2-devel.i686 2.14.17-5.el6 test
ORBit2-devel.x86_64 2.14.17-5.el6 test
OpenEXR-libs.i686 1.6.1-8.1.el6 test
OpenEXR-libs.x86_64 1.6.1-8.1.el6 test
OpenIPMI.x86_64 2.0.16-14.el6 test
OpenIPMI-libs.i686 2.0.16-14.el6 test
[root@CentOS6 /]# yum install yajl
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package yajl.x86_64 0:1.0.7-3.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================
Package Arch Version Repository Size
========================================================================================
Installing:
yajl x86_64 1.0.7-3.el6 test 27 k
Transaction Summary
========================================================================================
Install 1 Package(s)
Total download size: 27 k
Installed size: 89 k
Is this ok [y/N]: y
Downloading Packages:
yajl-1.0.7-3.el6.x86_64.rpm | 27 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : yajl-1.0.7-3.el6.x86_64 1/1
Verifying : yajl-1.0.7-3.el6.x86_64 1/1
Installed:
yajl.x86_64 0:1.0.7-3.el6
Complete!
[root@CentOS6 /]# 结束。
另外,关于完整性校验key的实验如下:
我们拿http作为yum源仓库,来进行示范。
1、现在我们安装好了yum源,并且能正常提供服务了。现在客户端仓库配置文件中,我们打开gpg检测,即,gpgcheck=1;
[root@CentOS6 /]# vim /etc/yum.repos.d/test.repo
[test]
name=test
baseurl=http://1.1.1.2/yum :yum仓库路径;
enabled=1
gpgcheck=1
gpgkey=http://1.1.1.2/yum/RPM-GPG-KEY-CentOS-6 :yum的gpgkey绝对路径。一定要绝对路径!!;
2、验证,当yum源仓库真的没有key的情况下,客户端开启gpg完整性校验会出现什么现象:
[root@CentOS6 /]# yum reinstall yajl
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Reinstall Process
Determining fastest mirrors
test | 2.9 kB 00:00
test/primary_db | 3.4 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package yajl.x86_64 0:1.0.7-3.el6 will be reinstalled
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================
Package Arch Version Repository Size
========================================================================================
Reinstalling:
yajl x86_64 1.0.7-3.el6 test 27 k
Transaction Summary
========================================================================================
Reinstall 1 Package(s)
Total download size: 27 k
Installed size: 89 k
Is this ok [y/N]: y
Downloading Packages:
yajl-1.0.7-3.el6.x86_64.rpm | 27 kB 00:00
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Retrieving key from http://1.1.1.2/http-yum
Invalid GPG Key from http://1.1.1.2/http-yum: No key found in given key data
当我安装程序包时,提示没有key,无法完成校验,不能安装!!
3、此时,我们在yum源服务端,将key复制到源仓库目录下,再次安装程序看看会出现什么:
[root@localhost ~]# ls /etc/pki/rpm-gpg/ :存放系统gpgkey的目录
RPM-GPG-KEY-CentOS-6 RPM-GPG-KEY-CentOS-Security-6
RPM-GPG-KEY-CentOS-Debug-6 RPM-GPG-KEY-CentOS-Testing-6
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# cp /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 /var/www/html/yum/
[root@localhost ~]#
[root@CentOS6 /]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning repos: test
Cleaning up Everything
[root@CentOS6 /]#
[root@CentOS6 /]#
[root@CentOS6 /]#
[root@CentOS6 /]#
[root@CentOS6 /]# yum -y reinstall yajl
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Reinstall Process
Determining fastest mirrors
test | 2.9 kB 00:00
test/primary_db | 3.4 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package yajl.x86_64 0:1.0.7-3.el6 will be reinstalled
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================
Package Arch Version Repository Size
========================================================================================
Reinstalling:
yajl x86_64 1.0.7-3.el6 test 27 k
Transaction Summary
========================================================================================
Reinstall 1 Package(s)
Total download size: 27 k
Installed size: 89 k
Downloading Packages:
yajl-1.0.7-3.el6.x86_64.rpm | 27 kB 00:00
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Retrieving key from http://1.1.1.2/http-yum/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid: "CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>"
From : http://1.1.1.2/yum/RPM-GPG-KEY-CentOS-6 :(提示使用哪里的key进行的完整性校验 )
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : yajl-1.0.7-3.el6.x86_64 1/1
Verifying : yajl-1.0.7-3.el6.x86_64 1/1
Installed:
yajl.x86_64 0:1.0.7-3.el6
Complete!
[root@CentOS6 /]# ok,搞定了!!
















