Common linux command RPM

Source: Internet
Author: User

Definition: RPM Package Manager.

Although marked by RedHat, its original design concept is open, including OpenLinux and S. u. s. e. as well as distribution versions of Linux such as Turbo Linux have been adopted, it can be regarded as an industry standard.

Common RPM parameters include:

-Vl: displays the installation progress;

-U: Upgrade the software package;

-Qpl: lists the file information in the RPM software package;

-Qpi: Describe the RPM software package;

-Qf: Find the RPM software package of the specified file;

-Va: checks all RPM software packages to find the lost files;

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 programs, but they also have intricate dependencies. It also needs to solve the software package version, installation, configuration, and uninstall automation problems. To solve these problems, RedHat puts forward a good way for its own system to manage thousands of software. This is the RPM management system. After the rpm management system is installed in the system, any package that complies with the rpm file standards can be easily installed, upgraded, and uninstalled.

3. Does all linux use rpm?

Any system requires a package management system, so many linux systems use the rpm System. The rpm System is the Software Package Manager of Redhat Linux and Fedora Core, but the Linux distributions such as Mandriva and SuSE also use rpm. Since the rpm source program can be compiled on other systems, 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.

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, in the mypackage-1.1-2RH.i386.rpm, mypackage is the name of the software package registered in the system. 1.1 is the software version number, 2 is the release number, and RH is used for the RH operating system. I386 indicates that it is used on intel x86 platform.

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 information about the applicable hardware architecture. I386 indicates the software package is applicable to computers with x86 architectures of intel 80386 or above (AI32) i686 indicates the software package is applicable to computers with x86 architectures of intel 80686 or above (Pentium pro or above) (IA32) noarch indicates that this software package has nothing to do with the hardware architecture and can be used universally. The i686 software package is generally optimized for the CPU. Currently, the i686 software package can be used for all machines configured.

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. Software packages released with src. rpm can be installed on different systems because local compilation is required during installation.

Ii. Usage of RPM package management

1. You can install, delete, upgrade, and manage software released in the form of rpm packages. 2. You can query which files are contained in an rpm package and which rpm package a specified file belongs; 3. Check whether an rpm package has been installed and its version in the query system. 4. As a developer, you can pack your own software into an rpm package for release. 5. Check the dependency, query the other rpm packages required when installing an rpm package. Note: Only root permissions are required for the installation, deletion, and update of RPM software. You can perform operations on the query function.

Iii. Simple rpm usage

General rpm format:

Rpm [Option] [rpm software package]

1. initialize the rpm database (which can be omitted)

Rpm -- initdbrpm -- rebuilddb % Note: This takes a long time. % Note: Sometimes an error occurs in the rpm System and cannot be installed or queried.

2. query functions of RPM software package management:

rpm -q [select-options] [query-options]

The query function of RPM is extremely powerful and one of the most important functions. Here are some common examples. For more details, refer to man rpm.

Query installed software in the system

1) query system installed software Syntax: rpm-q software name example: rpm-q mplayer %-q is -- query. This option indicates whether the gaim software package is installed; % information will be output if it has been installed; if it has not been installed, information about gaim not installed will be output; % view all installed packages in the system, add the-a parameter rpm-qa %. If you want to view the file by PAGE, add another pipeline. | and the more command rpm-qa | more % if you want to find a software package, you can use grep to extract rpm-qa | grep mplayer.
2) query the software package of an installed file. Syntax: rpm-qf file name note: the absolute path of the file name should be pointed out, for example, rpm-qf/usr/lib/libacl. la.
3) query where all installed software packages are installed. Syntax: rpm-ql software package name example: rpm-ql mplayer
4) query the information Syntax of an installed software package: rpm-qi package name example: rpm-qi mplayer
5) Check the configuration file of the installed software. Syntax format: rpm-qc software name example: rpm-qc mplayer
6) Check the installation path of a software installation document. Syntax format: rpm-qd software name example: rpm-qd mplayer
7) Check the software packages and files on which the installed software depends. Syntax: rpm-qR software name example: rpm-qR mplayerNote: You can combine several parameters, such as rpm-qil mplayer.

View uninstalled software packages: Check if a. rpm file already exists in the current directory.

1) view the purpose of a software package, version and other information; Syntax: rpm-qpi file. rpm example: rpm-qpi mplayer-1.0pre7try2-2.i386.rpm
2) view the file contained in a software package; Syntax: rpm-qpl file. rpm example: rpm-qpl mplayer-1.0pre7try2-2.i386.rpm
3) view the location of the software package documentation; Syntax: rpm-qpd file. rpm example: rpm-qpd mplayer-1.0pre7try2-2.i386.rpm
4) view the configuration file of a package; Syntax: rpm-qpc file. rpm example: rpm-qpc mplayer-1.0pre7try2-2.i386.rpm
5) view the dependency Syntax of a software package: rpm-qpR file. rpm example: rpm-qpR mplayer-1.0pre7try2-2.i386.rpm

3. Installation, upgrade, and deletion of software packages;Install and upgrade an rpm package

Syntax: rpm-ivh file. rpm % This is used to install a new rpm package rpm-Uvh file. rpm % is used to upgrade an rpm package % if there is a dependency, the dependency needs to be resolved. % If the dependency package cannot be found, run the following command to force the installation: rpm-ivh -- nodeps -- force file. rpm-Uvh -- nodeps -- force file. rpm example: rpm-ivh -- test mplayer-1.0pre7try2-2.i386.rpm % -- test indicates the test and is not actually installed. Rpm-ivh -- relocate/=/usr/local/mplayer mplayer-1.0pre7try2-2.i386.rpm % specifies the installation directory for the package: How do you call the -- relocate parameter % programs installed in the specified directory? % Executable programs are usually stored in the bin or sbin directory under the installation directory.

Delete an rpm package

First, find the rpm package to be deleted, and then run the following command to uninstall: rpm-e package name example: rpm-e mplayer % uninstall mplayer % if other RPMs depend on this rpm package, the system generates a warning. % If you must uninstall the service, you can use the -- nodeps option to ignore the dependency. But it is best not to do this.

Iv. RPM Management Package Manager supports network installation and query

Rpm [Option] the http or ftp address of the rpm package. For example, we want to query and install the software package through an image of Fedora Core 4.0. Rpm-qpi http://mirrors.kernel.org/.../RPMS/rsh-0.17-29.rpm% query rpm-ivh http://mirrors.kernel.org/.../RPMS/rsh-0.17-29.rpm% Installation

5. Some additional information for querying installed rpm packages

You can use locate to query the installation locations of some software. You may need to run updatedb to update the installed software library.

6. Extracting files from rpm Software Package

Rpm2cpio xxx. rpm | cpio-idmv % I indicates the file is extracted, v indicates the execution process % d indicates that the directory % m is created based on the original path of the file in the package, indicating that the file is updated.
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.