- 论坛徽章:
- 0
|
rpm Linux and Unix 命令手册
本命令手册以实用,简洁为原则,对于已经消化的内容,不附加详细的注解。
磁针石
联系方式:
QQ:37391319 gmail and gtalk: xurongzhong@gmail.com
参考资料
*《Running.Linux.5th.Edition》 第12.2节
* rehat 9 之 man rpm
简介
rpm - RPM Package Manager
rpm is a powerful
Package Manager, which can be used to build, install, query, verify, update,
and erase individual software packages.
A package consists of an archive of files and meta-data used to install
and erase the archive files. The
meta-data includes helper
scripts, file attributes, and
descriptive information about the package.Packages come in two varieties:
binary packages, used to encapsulate software to be installed, and source
packages,containing the source code and recipe necessary to produce binary
packages.
One of the
following basic modes must be selected: Query, Verify, Signature Check,
Install/Upgrade/Freshen, Unin-stall, Initialize Database, Rebuild Database,
Resign, Add Signature, Set Owners/Groups, Show
Querytags, and Show Configuration.
Red Hat Package Manager原来为Red Hat Package Manager,但是现在已经扩展到了SUSE等系统。
基本原理:The basic idea of RPM is that
you have a database of packages and the files that
belong to a package.
RPM的代价,开发需要另外花时间制作RPM包,用户不能从RPM包中提取单个文件。
语法
SYNOPSIS
QUERYING AND VERIFYING PACKAGES:
rpm {-q|--query} [select-options]
[query-options]
rpm {-V|--verify} [select-options]
[verify-options]
rpm --import PUBKEY ...
rpm {-K|--checksig} [--nosignature]
[--nodigest]
PACKAGE_FILE ...
INSTALLING, UPGRADING, AND REMOVING PACKAGES:
rpm {-i|--install} [install-options]
PACKAGE_FILE ...
rpm {-U|--upgrade} [install-options]
PACKAGE_FILE ...
rpm {-F|--freshen} [install-options]
PACKAGE_FILE ...
rpm {-e|--erase} [--allmatches]
[--nodeps] [--noscripts]
[--notriggers] [--repackage]
[--test] PACKAGE_NAME ...
MISCELLANEOUS:
rpm {--initdb|--rebuilddb}
rpm {--addsign|--resign} PACKAGE_FILE
...
rpm {--querytags|--showrc}
rpm {--setperms|--setugids} PACKAGE_NAME
...
select-options
[PACKAGE_NAME] [-a,--all] [-f,--file
FILE]
[-g,--group GROUP] {-p,--package
PACKAGE_FILE]
[--fileid MD5] [--hdrid SHA1] [--pkgid
MD5] [--tid TID]
[--querybynumber HDRNUM] [--triggeredby
PACKAGE_NAME]
[--whatprovides CAPABILITY]
[--whatrequires CAPABILITY]
query-options
[--changelog] [-c,--configfiles]
[-d,--docfiles] [--dump]
[--filesbypkg] [-i,--info] [--last]
[-l,--list]
[--obsoletes] [--provides] [--qf,--queryformat
QUERYFMT]
[-R,--requires] [--scripts]
[-s,--state]
[--triggers,--triggerscripts]
verify-options
[--nodeps] [--nofiles] [--noscripts]
[--nodigest] [--nosignature]
[--nolinkto] [--nomd5] [--nosize]
[--nouser]
[--nogroup] [--nomtime] [--nomode]
[--nordev]
install-options
[--aid] [--allfiles] [--badreloc]
[--excludepath OLDPATH]
[--excludedocs] [--force] [-h,--hash]
[--ignoresize] [--ignorearch]
[--ignoreos]
[--includedocs] [--justdb] [--nodeps]
[--nodigest] [--nosignature]
[--nosuggest]
[--noorder] [--noscripts]
[--notriggers]
[--oldpackage] [--percent] [--prefix
NEWPATH]
[--relocate OLDPATH=NEWPATH]
[--repackage] [--replacefiles]
[--replacepkgs]
[--test]
常用用法
* 安装
# rpm -i SuperFrob-4.i386.rpm 或者
rpm --install SuperFrob-4.i386.rpm ,# rpm -ivh SuperFrob-4.i386.rpm
* 移除
rpm -e SuperFrob-5
* 升级
# rpm -U SuperFrob-5.i386.rpm
* 查询
查询:# rpm -q SuperFrob,# rpm –qa
查询文件归属于那个RPM包:#
rpm -qf /etc/ntp.conf
查询安装包的详细信息:
# rpm -qi ntp
Name : ntp Relocations: (not
relocatable)
Version : 4.2.0.a.20040617 Vendor: Red Hat, Inc.
Release : 4.EL4.1 Build Date: Thu 20 Apr
2006 11:28:44 PM CST
Install Date: Mon 28 Apr 2008 10:13:35 AM CST Build Host: hs20-bc1-3.build.redhat.com
Group : System
Environment/Daemons Source RPM: ntp-4.2.0.a.20040617-4.EL4.1.src.rpm
Size : 2474735 License: distributable
Signature : DSA/SHA1, Fri 26
May 2006 04:57:11 PM CST, Key ID 219180cddb42a60e
Packager : Red Hat, Inc.
URL :
http://www.ntp.org
Summary : Synchronizes
system time using the Network Time Protocol (NTP).
Description :
The Network Time Protocol (NTP) is used to synchronize a computer's
time with another reference time source. The ntp package contains
utilities and daemons that will synchronize your computer's time to
Coordinated Universal Time (UTC) via the NTP protocol and NTP
servers.
The ntp package includes ntpdate (a program for retrieving the date
and time from remote machines via a network) and ntpd (a daemon
which
continuously adjusts system time).
Install the ntp package if you need tools for keeping your system's
time synchronized via the NTP protocol.
# rpm -ql ntp
可以参考rpm(8)
Slackware 或者 Debian系统中,alien可以转换不同的格式。你也可以自己构建RPM系统。
从
http://www.rpm.org.下载rpm
软件,有些新版本可能不稳定,4.1.1是比较稳定的版本。
然后初始化数据库:# rpm –initdb ,它会在/var/lib/rpm中创建文件。
排除依赖性:# rpm -i --nodeps
SuperFrob-4.i386.rpm
SUSE中有叫YOU的RPM自动升级系统。不过一些安全专家认为这有风险。
命令参考
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/21908/showart_640531.html |
|