rpm command parameters (reproduced)

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.

I don't know what it's used for, but I only know that you can check whether a software is installed. For example: rpm -qa |grep rsync
-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, not actually install
--nodeps ignore package dependencies and force installation
--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 fileCommand
format
rpm {-q|–query} [select-options] [query-options]
The query function of RPM is extremely powerful and one of the most important functions; for more details, please refer to #man rpm
1. Query the installed software in the system;
1) Query the installed software in the system;
syntax: rpm -q Software name
example:
[root@localhost beinan]# rpm -q gaim
gaim-1.3.0-1 .fc4
-q is –query, which means “ask” in Chinese. This command indicates whether gaim is installed in the system; if it is installed, it will output information; if it is not installed, it will output information that gaim is not installed;
check the system Add the
-a parameter
to all installed packages in Find a certain software in the installed package, such as gaim; you can use grep to extract it; [root@localhost RPMS]# rpm -qa |grep gaim The function above is the same as the output of rpm -q gaim ; 2) Query which software package an installed file belongs to; syntax rpm -qf file name Note: The absolute path where the file name is located should be indicated . Example:








[root@localhost RPMS]# rpm -qf /usr/lib/libacl.la
libacl-devel-2.2.23-8
3) Query where the installed packages are installed;
syntax: rpm -ql software name or rpm rpmquery -ql Software name
example:
[root@localhost RPMS]# rpm -ql lynx
[root@localhost RPMS]# rpmquery -ql lynx
4) Query the information of an installed software package
Syntax format: rpm -qi Software name
example:
[root @localhost RPMS]# rpm -qi lynx
5) Check the configuration file of the installed software;
syntax format: rpm -qc Software name
example:
[root@localhost RPMS]# rpm -qc lynx
6) Check the documentation of an installed software Installation location:
Syntax format: rpm -qd Software name
example:
[root@localhost RPMS]# rpm -qd lynx
7) Check the software packages and files that the installed software depends on;
Syntax format: rpm -qR Software name
example:
[ root@localhost beinan]# rpm -qR rpm-python
Query the summary of installed software: For a software package has been installed, we can combine a series of parameters; such as rpm -qil; such as:
[root@localhost RPMS]# rpm -qil lynx
delete an rpm package;
first you To learn to query rpm packages; please see the previous instructions;
[root@localhost beinan]#rpm -e Package name
example: I want to remove the lynx package, the complete operation should be:
[root@localhost RPMS]# rpm -e If lynx
has dependencies, you can also use --nodeps to ignore the check for dependencies to remove them. But try not to do this, it is better to use the package manager systerm-config-packages to remove or add software;
[root@localhost beanan]# rpm -e lynx –nodeps

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

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 Force the package to be installed regardless of whether the package is already installed
--test Install tests without actually installing
--nodeps Ignore package dependencies Relational forced installation
--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 source package installation

Files ending with .src.rpm, these files are packaged by the source code of the software. To install such RPM packages, users must use the command:

rpm --recompile vim-4.6-4.src.rpm #This command will unpack the source code and compile and install it, if the user uses the command:

rpm --rebuild vim-4.6-4.src.rpm #After the installation is complete, it will also repackage the compiled executable file into the RPM package of i386.rpm.

Guess you like

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