软件包名称-软件包版本-软件包修订次数(3.el).适用的硬件平台.扩展名
[root@szm bash]# yum -h
Loaded plugins: fastestmirror, priorities, refresh-packagekit
Usage: yum [options] COMMAND
List of Commands:
check Check for problems in the rpmdb
check-update Check for available package updates
clean Remove cached data
deplist List a package's dependencies
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade downgrade a package---下载可用升级包
erase Remove a package or packages from your system
groupinfo Display details about a package group
groupinstall Install the packages in a group on your system
grouplist List available package groups
groupremove Remove the packages in a group from your system
help Display a helpful usage message
history Display, or use, the transaction history
info Display details about a package or group of packages
install Install a package or packages on your system
list List a package or groups of packages
load-transaction load a saved transaction from filename
makecache Generate the metadata cache
provides Find what package provides the given value--从特别的文件搜索软件包
reinstall reinstall a package
repolist Display the configured software repositories----查看软件仓库信息
resolvedep Determine which package provides the given dependency--查询软件包依赖
search Search package details for the given string
shell Run an interactive yum shell
update Update a package or packages on your system
upgrade Update packages taking obsoletes into account
version Display a version for the machine and/or available repos.
Options:
-h, --help show this help message and exit
-t, --tolerant be tolerant of errors
-C, --cacheonly run entirely from system cache, don't update cache
-c [config file], --config=[config file]
config file location
-R [minutes], --randomwait=[minutes]
maximum command wait time
-d [debug level], --debuglevel=[debug level]
debugging output level
--showduplicates show duplicates, in repos, in list/search commands
-e [error level], --errorlevel=[error level]
error output level
--rpmverbosity=[debug level name]
debugging output level for rpm
-q, --quiet quiet operation
-v, --verbose verbose operation
-y, --assumeyes answer yes for all questions
--version show Yum version and exit
--installroot=[path] set install root----设置指定安装目录
--enablerepo=[repo] enable one or more repositories (wildcards allowed)
--disablerepo=[repo] disable one or more repositories (wildcards allowed)
-x [package], --exclude=[package]
exclude package(s) by name or glob
--disableexcludes=[repo]
disable exclude from main, for a repo or for
everything
--obsoletes enable obsoletes processing during updates
--noplugins disable Yum plugins
--nogpgcheck disable gpg signature checking
--disableplugin=[plugin]
disable plugins by name
--enableplugin=[plugin]
enable plugins by name
--skip-broken skip packages with depsolving problems
--color=COLOR control whether color is used
--releasever=RELEASEVER
set value of $releasever in yum config and repo files
--setopt=SETOPTS set arbitrary config and repo options
Plugin Options:
--samearch-priorities
Priority-exclude packages based on name + arch
-localinstall安装本地rpm文件,解决依赖问题 |
[root@szm bash]# yum search zsh
Loaded plugins: fastestmirror, priorities, refresh-packagekit
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* epel: mirrors.ustc.edu.cn
* extras: centos.ustc.edu.cn
* remi: rpms.famillecollet.com
* rpmforge: mirror.oscc.org.my
* updates: mirror01.idc.hinet.net
epel/pkgtags | 325 B 00:00
=============================================== N/S Matched: zsh ===============================================
autojump-zsh.noarch : Autojump for zsh
gromacs-zsh.noarch : GROMACS zsh support
python-twisted-core-zsh.i686 : Tab completion for Zsh and Twisted Core
zsh-html.i686 : Zsh shell manual in html format
zsh.i686 : A powerful interactive shell
Name and summary matches only, use "search all" for everything.
[root@szm bash]# yum info zsh-html
Loaded plugins: fastestmirror, priorities, refresh-packagekit
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* epel: mirrors.ustc.edu.cn
* extras: centos.ustc.edu.cn
* remi: rpms.famillecollet.com
* rpmforge: mirror.oscc.org.my
* updates: mirror01.idc.hinet.net
Available Packages
Name : zsh-html
Arch : i686
Version : 4.3.10
Release : 5.el6
Size : 454 k
Repo : base
Summary : Zsh shell manual in html format
URL : http://zsh.sunsite.dk/
License : BSD
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.
:
: This package contains the Zsh manual in html format.
[root@szm bash]# yum grouplist
查询软件包安装了哪些文件:
[root@szm bash]# yum whatprovides /bin/ls
Loaded plugins: fastestmirror, priorities, refresh-packagekit
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* epel: mirrors.ustc.edu.cn
* extras: centos.ustc.edu.cn
* remi: rpms.famillecollet.com
* rpmforge: mirror.oscc.org.my
* updates: mirror01.idc.hinet.net
coreutils-8.4-19.el6.i686 : A set of basic GNU tools commonly used in shell scripts
Repo : base
Matched from:
Filename : /bin/ls
coreutils-8.4-19.el6.i686 : A set of basic GNU tools commonly used in shell scripts
Repo : installed
Matched from:
Other : Provides-match: /bin/ls
[root@szm bash]# rpm --help
Usage: rpm [OPTION...]
--quiet
Query/Verify package selection options:
-a, --all query/verify all packages
-f, --file query/verify package(s) owning file
-g, --group query/verify package(s) in group
-p, --package query/verify a package file--查询未安装rpm文件
-W, --ftswalk query/verify package(s) from TOP file tree walk
--pkgid query/verify package(s) with package identifier
--hdrid query/verify package(s) with header identifier
--fileid query/verify package(s) with file identifier
--specfile query a spec file
--triggeredby query the package(s) triggered by the package
--whatrequires query/verify the package(s) which require a dependency
--whatprovides query/verify the package(s) which provide a dependency
--nomanifest do not process non-package files as manifests
Query options (with -q or --query):
-c, --configfiles list all configuration files
-d, --docfiles list all documentation files
--dump dump basic file information
-l, --list list files in package
--queryformat=QUERYFORMAT use the following query format
-s, --state display the states of the listed files
Verify options (with -V or --verify):
--nofiledigest don't verify digest of files
--nomd5 don't verify digest of files
--nofiles don't verify files in package
--nodeps don't verify package dependencies
--noscript don't execute verify script(s)
File tree walk options (with --ftswalk):
--comfollow follow command line symlinks
--logical logical walk
--nochdir don't change directories
--nostat don't get stat info
--physical physical walk
--seedot return dot and dot-dot
--xdev don't cross devices
--whiteout return whiteout information
Signature options:
--addsign sign package(s) (identical to --resign)
-K, --checksig verify package signature(s)
--delsign delete package signatures
--import import an armored public key
--resign sign package(s) (identical to --addsign)
--nodigest don't verify package digest(s)
--nosignature don't verify package signature(s)
Database options:
--initdb initialize database
--rebuilddb rebuild database inverted lists from installed package headers
Install/Upgrade/Erase options:
--aid add suggested packages to transaction
--allfiles install all files, even configurations which might otherwise be skipped
--allmatches remove all packages which match
(normally an error is generated
if
specified multiple packages)
--badreloc relocate files in non-relocatable package
-e, --erase=+ erase (uninstall) package
--excludedocs do not install documentation
--excludepath=
skip files with leading component
--fileconflicts detect file conflicts between packages
--force short hand for --replacepkgs --replacefiles强制安装
-F, --freshen=+ upgrade package(s) if already installed
-h, --hash print hash marks as package installs (good with -v)
--ignorearch don't verify package architecture
--ignoreos don't verify package operating system
--ignoresize don't check disk space before installing
-i, --install install package(s)
--justdb update the database, but do not modify the filesystem
--nodeps do not verify package dependencies
--nofiledigest don't verify digest of files
--nomd5 don't verify digest of files (obsolete)
--nocontexts don't install file security contexts
--noorder do not reorder package installation to satisfy dependencies
--nosuggest do not suggest missing dependency resolution(s)
--noscripts do not execute package scriptlet(s)
--notriggers do not execute any scriptlet(s) triggered by this package
--oldpackage upgrade to an old version of the package (--force on upgrades does this(安装旧版本软件)
automatically)
--percent print percentages as package installs
--prefix=
relocate the package to , if relocatable
--relocate=
= relocate files from path to
--replacefiles ignore file conflicts between packages
--replacepkgs reinstall if the package is already present
--test don't install, but tell if it would work or not
-U, --upgrade=+ upgrade package(s)
Common options for all rpm modes and executables:
-D, --define='MACRO EXPR' define MACRO with value EXPR
-E, --eval='EXPR' print macro expansion of EXPR
--macros= read instead of default file(s)
--nodigest don't verify package digest(s)
--nosignature don't verify package signature(s)
--rcfile= read instead of default file(s)
-r, --root=ROOT use ROOT as top level directory (default: "/")
--querytags display known query tags
--showrc display final rpmrc and macro configuration
--quiet provide less detailed output
-v, --verbose provide more detailed output
--version print the version of rpm being used
Options implemented via popt alias/exec:
--scripts list install/erase scriptlets from package(s)
--setperms set permissions of files in a package
--setugids set user/group ownership of files in a package
--conflicts list capabilities this package conflicts with
--obsoletes list other packages removed by installing this package
--provides list capabilities that this package provides
--requires (-R) list capabilities required by package(s)
--info list descriptive information from package(s)
--changelog list change logs for this package
--xml list metadata in xml
--triggers list trigger scriptlets from package(s)
--last list package(s) by install time, most recent first
--dupes list duplicated packages
--filesbypkg list all files from each package
--fileclass list file names with classes
--filecolor list file names with colors
--fscontext list file names with security context from file system
--fileprovide list file names with provides
--filerequire list file names with requires
--filecaps list file names with POSIX1.e capabilities
Help options:
-?, --help Show this help message
--usage Display brief usage message
rpm数据库:
[root@szm bash]# cat /var/lib/rpm/
Basenames __db.003 Group Packages Requirename Sigmd5
Conflictname __db.004 Installtid Providename Requireversion Triggername
__db.001 Dirnames Name Provideversion .rpm.lock
__db.002 Filedigests Obsoletename Pubkeys Sha1header
查询所有配置文件
[root@szm bash]# rpm -qc bind
查询所有帮助文件:
[root@szm bash]# rpm -qd bind
文件属于哪个软件:
[root@szm bash]# rpm -qf /etc/passwd
setup-2.8.14-20.el6.noarch
依赖关系:
[root@szm bash]# rpm -qR bind
依赖关系和没安装的包:
[root@szm bash]# rpm -qRp bind
查询软件包安装文件:
[root@szm bash]# rpm -ql bind
rpm验证数字签名:
....L.... c /etc/dracut.conf
....L.... c /etc/pulse/default.pa
S.5....T. c /etc/rsyslog.conf
S.5....T. c /etc/dumpdates
S.5....T. c /etc/pam_ldap.conf
S.5....T. c /etc/yp.conf
S.5....T. c /etc/sudoers
.......T. c /etc/dnsmasq.conf
S.5....T. c /etc/vsftpd/vsftpd.conf
S.5....T. c /etc/openldap/ldap.conf
..5....T. /usr/share/ibus-table/tables/compose.db
..5....T. /usr/share/ibus-table/tables/latex.db
S.5....T. c /etc/updatedb.conf
S.5....T. c /var/lib/nfs/etab
.M....... c /etc/cups/subscriptions.conf
.M....G.. /var/log/gdm
.M....... /var/run/gdm
missing /var/run/gdm/greeter
....L.... c /etc/pam.d/fingerprint-auth
....L.... c /etc/pam.d/password-auth
....L.... c /etc/pam.d/smartcard-auth
....L.... c /etc/pam.d/system-auth
prelink: /usr/lib/libunistring.so.0.1.2: at least one of file's dependencies has changed since prelinking
S.?...... /usr/lib/libunistring.so.0.1.2
.......T. /var/log/tomcat6/catalina.out
..5....T. c /etc/inittab
..5....T. /etc/ld.so.conf.d/kernel-2.6.32-71.el6.i686.conf
S.5...... /usr/libexec/perf.2.6.32-71.el6.i686
第一列:文件的属性 第二列:文件的类型 第三列:所检查的文件
|
S:文件大小或容量与原文件不同 M:文件的属性或权限与原文件不同 5:MD5的HASH值与原文件不同 D:设备文件的主次设备号与原文件不同 L:文件的链接路径与原文件不同 U:文件拥有人信息与原文件不同 G:文件拥有组成员与原文件不同 T:文件的创建时间与原文件 |
c:代表配置文件 d:代表文档 g:代表Ghost类型文件 l:代表版权类型文件 r:自述类型文件
|
数字签名:
[root@szm Desktop]# ls /etc/pki/rpm-gpg/
RPM-GPG-KEY-CentOS-6 RPM-GPG-KEY-CentOS-Security-6 RPM-GPG-KEY-EPEL-6 RPM-GPG-KEY-rpmforge-dag
RPM-GPG-KEY-CentOS-Debug-6 RPM-GPG-KEY-CentOS-Testing-6 RPM-GPG-KEY-remi RPM-GPG-KEY-rpmforge-fabian
[root@szm Desktop]# cat /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.5 (GNU/Linux)
mQINBE4P06MBEACqn48FZgYkG2QrtUAVDV58H6LpDYEcTcv4CIFSkgs6dJ9TavCW
NyPBZRpM2R+Rg5eVqlborp7TmktBP/sSsxc8eJ+3P2aQWSWc5ol74Y0OznJUCrBr
bIdypJllsD9Fe+h7gLBXTh3vdBEWr2lR+xA+Oou8UlO2gFbVFQqMafUgU1s0vqaE
/hHH0TzwD0/tJ6eqIbHwVR/Bu6kHFK4PwePovhfvyYD9Y+C0vOYd5Ict2vbLHz1f
QBDZObv4M6KN3j7nzme47hKtdMd+LwFqxM5cXfM6b5doDulWPmuGV78VoX6OR7el
x1tlfpuiFeuXYnImm5nTawArcQ1UkXUSYcTUKShJebRDLR3BycxR39Q9jtbOQ29R
FumHginovEhdUcinRr22eRXgcmzpR00zFIWoFCwHh/OCtG14nFhefuZ8Z80qbVhW
2J9+/O4tksv9HtQBmQNOK5S8C4HNF2M8AfOWNTr8esFSDc0YA5/cxzdfOOtWam/w
lBpNcUUSSgddRsBwijPuWhVA3NmA/uQlJtAo4Ji5vo8cj5MTPG3+U+rfNqRxu1Yc
ioXRo4LzggPscaTZX6V24n0fzw0J2k7TT4sX007k+7YXwEMqmHpcMYbDNzdCzUer
Zilh5hihJwvGfdi234W3GofttoO+jaAZjic7a3p6cO1ICMgfVqrbZCUQVQARAQAB
tEZDZW50T1MtNiBLZXkgKENlbnRPUyA2IE9mZmljaWFsIFNpZ25pbmcgS2V5KSA8
Y2VudG9zLTYta2V5QGNlbnRvcy5vcmc+iQI8BBMBAgAmBQJOD9OjAhsDBQkSzAMA
BgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQCUb8osEFud6ajRAAnb6d+w6Y/v/d
MSy7UEy4rNquArix8xhqBwwjoGXpa37OqTvvcJrftZ1XgtzmTbkqXc+9EFch0C+w
ST10f+H0SPTUGuPwqLkg27snUkDAv1B8laub+l2L9erzCaRriH8MnFyxt5v1rqWA
mVlRymzgXK+EQDr+XOgMm1CvxVY3OwdjdoHNox4TdVQWlZl83xdLXBxkd5IRciNm
sg5fJAzAMeg8YsoDee3m4khg9gEm+/Rj5io8Gfk0nhQpgGGeS1HEXl5jzTb44zQW
qudkfcLEdUMOECbu7IC5Z1wrcj559qcp9C94IwQQO+LxLwg4kHffvZjCaOXDRiya
h8KGsEDuiqwjU9HgGq9fa0Ceo3OyUazUi+WnOxBLVIQ8cUZJJ2Ia5PDnEsz59kCp
JmBZaYPxUEteMtG3yDTa8c8jUnJtMPpkwpSkeMBeNr/rEH4YcBoxuFjppHzQpJ7G
hZRbOfY8w97TgJbfDElwTX0/xX9ypsmBezgGoOvOkzP9iCy9YUBc9q/SNnflRWPO
sMVrjec0vc6ffthu2xBdigBXhL7x2bphWzTXf2T067k+JOdoh5EGney6LhQzcp8m
YCTENStCR+L/5XwrvNgRBnoXe4e0ZHet1CcCuBCBvSmsPHp5ml21ahsephnHx+rl
JNGtzulnNP07RyfzQcpCNFH7W4lXzqM=
=jrWY
-----END PGP PUBLIC KEY BLOCK-----
安装证书:
[root@szm bash]# rpm --import ...
查询系统中已经安装了哪些数字证书:
[root@szm bash]# rpm -qa | grep -i GPG
pygpgme-0.1-18.20090824bzr68.el6.i686
gpg-pubkey-00f97f56-467e318a
gpgme-1.1.8-3.el6.i686
gpg-pubkey-0608b895-4bd22942
libgpg-error-1.7-4.el6.i686
gpg-pubkey-7fac5991-4615767f
gpg-pubkey-6b8d79e6-3f49313d
gpg-pubkey-c105b9de-4e0fd3a3
验证数字证书:
[root@szm Downloads]# rpm -K rpmforge-release-0.5.2-2.el6.rf.i686.rpm
rpmforge-release-0.5.2-2.el6.rf.i686.rpm: (sha1) dsa sha1 md5 gpg OK
MD5校验:
[root@szm Downloads]# md5sum rpmforge-release-0.5.2-2.el6.rf.i686.rpm
7cc287ef15afe2809d9d24b69ba4d434 rpmforge-release-0.5.2-2.el6.rf.i686.rpm
删除RPM包:
[root@szm Downloads]# rpm -e ...
YUM源配置:
Enable:0禁用,1启用 gpgcheck:0禁用,1启用 帮助文档:man yum.conf |
查看系统所有可用的yum安装源:
[root@szm Downloads]# yum repolist all
Loaded plugins: fastestmirror, priorities, refresh-packagekit
Loading mirror speeds from cached hostfile
* base: ftp.stu.edu.tw
* epel: mirrors.ustc.edu.cn
* extras: ftp.stu.edu.tw
* remi: rpms.famillecollet.com
* rpmforge: mirror.oscc.org.my
* updates: mirror01.idc.hinet.net
http://dl.google.com/linux/rpm/stable/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2404:6800:4005:c00::5d: Network is unreachable"
Trying other mirror.
http://dl.google.com/linux/chrome/rpm/stable/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2404:6800:4005:c00::5d: Network is unreachable"
Trying other mirror.
http://dl.google.com/linux/rpm/stable/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2404:6800:4005:c00::5d: Network is unreachable"
Trying other mirror.
repo id repo name status
C6.0-base CentOS-6.0 - Base disabled
C6.0-centosplus CentOS-6.0 - CentOSPlus disabled
C6.0-contrib CentOS-6.0 - Contrib disabled
C6.0-extras CentOS-6.0 - Extras disabled
C6.0-updates CentOS-6.0 - Updates disabled
C6.1-base CentOS-6.1 - Base disabled
C6.1-centosplus CentOS-6.1 - CentOSPlus disabled
C6.1-contrib CentOS-6.1 - Contrib disabled
C6.1-extras CentOS-6.1 - Extras disabled
C6.1-updates CentOS-6.1 - Updates disabled
C6.2-base CentOS-6.2 - Base disabled
C6.2-centosplus CentOS-6.2 - CentOSPlus disabled
C6.2-contrib CentOS-6.2 - Contrib disabled
C6.2-extras CentOS-6.2 - Extras disabled
C6.2-updates CentOS-6.2 - Updates disabled
C6.3-base CentOS-6.3 - Base disabled
C6.3-centosplus CentOS-6.3 - CentOSPlus disabled
C6.3-contrib CentOS-6.3 - Contrib disabled
C6.3-extras CentOS-6.3 - Extras disabled
C6.3-updates CentOS-6.3 - Updates disabled
base CentOS-6 - Base enabled: 4,802
c6-media CentOS-6 - Media disabled
centosplus CentOS-6 - Plus disabled
contrib CentOS-6 - Contrib disabled
debug CentOS-6 - Debuginfo disabled
epel Extra Packages for Enterprise Linux 6 - i386 enabled: 7,002
epel-debuginfo Extra Packages for Enterprise Linux 6 - i386 - Debug disabled
epel-source Extra Packages for Enterprise Linux 6 - i386 - Source disabled
epel-testing Extra Packages for Enterprise Linux 6 - Testing - i386 disabled
epel-testing-debuginfo Extra Packages for Enterprise Linux 6 - Testing - i386 - Debug disabled
epel-testing-source Extra Packages for Enterprise Linux 6 - Testing - i386 - Source disabled
extras CentOS-6 - Extras enabled: 12
google Google - i386 enabled: 3
google-chrome google-chrome enabled: 3
google64 Google - x86_64 enabled: 3
remi Les RPM de remi pour Enterprise Linux 6 - i386 enabled: 953
remi-debuginfo Les RPM de remi pour Enterprise Linux 6 - i386 - debuginfo disabled
remi-test Les RPM de remi en test pour Enterprise Linux 6 - i386 disabled
remi-test-debuginfo Les RPM de remi en test pour Enterprise Linux 6 - i386 - debuginfo disabled
rpmforge RHEL 6 - RPMforge.net - dag enabled: 4,513
rpmforge-extras RHEL 6 - RPMforge.net - extras disabled
rpmforge-testing RHEL 6 - RPMforge.net - testing disabled
updates CentOS-6 - Updates enabled: 170
安装源软件列表缓存路径:
[root@szm Downloads]# cat /var/cache/yum
清除缓存:
[root@szm Downloads]# yum clean all