RPM installation command in Linux command


Under the Linux operating system, almost all software are installed, uninstalled and managed by rpm. The full name of RPM is RedHat package manager, which is proposed by RedHat company to manage software packages under Linux. During Linux Installation, except for several core modules, almost all other modules are installed through rpm. RPM has five modes of operation: install, uninstall, upgrade, query, and verify.

1) To install the software package with RPM, the simplest command is as follows:

#RPM - I example.rpm install the example.rpm package;
 #RPM - IV example.rpm install the example.rpm package and display the file information being installed during the installation;
 #RPM - IVH example.rpm install the example.rpm package and display the file information and installation progress during installation

2) Remove installed packages

To uninstall the package example, simply type the following line:

# rpm -e example

Note: the package name is example, not the RPM filename “example. Rpm.”.

3) Upgrade package

Upgrading software is similar to installing software:

# rpm -Uvh example.rpm

Users should note that RPM will automatically uninstall the old version of the corresponding package. If the configuration file of the old version of the software is not compatible with the new version, RPM will automatically save it as another file, and the user will see the following information:

saving /etc/example.conf as /etc/example.conf.rpmsave

In this way, the user can manually change the corresponding configuration file.

In addition, if the user wants to install the old version of the software, the user will see the following error message:

# rpm -Uvh example.rpm
examle packag example-2.0-l(which is newer) is already installed
error:example.rpm cannot be installed

Use the – oldpackage parameter if you want to force the installation.

4) Query package

Users can use rpm-q to query the corresponding software in the RPM database. RPM will give the name, version and release version number of the software package, for example:

 # rpm -q example

Here are the specific parameters you can use when querying:

-A: query all software packages currently installed in the system.
-F file name: query the package including the file.
-F: the same as the – f parameter, but the input is standard (for example, find / usr / bin | RPM – QF)
-Q package name: query the package
-Q: the same as the – P parameter, but the input is standard (for example, find / MNT / CDROM / RedHat / RPMs | RPM – QQ)

Here is the format selection for output:

-I display the name, description, distribution, size, compilation date, installation date, developer and other information of the software package.
-L display the files contained in the package
-S shows the current status of the files contained in the package. There are only two statuses: normal and missing
-D display the documents in the package (such as man, info, README, etc.)
-C shows the configuration files in the software package. These files are usually manually modified by the user after installation, such as sendmail.cf, passwd, inittab, etc
If you use the – V parameter, you can get output similar to ls-l

5) Verifying software package with RPM

RPM - VF needs to be verified to package

RPM practical skills!

1) Users can install packages through FTP. If users can connect to the network and want to install a new package, they can directly use its URL address to install:
For example, now you have this package under ftp.linuxsir.com/pub/linux/redhat/rpms/: foo-1.0-1.i386.rpm. You can use this command:

 # rpm -i ftp.linuxsir.com/pub/linux/redhat/RPMS/foo-1.0-1.i386.rpm 

To install, you can also query!

2) If you accidentally delete several files, but you are not sure which ones are, you want to check the whole system to find out which parts may be damaged. You can use:

 # rpm -Va 

3) If a user encounters a file that can’t come out and wants to know which package it belongs to, he can do this:

# rpm -qf /usr/X11R6/bin/xjewel 

The result is the following information:


4) If the user gets a new RPM file, but does not know its contents; or wants to know which files a package will install in the system, you can do this:

 # rpm -qpi koules-1.2-2.i386.rpm 

The above is the RPM installation command in the Linux command that Xiaobian introduced to you. I hope it can help you. If you have any questions, please leave a message and Xiaobian will reply you in time. Thank you very much for your support of the developepaer website!