Rpm command manual and how to view the installation path of the rpm installation package

Source: Internet
Author: User
Tags rpmbuild
Rpm-qplxxxxxx.rpm1. installation of the rpm package rmp package can be done using the program rpm. Run the following command rpm-iyour-package.rpm where the your-package.rpm is the file name of the rpm package you want to install, typically placed under the current directory. Install

Rpm-qpl xxxxxx. rpm

1. how to install the rpm software package
You can use the program rpm to install the rmp package. Run the following command:
Rpm-I your-package.rpm
The your-package.rpm is the file name of the rpm package you want to install, usually under the current directory.
The following warning or prompt may appear during installation:
... Conflict with... may be that some files in the package to be installed may overwrite the existing
In this case, you cannot correctly install the file.
Rpm -- force-I force installation
... Is needed...
... Is not installed... some software required for this package can be used without installation
Rpm -- nodeps-I to ignore this information
That is to say, rpm-I -- force -- nodeps can ignore all dependencies and file problems.
Can be installed, but this forced installation of software packages cannot guarantee full functionality
2. how to install the. src. rpm software package
Some software packages end with. src. rpm. These software packages are rpm packages that contain source code.
Compilation is required. There are two installation methods for such software packages,
Method 1:
1. execute rpm-I your-package.src.rpm
2. cd/usr/src/redhat/SPECS
3. rpmbuild-bp your-package.specs a specs file with the same name as your package
4. cd/usr/src/redhat/BUILD/your-package/a directory with the same name as your package
5 ../configure this step is the same as compiling common source code software. you can add parameters
6. make
7. make install

Method 2:

1. execute rpm-I you-package.src.rpm

2. cd/usr/src/redhat/SPECS
The first two steps are the same as method 1.

3. rpmbuild-bb your-package.specs a specs file with the same name as your package
At this time, in/usr/src/redhat/RPM/i386/(depending on the specific package, it may be i686, noarch, etc)
There is a new rpm package under this directory, which is a compiled binary file.
Run the rpm-I new-package.rpm to complete the installation.

3. how to uninstall the rpm software package
Run the command rpm-e package name. The package name can contain the version number and other information, but cannot have a suffix. rpm.
For example, to uninstall a software package proftpd-1.2.8-1, you can use the following format:
Rpm e proftpd-1.2.8-1
Rpm e proftpd-1.2.8
Rpm-e proftpd-
Rpm-e proftpd
It cannot be in the following format:
Rpm e proftpd-1.2.8-1.i386.rpm
Rpm e proftpd-1.2.8-1.i386
Rpm e proftpd-1.2
Rpm e proftpd-1
Sometimes there are some errors or warnings:
... Is needed by... this indicates that this software is required by other software and cannot be detached.
You can use rpm-e -- nodeps to force uninstall
4. how to get files in the rpm package without installing
Use tools rpm2cpio and cpio
Rpm2cpio xxx. rpm | cpio-vi
Rpm2cpio xxx. rpm | cpio-idmv
Rpm2cpio xxx. rpm | cpio -- extract -- make-directories
The parameter I is the same as the extract parameter, indicating that the file is extracted. V indicates the execution process.
D is the same as make-directory, which indicates creating a directory based on the original path of the file in the package.
M indicates the file update time.

5. how to view files and other information related to the rpm Package

All of the examples below assume that the software package mysql-3.23.54a-11 is used
1. I installed those rpm packages in my system
Rpm-qa: list all installed packages
If you want to find all installed software packages that contain a string of SQL
Rpm-qa | grep SQL
2. how to obtain the full name of a software package file
Rpm-q mysql can obtain the full name of the mysql software package installed in the system.
The version of the current software package. The information mysql-3.23.54a-11 can be obtained in this example
3. where is the file in an rpm Package installed?
Rpm-ql package name
Note that the software package name does not include the. rpm suffix.
That is to say, you can only use mysql or mysql-3.23.54a-11 instead of mysql-3.23.54a-11.rpm.
If you just want to know where the executable program is put, you can also use which, such
Which mysql
4. files contained in an rpm Package
For a software package that has not been installed, use rpm-qlp *****. rpm
You can also use rpm-ql *****. rpm to install a software package.
5. how can I obtain the version, usage, and other information about a software package?
For a software package that has not been installed, use rpm-qip *****. rpm
You can also use rpm-qi *****. rpm to install a software package.

6. which software package is installed for a program or which package contains the program?
Rpm-qf 'which program name' returns the full name of the package
Rpm-qif 'which program name' returns information about the software package.
Rpm-qlf 'which program name' returns the package file list
Note: here is not a quotation mark, but ', which is the key in the upper left corner of the keyboard.
You can also use rpm-qilf to output the package information and file list at the same time.
7. which package is installed for a file or which package contains the file?
Note that the method in the previous question only applies to executable programs. the following method is not only applicable
It is used for executable programs or common files. The premise is that you know the file name.
First obtain the complete path of the program, you can use whereis or which, and then use rpm-qf for example:
# Whereis ftptop
Ftptop:/usr/bin/ftptop/usr/share/man/man1/ftptop.1.gz
# Rpm-qf/usr/bin/ftptop
Proftpd-1.2.8-1
# Rpm-qf/usr/share/doc/proftpd-1.2.8/rfc/rfc0959.txt
Proftpd-1.2.8-1
Summary:
To obtain information about the software package, use rpm-q and q to query the query. you can use other options, such
I indicates info to obtain information about the software package;
L indicates list to obtain the file list;
A indicates all and queries are executed in all packages;
F indicates file, which can be queried based on files;
P indicates the package, which is queried based on the software package.
The required query conditions can be generated using grep or from the command line in ''.

6. knowledge about rpm software packages

1. what is rpm?
Rpm (RedHat Package Management) is one of the RedHat inventions.

2. why rpm?
In an operating system, you must install software packages that implement various functions. These software packages generally have their own
Program, but there are also intricate dependencies. At the same time, we also need to solve the software package version and install it,
Configuration and uninstall automation issues. To solve these problems, RedHat puts forward
It is a good way to manage hundreds of thousands of software. This is the RPM Management system. The rpm management system is installed in the system.
In the future, as long as it is a package that meets the rpm file standards, you can easily install, upgrade, uninstall

3. is it true that all linux systems use rpm?
Any system requires a package management system, so many linux systems use the rpm system. However, the rpm system is dedicated for RH
However, systems such as TL and Mandrake also use rpm. Since rpm source programs can be compiled on other systems,
So it is possible to use rpm on other systems.
In addition to rpm, some other systems also have their own software package management programs, such as debian's deb package,
Slakware also has its own package management system.

4. Why is the file name of the rpm package so long?
The rpm package file name contains the version information, operating system information, and hardware requirements of the software package.
For example, the mypackage-1.1-2TL.i386.rpm where mypackage is the name of the software package registered in the system
1.1 indicates the software version number, 2 indicates the release number, TL indicates the TL operating system, or RH. I386 indicates
It is used on intel x86 platforms, or it may be a type.

5. what does i686 and i386 in the package file name mean?
The rpm package file name contains not only the software name and version information, but also the applicable hardware architecture.
.
I386 indicates that this software package is applicable to computers with intel 80386 or more x86 architectures (AI32)
I686 indicates that this software package is applicable to computers with x86 architectures (IA32) over intel 80686 (Pentium pro and above)
Noarch indicates that this software package is not related to the hardware architecture and can be used in general.
The program of the i686 software package is usually optimized for the CPU, so backward compatibility is used for comparison.
It can be used on x86 machines. Forward is generally incompatible. However, there are very few CPUs under the Pentium pro
Generally, the configured machine can use the i686 software package.

6. can rpm packages released by different operating systems be mixed?
For rpm packages that have been compiled into binary files, they cannot be mixed due to different operating systems.
For software packages released with src. rpm, since local compilation is required during installation
Install it in the system.

7. some special problems encountered when using rpm
Q I used rpm-e **. rpm to delete the rpm package.
Package A name does not include rpm,
Rpm-e package name, which can contain version numbers and other information, but cannot have a suffix. rpm
Q Is there any tool for reading RPM files in MS?
A wincmd with rpm plugins .....
Q Can I install and upgrade the rpm package through ftp?
A can. Rpm-ivh
Ftp: // xxxxxxxx/PATH2SomeRPM

Q What if the version of the existing package is too high during rpm installation?
A sometimes because the installed software package is too old, and the related software package version in the system is relatively new, it may need
Some files dependent on the installed package cannot be found. There are two solutions,
First, find the file with the same or similar functions as the desired file in the system file and make a symbolic link
Directory.


I know how to specify the installation path when installing the rpm Package in Linux, many of which are learned from the Internet. Please kindly advise.

The following options are the methods you want to complete.

-- Prefix
This sets the installation prefix For
Relocatable packages.

-- Relocate =
For relocatable packages, translates the files that
Wocould be put in To .

-- Badreloc
To be used in conjunction with -- relocate, this
Forces the relocation even if the package isn't
Relocatable.

-- Noorder
Don't reorder the packages for an install. The list
Of packages wocould normally be reordered to satisfy
Dependancies.

RPM command manual

I. Installation

Command format:

Rpm-I (or -- install) options file1.rpm... fileN. rpm

Parameters:

File1.rpm... fileN. rpm file name of the RPM package to be installed

Detailed options:

-H (or -- hash) outputs the hash mark (''#'') during installation (''#'')
-- Test only tests the installation and does not actually install it.
-- Percent: The installation progress is displayed as a percentage.
-- Excludedocs does not install the document files in the software package
-- Includedocs installation document
-- Replacepkgs force the installed software package to be reinstalled
-- Replacefiles: replace the files of other software packages.
-- Force ignores conflicts between software packages and files
-- Noscripts does not run the pre-installation and post-installation scripts
-- Prefix install the software package to the specified path
-- Ignorearch does not validate the structure of the software package
-- Ignoreos does not check the operating system of the software package.
-- Nodeps does not check dependencies
-- Ftpproxy is used as an FTP proxy
-- Ftpport specifies that the FTP port is

General options

-V: display additional information
-Vv: displays debugging information.
-- Root ask RPM to use the specified path as the "root directory", so that both the pre-installation program and the post-installation program will be installed in this directory.
-- Rcfile sets the rpmrc file
-- Dbpath: set the path of the RPM data inventory

II. delete

Command format:

Rpm-e (or -- erase) options pkg1... pkgN

Parameters

Pkg1... pkgN: package to be deleted

Detailed options

-- Test: only delete the test.
-- Noscripts does not run the pre-installation and post-installation script programs
-- Nodeps does not check dependencies

General options

-Vv: displays debugging information.
-- Root ask RPM to use the specified path as the "root directory", so that both the pre-installation program and the post-installation program will be installed in this directory.
-- Rcfile sets the rpmrc file
-- Dbpath: set the path of the RPM data inventory

III. upgrade

Command format

Copy codeThe code is as follows:
Rpm-U (or -- upgrade) options file1.rpm... fileN. rpm

Parameters

File1.rpm... fileN. rpm Package name

Detailed options

-H (or -- hash) outputs the hash mark (''#'') during installation (''#'')
-- Oldpackage allows "upgrade" to an old version
-- Test: only test the upgrade.
-- Excludedocs does not install the document files in the software package
-- Includedocs installation document
-- Replacepkgs force the installed software package to be reinstalled
-- Replacefiles: replace the files of other software packages.
-- Force ignores conflicts between software packages and files
-- Percent: The installation progress is displayed as a percentage.
-- Noscripts does not run the pre-installation and post-installation scripts
-- Prefix install the software package to the specified path
-- Ignorearch does not validate the structure of the software package
-- Ignoreos does not check the operating system of the software package.
-- Nodeps does not check dependencies
-- Ftpproxy is used as an FTP proxy
-- Ftpport specifies that the FTP port is

General options

-V: display additional information
-Vv: displays debugging information.
-- Root ask RPM to use the specified path as the "root directory", so that both the pre-installation program and the post-installation program will be installed in this directory.
-- Rcfile sets the rpmrc file
-- Dbpath: set the path of the RPM data inventory

IV. query

Command format:

Copy codeThe code is as follows:
Rpm-q (or -- query) options

Parameters:

Pkg1... pkgN: query installed software packages

Detailed options

-P (or ''-'') queries the file of the software package.
-F: query which software package belongs.
-A: query all installed software packages.
-- Whatprovides: a software package that provides functions for query
-G: query the software packages of the group.
-- Whatrequires: query all required software packages

Information options

Show all packages
-I: displays the summary of the software package.
-L display the file list in the software package
-C: Display the configuration file list
-D: Display the document file list
-S: displays the file list in the package and the status of each file.
-- Scripts displays scripts for installation, uninstallation, and validation
-- Queryformat (or -- qf) displays the query information in a user-specified manner.
-- Dump: displays all verified information for each file.
-- Provides: displays the functions provided by the software package.
-- Requires (or-R) shows the functions required by the software package

General options

-V: display additional information
-Vv: displays debugging information.
-- Root ask RPM to use the specified path as the "root directory", so that both the pre-installation program and the post-installation program will be installed in this directory.
-- Rcfile sets the rpmrc file
-- Dbpath: set the path of the RPM data inventory

5. verify installed software packages

Command format:

Copy codeThe code is as follows:
Rpm-V (or -- verify, or-y) options

Parameters

Pkg1... pkgN name of the software package to be verified

Package options

-P Verify against package file
-F verify the software package
-A Verify: verifies all software packages.
-G: verify all software packages belonging to the group

Detailed options

-- Noscripts does not run the validation script
-- Nodeps does not verify dependencies
-- Nofiles does not verify file attributes

General options

-V: display additional information
-Vv: displays debugging information.
-- Root ask RPM to use the specified path as the "root directory", so that both the pre-installation program and the post-installation program will be installed in this directory.
-- Rcfile sets the rpmrc file
-- Dbpath: set the path of the RPM data inventory

6. verify the files in the software package

Syntax:

Copy codeThe code is as follows:
Rpm-K (or -- checksig) options file1.rpm... fileN. rpm

Parameters:

File1.rpm... fileN. rpm package file name

Checksig -- detailed options

-- Nopgp does not verify the PGP signature

General options

-V: display additional information
-Vv: displays debugging information.
-- Rcfile sets the rpmrc file


VII. other RPM options

-- Rebuilddb: rebuilding the RPM database
-- Initdb creates a new RPM database
-- Quiet: reduce output as much as possible
-- Help: Display the help file
-- Version: displays the current version of RPM.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.