1. Introduction to RPM 1. what is rpm? Rpm (RedHatPackageManagement) 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. At the same time, we also need to solve the software package version and install it. configuration 1. RPM introduction
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 that the software package is applicable to computers with x86 architectures (AI32) of intel 80386 or above, and i686 indicates that the software package is applicable to computers with x86 architectures (IA32) of intel 80686 or above (Pentium pro or above ), 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 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. developers can pack their own software into rpm packages for release;
5. check the dependency and query the other rpm packages required when installing an rpm package.
Note: Only root permissions can be used to install, delete, and update RPM software;
Any user can operate 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 -- initdb
Rpm -- rebuilddb % Note: This takes a long time
% Note: Sometimes the rpm system is faulty 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 is already installed; if it is not installed, gaim will not be installed;
% To view all installed packages in the system, add the-a parameter
Rpm-qa
% Add an MPs queue if you view it by page | and more
Rpm-qa | more
% If you want to find a software package, you can use grep to extract it.
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 must be specified.
Example: rpm-qf/usr/lib/libacl. la
3) query where all installed software packages are installed;
Syntax: rpm-ql package name
Example: rpm-ql mplayer
4) query the information of an installed software package
Syntax: 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) view the installation location 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 software is installed;
Syntax: rpm-qR software name
Example: rpm-qR mplayer
Note: you can combine several parameters, such as rpm-qil mplayer.
View uninstalled software packages: check that a. rpm file already exists in the current directory.
1) view the purpose and version of a software package;
Syntax: rpm-qpi file. rpm
Example: rpm-qpi mplayer-1.0pre7try2-2.i386.rpm
2) view the files contained in a software package;
Syntax: rpm-qpl file. rpm
Example: rpm-qpl mplayer-1.0pre7try2-2.i386.rpm
3) view the document location of the software package;
Syntax: rpm-qpd file. rpm
Example: rpm-qpd mplayer-1.0pre7try2-2.i386.rpm
4) view the configuration file of a software package;
Syntax: rpm-qpc file. rpm
Example: rpm-qpc mplayer-1.0pre7try2-2.i386.rpm
5) view the dependency of a software package
Syntax: rpm-qpR file. rpm
Example: rpm-qpR mplayer-1.0pre7try2-2.i386.rpm
3. install, upgrade, and delete the software package. install and upgrade an rpm package.
Syntax:
Rpm-ivh file. rpm % This is used to install a new rpm Package
Rpm-Uvh file. rpm % This is used to upgrade an rpm Package
% If dependency exists, the dependency must be resolved.
% If the dependency package cannot be found, use the following command to force installation:
Rpm-ivh -- nodeps -- force file. rpm
Rpm-Uvh -- nodeps -- force file. rpm
Example:
Rpm-ivh -- test mplayer-1.0pre7try2-2.i386.rpm
% -- Test indicates that the test is not actually installed.
Rpm-ivh -- relocate/=/usr/local/mplayer mplayer-1.0pre7try2-2.i386.rpm
% Specify the installation directory for the software package: add the -- relocate parameter
% How do I call a program installed in a 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 run the following command to uninstall it:
Rpm-e package name
Example: rpm-e mplayer % uninstall mplayer
% If other RPMs depend on the 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 software packages 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
% Install
5. some supplements to query installed linux 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 extracting files, and v indicates executing processes.
% D indicates creating a directory based on the original path of the file in the package
% M indicates the file update time.