Detailed explanation of Linux RPM command parameter usage

rpm executes the installation package

Binary package (Binary) and source code package (Source) two. Binary packages can be installed directly on the computer, while source code packages will be automatically compiled and installed by RPM. Source code packages often end in src.rpm.
Common command combinations:
-ivh: installation shows the installation progress --install--verbose--hash
-Uvh: upgrade package --Update;
-qpl: list file information in RPM package [Query Package list];
-qpi: list RPM Package description information [Query Package install package(s)];
-qf: Find which RPM package the specified file belongs to [Query File];
-Va: Verify all RPM packages and find missing files [View Lost] ;
-e: delete package
rpm -q samba //Check whether the program is installed
rpm -ivh /media/cdrom/RedHat/RPMS/samba-3.0.10-1.4E.i386.rpm //Install by path and display progress
rpm -ivh --relocate /=/opt/gaim gaim-1.3.0- 1.fc4.i386.rpm //Specify the installation directory
rpm -ivh --test gaim-1.3.0-1.fc4.i386.rpm //Used to check dependencies; not a real installation;
rpm -Uvh --oldpackage gaim-1.3.0-1.fc4.i386 .rpm //The new version is downgraded to the old version
rpm -qa | grep httpd #[Search whether the specified rpm package is installed]--all search for *httpd*
rpm -ql httpd #[Search for rpm package]--list all file installation directories
rpm -qpi Linux-1.4-6.i368.rpm #[View rpm package]--query--package--install package information
rpm -qpf Linux-1.4-6.i368.rpm #[View rpm package]--file
rpm -qpR file.rpm #[view package]dependencies
rpm2cpio file.rpm |cpio -div #[extract file]
rpm -ivh file.rpm #[install new rpm]--install--verbose--hash
rpm -ivh http://mirrors.kernel.org/fedora/core/4/i386/os/Fedora/RPMS/gaim -1.3.0-1.fc4.i386.rpm
rpm -Uvh file.rpm #[Upgrade an rpm]--upgrade
rpm -e file.rpm #[Delete an rpm package]--erase
Common parameters:
Install/Upgrade/Erase options:
-i, --install install package(s)
-v, --verbose provide more detailed output
-h, --hash print hash marks as package installs (good with -v)
-e, - -erase erase (uninstall) package
-U, --upgrade=<packagefile>+ upgrade package(s)
--replacepkge Forcibly install the package regardless of whether the package is already installed
--test Install test, do not actually
install- -nodeps ignore package dependencies forcibly install
--force ignore package and file conflicts
Query options (with -q or --query):
-a, --all                         query/verify all packages
-p, --package                     query/verify a package file
-l, --list                        list files in package
-d, --docfiles                    list all documentation files
-f, --file                        query/verify package(s) owning file
RPM源代码包装安装
.src.rpm结尾的文件,这些文件是由软件的源代码包装而成的,用户要安装这类RPM软件包,必须使用命令:
rpm --recompile vim-4.6-4.src.rpm   #这个命令会把源代码解包并编译、安装它,如果用户使用命令:

rpm --rebuild vim-4.6-4.src.rpm  #在安装完成后,还会把编译生成的可执行文件重新包装成i386.rpm 的RPM软件包。

[root@localhost src]# rpm -ivh awstats-6.8-1.noarch.rpm
error: Failed dependencies:
perl(LWP::UserAgent) is needed by awstats-6.8-1.noarch
[root@localhost src]#

使用rpm 属性相依套件的档案

[root@localhost src]# rpm -qpR awstats-6.8-1.noarch.rpm
/bin/sh
/usr/bin/perl
config(awstats) = 6.8-1
perl >= 0:5.005
perl(LWP::UserAgent)
perl(POSIX)
perl(Socket)
perl(Time::Local)
perl(strict)
perl(vars)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325753429&siteId=291194637