一、rpm是什么

RPM 是RPM Package Manager(RPM软件包管理器)的缩写,这一文件格式名称虽然打上了RedHat的标志,但是其原始设计理念是开放式的。RPM包管理器(RPM)是一个强大的命令行驱动的包管理系统能够安装、卸载、验证、查询和更新计算机软件包。每个软件包包括存档的文件连同包和它的版本信息,描述等。还有一个库API,允许高级开发人员来管理

二、程序的组成部分

程序的组成部分:

编译之前:源代码

编译文件:

二进制程序

库文件

配置文件

帮助文件(手册、文档)

二进制程序:/bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin, /opt/bin, /opt/sbin

库文件:/lib, /lib64, /usr/lib, /usr/lib64, /usr/local/lib, /usr/local/lib64

配置文件:/etc, /etc/DIR, /usr/local/{etc,conf}

帮助文件:/usr/share/man, /usr/share/doc, /usr/local/share/man

注意:有些特殊的应用程序可能会将可执行文件放置在libexec目录;

三、rpm包命名格式:

rpm包命名格式:

appname-VERSION-RELEASE.ARCH.rpm

VERSION:

major:主版本号

minor:此版本号

release:发行号

RELEASE:包自身的修订号:有时候还会包含适用于os信息:比如bash-4.3.2-2.centos.x86_64.rpm

ARCH:适用的平台

x86:i386,i486,i586,i686

x86_64,adm64:x86 64bits

powerpc:ppc

noarch:跟平台无关

四、分包机制

想象一种场景:testapp有30种功能,其中有10种常用,有6次常用,余下的14种极少用;所以rpm包制作者会把一个程序的每个功能制作成一个rpm包,他们都依赖主包。

例如:

核心包,主包:命名与原项目名称一致;

bash-4.3.2-2.centos6.x86_64.rpm

子包(支包):命令为源项目名称后附加分支包中的文件提供的功能组成;

bash-devel-4.3.2-2.centos6.x86_64.rpm

程序包的获取路径:

1、系统的发行光盘镜像或官方站点(或站点镜像服务器)

挂载光盘:

mount -r /dev/cdrom /media/cdrom

官方站点,镜像:

mirrors.sohu.com

mirrors.163.com

mirrors.aliyun.com

2、程序包的官方站点

3、第三方组织:epel

4、搜索引擎

http://rpmfind.net

http://rpm.pbone.net

http://pkgs.org

建议:安装之前要验正的其合法性

来源合法

包的完整性

五、centos系统上的程序rpm包管理

安装、升级、卸载、查询、校验

5.1 安装

rpm {-i|--install} [install-options] PACKAGE_FILE1..
    -i:安装

# rpm -i zsh-4.3.10-7.el6.x86_64.rpm
# rpm -q zsh                    #rpm -q为查询次包是否安装,在后面的查询中会讲到。
zsh-4.3.10-7.el6.x86_64

-h:hash, 以#来表示安装进度

# rpm -ih zsh-4.3.10-7.el6.x86_64.rpm
########################################### [100%]
########################################### [100%]

-v,--verbose:显示安装过程中的详细信息

# rpm -ivh zsh-4.3.10-7.el6.x86_64.rpm
Preparing...                ########################################### [100%]1:zsh                    ########################################### [100%]

-vv:显示更多的详细信息

# rpm -ivvh zsh-4.3.10-7.el6.x86_64.rpm

安装时常用的组合:-ivh,-ivvh

--test:不执行真正的安装过程,而仅报告依赖关系及冲突

# rpm -ivh --test zsh-4.3.10-7.el6.x86_64.rpm
Preparing...                ########################################### [100%]

程序包之间存在依赖关系

由众多目的单一的小程序组成:结果程序包之间存在相关性;

--nodeps:忽略依赖关系:副作用:安装成功,但未必能够成功运行

# rpm -ivh php-5.3.3-38.el6.x86_64.rpm
error: Failed dependencies:php-cli(x86-64) = 5.3.3-38.el6 is needed by php-5.3.3-38.el6.x86_64php-common(x86-64) = 5.3.3-38.el6 is needed by php-5.3.3-38.el6.x86_64
# rpm -ivh --nodeps php-5.3.3-38.el6.x86_64.rpm
Preparing...                ########################################### [100%]1:php                    ########################################### [100%]

--replacepkgs:覆盖安装:重新安装并覆盖原有的文件

# rpm -ivh zsh-4.3.10-7.el6.x86_64.rpm
Preparing...                ########################################### [100%]package zsh-4.3.10-7.el6.x86_64 is already installed
# rpm -ivh --replacepkgs zsh-4.3.10-7.el6.x86_64.rpm
Preparing...                ########################################### [100%]1:zsh                    ########################################### [100%]

--force:强制安装

# rpm -ivh zsh-4.3.10-7.el6.x86_64.rpm
Preparing...                ########################################### [100%]package zsh-4.3.10-7.el6.x86_64 is already installed
# rpm -ivh --force zsh-4.3.10-7.el6.x86_64.rpm
Preparing...                ########################################### [100%]1:zsh                    ########################################### [100%]

5.2 升级

-U:升级或安装

# rpm -q zsh
zsh-4.3.10-7.el6.x86_64
# rpm -Uvh --nodeps zsh-5.1.1-3.fc24.x86_64.rpm
warning: zsh-5.1.1-3.fc24.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 81b46521: NOKEY
Preparing...                ########################################### [100%]1:zsh                    ########################################### [100%]
# 此处使用--nodeps的原因是这个版本需要很多依赖关系,所以忽略依赖关系,在生产环境中升级需要安装依赖关系后在升级。

-F:升级

组合:-Uvh,-Fvh

--test

--nodeps

--force

--oldpackage:降级到旧版本;

# rpm -q zsh
zsh-5.1.1-3.fc24.x86_64
# rpm -Uvh --oldpackage /misc/cd/Packages/zsh-4.3.10-7.el6.x86_64.rpm
Preparing...                ########################################### [100%]1:zsh                    ########################################### [100%]
# rpm -q zsh
zsh-4.3.10-7.el6.x86_64

注意:一定不要对内核升级:Linux允许多内核共存,所以可以直接安装多个不同版本内核;

注意:如果程序包的配置文件安装后曾被修改,升级时,新版本的文件不会覆盖老版本的配置文件,而把新版本的配置文件重命名(加后缀.rpmnew)后保存

5.3 卸载

rpm {-e|--erase} [--allmatches] [--nodeps] [--test]

简单用法:rpm -e PACKAGE_NAME...

# rpm -q zsh
zsh-4.3.10-7.el6.x86_64
# rpm -e zsh
# rpm -q zsh
package zsh is not installed

--nodeps:忽略依赖关系;

--test: 测试卸载;dry-run模式;

--allmatches: 如果一个程序包同时安装多个版本,则此选项一次全部卸载之;

注意:如果程序包的配置文件安装后曾被修改,卸载时,此文件通常不会被删除,而是被重命名(加后缀.rpmsave)后留存;

5.4 查询

rpm {-q|--query} [select-options] [query-options]

[select-options]

1、查询某包或某些包是否安装:

rpm -q PACKAGE_NAME

# rpm -q zsh
zsh-5.1.1-3.fc24.x86_64

2、查询已经安装的所有包

rpm -qa PACKAGE_NAME

# rpm -qa zsh
zsh-5.1.1-3.fc24.x86_64
# 或者,grep后面支持正则表达式过滤
# rpm -qa |grep "zhs"

3、查询某文件是由哪个包安装生成:

rpm -qf /PATH/TO/SOMEFILE

# rpm -qf /etc/fstab
setup-2.8.14-20.el6_4.1.noarch
# rpm -qf /etc/httpd/conf/httpd.conf
httpd-2.2.15-39.el6.centos.x86_64

4、查询尚未安装的包文件的相关信息

-p

# rpm -qpi PACKAGE_NAME

# rpm -qpi gcc-4.4.7-11.el6.x86_64.rpm
Name        : gcc                          Relocations: (not relocatable)
Version     : 4.4.7                             Vendor: CentOS
Release     : 11.el6                        Build Date: 2014年10月15日 星期三 08时24分47秒
Install Date: (not installed)               Build Host: c6b9.bsys.dev.centos.org
Group       : Development/Languages         Source RPM: gcc-4.4.7-11.el6.src.rpm
Size        : 19495803                         License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions
Signature   : RSA/SHA1, 2014年10月18日 星期六 04时02分58秒, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem <http://bugs.centos.org>
URL         : http://gcc.gnu.org
Summary     : Various compilers (C, C++, Objective-C, Java, ...)
Description :
The gcc package contains the GNU Compiler Collection version 4.4.
You'll need this package in order to compile C code.

[query-options]:

1、查询某包的简要说明信息:

rpm -qi PACKAGE_NAME

# rpm -qi zsh
Name        : zsh                          Relocations: (not relocatable)
Version     : 5.1.1                             Vendor: Fedora Project
Release     : 3.fc24                        Build Date: 2015年11月05日 星期四 21时41分02秒
Install Date: 2015年11月19日 星期四 15时20分55秒      Build Host: buildvm-26.phx2.fedoraproject.org
Group       : System Environment/Shells     Source RPM: zsh-5.1.1-3.fc24.src.rpm
Size        : 6474662                          License: MIT
Signature   : RSA/8, 2015年11月05日 星期四 21时56分22秒, Key ID 73bde98381b46521
Packager    : Fedora Project
URL         : http://zsh.sourceforge.net/
Summary     : Powerful interactive shell
Description :
The zsh shell is a command interpreter usable as an interactive login
shell and as a shell script command processor.  Zsh resembles the ksh
shell (the Korn shell), but includes many enhancements.  Zsh supports
command line editing, built-in spelling correction, programmable
command completion, shell functions (with autoloading), a history
mechanism, and more.

2、查询某包安装后生成了哪些文件列表;

rpm -ql PACKAGE_NAME

# rpm -ql zsh|less/etc/skel/.zshrc
/etc/zlogin
/etc/zlogout
/etc/zprofile
/etc/zshenv
/etc/zshrc
/usr/bin/zsh
/usr/lib64/zsh
/usr/lib64/zsh/5.1.1
/usr/lib64/zsh/5.1.1/zsh
/usr/lib64/zsh/5.1.1/zsh/attr.so
/usr/lib64/zsh/5.1.1/zsh/cap.so
......

3、查询某包安装后生成的配置文件路径

rpm -qc PACKAGE_NAME

# rpm -qc zsh
/etc/skel/.zshrc
/etc/zlogin
/etc/zlogout
/etc/zprofile
/etc/zshenv
/etc/zshrc

4、查询某包安装后生成的所有帮助文件

rpm -qd PACKAGE_NAME

# rpm -qd zsh
/usr/share/doc/zsh/BUGS
/usr/share/doc/zsh/CONTRIBUTORS
/usr/share/doc/zsh/FAQ
/usr/share/doc/zsh/FEATURES
/usr/share/doc/zsh/LICENCE
/usr/share/doc/zsh/MACHINES
/usr/share/doc/zsh/NEWS
/usr/share/doc/zsh/README
/usr/share/doc/zsh/completion-style-guide
/usr/share/doc/zsh/zsh-development-guide
/usr/share/doc/zsh/zshprompt.pl
/usr/share/info/zsh.info-1.gz
/usr/share/info/zsh.info-2.gz
/usr/share/info/zsh.info-3.gz
/usr/share/info/zsh.info-4.gz
/usr/share/info/zsh.info-5.gz
....

5、查看某包制作时随版本变化的changelog信息;

rpm-q --changelog PACKAGE_NAME

# rpm -q --changelog zsh
* 四 11月 05 2015 Kamil Dudka <kdudka@redhat.com> - 5.1.1-3
- make loading of module's dependencies work again (#1277996)* 四 10月 08 2015 Kamil Dudka <kdudka@redhat.com> - 5.1.1-2
- fix crash in ksh mode with -n and $HOME (#1269883)* 一 9月 14 2015 Kamil Dudka <kdudka@redhat.com> - 5.1.1-1
- Update to latest upstream release: Zsh 5.1.1* 一 8月 31 2015 Kamil Dudka <kdudka@redhat.com> - 5.1-1
- Update to latest upstream release: Zsh 5.1
- remove outdated workarounds in %check* 四 7月 30 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.8-6
- fix handling of command substitution in math context* 三 7月 22 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.8-5
- prevent infinite recursion in ihungetc() (#1245712)* 二 7月 07 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.8-4
- backport completion for dnf (#1239337)* 四 7月 02 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.8-3
- backport completion-related upstream fixes (#1238544)* 五 6月 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.0.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild* 三 6月 03 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.8-1
- Update to latest upstream release: Zsh 5.0.8* 五 5月 22 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.7-8
- fix SIGSEGV of the syntax check in ksh emulation mode (#1222867)* 一 4月 20 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.7-7
- fix SIGSEGV when handling heredocs and keyboard interrupt (#972624)
- queue signals when manipulating global state to avoid deadlock* 日 1月 25 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.7-6
- use correct allocation function in the new 'cd' code (#1183238)* 五 1月 23 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.7-5
- suppress a warning about closing an already closed file descriptor (#1184002)
- improve handling of NULL in the 'cd' built-in (#1183238)* 三 11月 19 2014 Kamil Dudka <kdudka@redhat.com> - 5.0.7-4
- update documentation of POSIX_JOBS in the zshoptions.1 man page (#1162198)* 二 11月 18 2014 Kamil Dudka <kdudka@redhat.com> - 5.0.7-3
- replace an incorrect comment in /etc/zshenv (#1164313)* 一 11月 10 2014 Kamil Dudka <kdudka@redhat.com> - 5.0.7-2
- make the wait built-in work for already exited processes (#1162198)* 三 10月 08 2014 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.7-1
- Update to latest upstream release: Zsh 5.0.7* 四 8月 28 2014 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.6-1
- Update to latest upstream release: Zsh 5.0.6* 一 8月 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.0.5-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild* 四 7月 17 2014 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.5-7
- apply upstream patch which fixes CPU load issue (RHBZ#1120424)* 三 7月 09 2014 Adam Jackson <ajax@redhat.com> 5.0.5-6
- Fix missing 'fi' in %post* 四 7月 03 2014 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.5-5
- improve handling of /etc/shells* 三 7月 02 2014 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.5-4
- fix FTBFS issue (RHBZ#1106713)
- remove individual _bindir setting; install to /usr/bin/ (RHBZ#1034060)
- require info package instead of /sbin/install-info binary* 六 6月 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild* 二 4月 08 2014 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.5-1
- Update to latest upstream release: Zsh 5.0.5* 四 1月 16 2014 James Antill <james@fedoraproject.org> - 5.0.2-8
- Remove unneeded build require on tetex.* 六 10月 26 2013 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.2-7
- Require hostname package instead of /bin/hostname* 二 10月 22 2013 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.2-6
- remove systemd completion, it delivers it's own now (RHBZ#1022039)* 四 8月 01 2013 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.2-5
- update systemd completion (adds machinectl command)* 二 6月 25 2013 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.2-4
- up-to-date systemd completion (#949003)
- apply patch for building for aarch64 (#926864)* 一 4月 15 2013 James Antill <james@fedoraproject.org> - 5.0.2-3
- Fix the changelog dates.
- Fix the texi itemx bug.
- Resolves: bug#927863* 五 2月 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild* 二 1月 08 2013 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.2-1
- Update to new upstream version: Zsh 5.0.2* 三 11月 21 2012 Dominic Hopf <dmaphy@fedoraproject.org> - 5.0.0-1
- Update to new upstream version: Zsh 5.0.0* 日 7月 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.3.17-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild* 日 3月 04 2012 Dominic Hopf <dmaphy@fedoraproject.org> - 4.3.17-1
- Update to new upstream version: Zsh 4.3.17* 六 1月 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.3.15-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild* 六 12月 24 2011 Dominic Hopf <dmaphy@fedoraproject.org> - 4.3.15-1
- Update to new upstream version: Zsh 4.3.15* 六 12月 17 2011 Dominic Hopf <dmaphy@fedoraproject.org> - 4.3.14-2
- change the License field to MIT (RHBZ#768548)* 六 12月 10 2011 Dominic Hopf <dmaphy@fedoraproject.org> - 4.3.14-1
- Update to new upstream version: Zsh 4.3.14* 六 12月 03 2011 Dominic Hopf <dmaphy@fedoraproject.org> - 4.3.13-1
- Update to new upstream version: Zsh 4.3.13* 六 8月 13 2011 Dominic Hopf <dmaphy@fedoraproject.org> - 4.3.12-1
- Update to new upstream version: Zsh 4.3.12* 二 2月 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.3.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild* 四 1月 20 2011 Christopher Ailon <caillon@redhat.com> - 4.3.11-1
- Rebase to upstream version 4.3.11* 二 12月 07 2010 Toshio Kuratomi <toshio@fedoraproject.org> - 4.3.10-6
- Rebuild for FTBFS https://bugzilla.redhat.com/show_bug.cgi?id=631197
- Remove deprecated PreReq, the packages aren't needed at runtime and they'realready in Requires(post,preun,etc): lines.* 一 3月 22 2010 James Antill <james@fedoraproject.org> - 4.3.10-5
- Add pathmunge to our /etc/zshrc, for profile.d compat.
- Resolves: bug#548960* 五 8月 07 2009 James Antill <james@fedoraproject.org> - 4.3.10-4
- Allow --excludedocs command to work!
- Resolves: bug#515986* 一 7月 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.3.10-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild* 一 7月 20 2009 James Antill <james@fedoraproject.org> - 4.3.10-1
- Import new upstream 4.3.10* 三 6月 10 2009 Karsten Hopp <karsten@redhat.com> 4.3.9-4.1
- skip D02glob test on s390, too* 一 3月 02 2009 James Antill <james@fedoraproject.org> - 4.3.9-4
- Remove D02glob testcase on ppc/ppc64, and hope noone cares* 三 2月 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.3.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

6、查询某包提供的capabilities;

rpm -q --provides PACKAGE_NAME;

# rpm -q --provides zsh
/bin/zsh
config(zsh) = 5.1.1-3.fc24
zsh = 5.1.1-3.fc24
zsh(x86-64) = 5.1.1-3.fc24

7、查询某包所依赖的capabilities;

rpm -q --requires PACKAGE_NAME

# rpm -q --requires zsh
/bin/sh
/bin/sh
/bin/sh
/bin/sh
/bin/zsh
config(zsh) = 5.1.1-3.fc24
coreutils
grep
grep
info
info
libc.so.6()(64bit)
libc.so.6(GLIBC_2.11)(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.15)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libc.so.6(GLIBC_2.7)(64bit)
libdl.so.2()(64bit)
libdl.so.2(GLIBC_2.2.5)(64bit)
libm.so.6()(64bit)
libm.so.6(GLIBC_2.2.5)(64bit)
libncursesw.so.6()(64bit)
librt.so.1()(64bit)
librt.so.1(GLIBC_2.2.5)(64bit)
libtinfo.so.6()(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
rtld(GNU_HASH)

8、查询某包安装或卸载时执行脚本;

rpm -q --scripts PACKAGE_NAME

# rpm -q --scripts zsh
\postinstall scriptlet (using /bin/sh):
if [ "$1" = 1 ]; thenif [ ! -f /etc/shells ] ; thenecho "/usr/bin/zsh" > /etc/shellsecho "/bin/zsh" >> /etc/shellselsegrep -q "^/usr/bin/zsh$" /etc/shells || echo "/usr/bin/zsh" >> /etc/shellsgrep -q "^/bin/zsh$" /etc/shells || echo "/bin/zsh" >> /etc/shellsfi
fiif [ -f /usr/share/info/zsh.info.gz ]; then
# This is needed so that --excludedocs works.
/sbin/install-info /usr/share/info/zsh.info.gz /usr/share/info/dir \--entry="* zsh: (zsh).            An enhanced bourne shell."
fi
preuninstall scriptlet (using /bin/sh):
if [ "$1" = 0 ] ; thenif [ -f /usr/share/info/zsh.info.gz ]; then# This is needed so that --excludedocs works./sbin/install-info --delete /usr/share/info/zsh.info.gz /usr/share/info/dir \--entry="* zsh: (zsh).          An enhanced bourne shell."fi
fi
postuninstall scriptlet (using /bin/sh):
if [ "$1" = 0 ] && [ -f /etc/shells ] ; thensed -i '\!^/usr/bin/zsh$!d' /etc/shellssed -i '\!^/bin/zsh$!d' /etc/shells
fi

脚本有四类:

preinstall:安装过程开始之前执行的脚本;

postinstall:安装过程后执行的脚本;

preuninstall:卸载前执行的脚本;

postuninstall:卸载过程完成之后执行的脚本;

5.5 校验

查询包安装之后生成的文件是否发生了改变

rpm {-V|--verify} [select-options] [verify-options]

# rpm -V zsh
S.5....T.  c /etc/zshrc

常见用法:rpm -V PACKAGE_NAME

S file Size differs

M Mode differs (includes permissions and file type)

5 digest (formerly MD5 sum) differs

D Device major/minor number mismatch

L readLink(2) path mismatch

U User ownership differs

G Group ownership differs

T mTime differs

P caPabilities differ

程序包的合法性验正:

来源合法:

由我们信任的制作者提供

依赖于:制作者的数字签名;签名是作者使用自己的私钥加密程序包的特性码进行的;

内容合法:

包未被二次修改;完整性校验成功

依赖于:制作者提供的程序特征码;

验正方式:安装者用同样的特征码提取算法提取程序包的特征码,并与原作者提供的相比较;

验正其光盘中程序包的来源及完整性:

rpm --import /path/to/RPM-GPG-KEY-FILE

例如:# rpm --import RPM-GPG-KEY-CentOS-6

验正:rpm {-K|--checksig} PACKAGE_FILE

# rpm --import /misc/cd/RPM-GPG-KEY-CentOS-6
# rpm -K zsh-4.3.10-7.el6.x86_64.rpm
zsh-4.3.10-7.el6.x86_64.rpm: rsa sha1 (md5) pgp md5 OK
# rpm -K php-5.3.3-38.el6.x86_64.rpm
php-5.3.3-38.el6.x86_64.rpm: rsa sha1 (md5) pgp md5 OK

--nosignature: 不检查来源合法性

--nodigest: 不检查完整性

rpm管理器数据库:/var/lib/rpm

重建数据库:

rpm {--initdb|--rebuilddb} [-v] [--dbpath DIRECTORY]

--initdb: 初始化数据库,即数据库完全不存时,可新建之;

例如:

我删除__db.001、__db.002、__db.003、__db.004

# rm -rf /var/lib/rpm/__db.00{1..4}
# ll /var/lib/rpm/
总用量 57208
-rw-r--r--. 1 root root  5083136 11月 19 15:32 Basenames
-rw-r--r--. 1 root root    12288 11月 10 15:20 Conflictname
-rw-r--r--. 1 root root  1044480 11月 19 15:32 Dirnames
-rw-r--r--. 1 root root  5263360 11月 19 15:32 Filedigests
-rw-r--r--. 1 root root    20480 11月 19 15:32 Group
-rw-r--r--. 1 root root    20480 11月 19 15:32 Installtid
-rw-r--r--. 1 root root    49152 11月 19 15:32 Name
-rw-r--r--. 1 root root    24576 11月 19 15:07 Obsoletename
-rw-r--r--. 1 root root 46825472 11月 19 15:32 Packages
-rw-r--r--. 1 root root  1343488 11月 19 15:32 Providename
-rw-r--r--. 1 root root   696320 11月 19 15:32 Provideversion
-rw-r--r--. 1 root root    12288 11月 16 15:07 Pubkeys
-rw-r--r--. 1 root root   446464 11月 19 15:32 Requirename
-rw-r--r--. 1 root root   253952 11月 19 15:32 Requireversion
-rw-r--r--. 1 root root    90112 11月 19 15:32 Sha1header
-rw-r--r--. 1 root root    86016 11月 19 15:32 Sigmd5
-rw-r--r--. 1 root root    12288 11月 10 15:20 Triggername
# rpm --initdb /var/lib/rpm/
# ll /var/lib/rpm/
总用量 58048
-rw-r--r--. 1 root root  5083136 11月 19 15:32 Basenames
-rw-r--r--. 1 root root    12288 11月 10 15:20 Conflictname
-rw-r--r--  1 root root    24576 11月 19 15:38 __db.001
-rw-r--r--  1 root root   229376 11月 19 15:38 __db.002
-rw-r--r--  1 root root  1318912 11月 19 15:38 __db.003
-rw-r--r--  1 root root   753664 11月 19 15:38 __db.004
-rw-r--r--. 1 root root  1044480 11月 19 15:32 Dirnames
-rw-r--r--. 1 root root  5263360 11月 19 15:32 Filedigests
-rw-r--r--. 1 root root    20480 11月 19 15:32 Group
-rw-r--r--. 1 root root    20480 11月 19 15:32 Installtid
-rw-r--r--. 1 root root    49152 11月 19 15:32 Name
-rw-r--r--. 1 root root    24576 11月 19 15:07 Obsoletename
-rw-r--r--. 1 root root 46825472 11月 19 15:32 Packages
-rw-r--r--. 1 root root  1343488 11月 19 15:32 Providename
-rw-r--r--. 1 root root   696320 11月 19 15:32 Provideversion
-rw-r--r--. 1 root root    12288 11月 16 15:07 Pubkeys
-rw-r--r--. 1 root root   446464 11月 19 15:32 Requirename
-rw-r--r--. 1 root root   253952 11月 19 15:32 Requireversion
-rw-r--r--. 1 root root    90112 11月 19 15:32 Sha1header
-rw-r--r--. 1 root root    86016 11月 19 15:32 Sigmd5
-rw-r--r--. 1 root root    12288 11月 10 15:20 Triggername

--rebuilddb: 无论当前数据存在与否,都会直接重建此库;

总结:

基本管理:安装、升级、卸载、查询和校验;

合法性验正;

数据库管理;

Linux系统程序包管理工具-RPM相关推荐

  1. Linux系统程序包管理工具 RPM

    什么是RPM: RPM全名是"RedHat Package Manager",简称为RPM,这套软件管理机制是由RedHat这家公司发展而来的.RPM是以一种数据库记录的方式来将你 ...

  2. Linux下程序包管理工具RPM

    实验环境: CentOS release 6.6 (Final)  一台 IP地址:172.16.249.230 RPM 是 Red Hat Package Manager 的缩写,本意是Red Ha ...

  3. 两类Linux系统的包管理工具

    Linux系统分为两种: 1.RedHat系列:Redhat.Centos.Fedora等 2.Debian系列:Debian.Ubuntu等 RedHat系列的包管理工具是yum,Debian系列的 ...

  4. linuxpip安装python包_Windows+Linux安装Python包管理工具pip

    Windows+Linux安装Python包管理工具pip Windows安装Python包管理工具pip pip是一个Python包管理工具,主要是用于安装PyPI上的软件包,可以替代easy_in ...

  5. Linux系统的web管理工具——webmin搭建

    Linux系统的web管理工具--webmin搭建 一.webmin介绍 二.添加webmin的yum仓库 三.检查yum仓库状态 三.安装webmin 1.添加GPG密钥 2.安装webmin 3. ...

  6. linux系统高级管理工具包,linux两大系统的包管理工具

    linux系统分为两大阵营: 1. redhat系统:包括Redhat.Centos.Fedora等 2. debian系统:包括Debian.Ubuntu等 RedHat 系列 1 常见的安装包格式 ...

  7. Linux程序包管理(rpm)

    程序包:由源代码通过编译成CPU可执行的二进制格式,再把这些文件(二进制程序.库文件.配置文件.帮助文件)组织成为一个或有限几个"包"文件. 程序包的组成:1.程序包的组成清单(每 ...

  8. 系统学习----包管理工具和包仓库管理

    文章目录 包管理器 RPM管理 常用使用方式: 常用参数: YUM包管理 仓库: 常用命令: 常用参数: 包仓库管理 远程仓库 本地仓库配置(使用光盘) 关于本地仓库的自建(同步远程仓库的软件包到本地 ...

  9. Linux程序包管理之RPM

    一RPM介绍: 1,RPM:是指.rpm的文件格式的软件包,也可能是指其本身的软件包管理器(RPM Package Manager).最早由Red Hat研制,现在也由开源社区开发.RPM通常随附于L ...

最新文章

  1. mysql/mariadb:数据库变量(参数)管理
  2. 风口再起:数据中心建设
  3. Hd Simpsons’ Hidden Talents
  4. Tomcat 总体结构
  5. 多生产者_通知:生产者补贴!打卡时间!定了
  6. 在服务器端生成Excel文件然后从服务器下载的本地的代码
  7. java版电子商务spring cloud分布式微服务b2b2c社交电商:服务容错保护(Hystrix断路器)...
  8. FastStone Capture 注册码 序列号
  9. 网站建设中HTML编写技巧你必须掌握的30个 提升你的编写能力|网站建设
  10. 机器人挠人脚心_挠同学脚心
  11. linux删除系统日志文件,Linux不小心删除日志文件syslog的解决方法
  12. android 3d地球,动态3D我的地球app
  13. 职业教育相关的核心期刊有哪些?
  14. 程序员交流地必备技能:【怎么让外行理解陌生地东西?】由简喻难(用熟悉的事物形容不熟悉的事物、用来打比方的事物,相似点要直观、通过比喻产生美感、创造概念,浓缩某方面的认知)
  15. 红色警戒2rules.ini数值修改
  16. c语言编程出彩色告白,C语言告白代码,一闪一闪亮晶晶~
  17. 可用于SDR的C语言纠错编码通用算法收集(1)-朴素字典查表BCH纠错
  18. 出书挂名流程 出书挂名步骤
  19. PS之基本功能及抠图
  20. Windows10 alt+table 错乱问题修复

热门文章

  1. Rinne Loves Study
  2. angularjs 猜大小
  3. DWG中注记类型属性转换
  4. cesium城市建筑颜色渲染以及泛光渐变效果
  5. codeforces 1520E. Arranging The Sheep(1400)
  6. TeamTalk源码分析之win-client
  7. linux 光标切换快捷键,光标操作快捷键,光标快捷键
  8. 【夯实基础--CSS】=> 高级技巧(雪碧图/滑动门/CSS三角形/字体图标(iconfont)等)
  9. 【工控老马】ABB AC500 系列PLC与WEST 8100+系列仪表的ASCII通讯指南
  10. 实战 | 一键导出微信阅读记录和笔记