Installation and Uninstallation of RPM Packages under Linux

Under the Linux operating system, almost all software is installed, uninstalled and managed through RPM. The full name of RPM is Redhat Package Manager, which is proposed by Redhat Corporation and is used to manage software packages under Linux. When installing Linux, except for a few core modules, almost all the modules are installed through RPM. RPM has five modes of operation: install, uninstall, upgrade, query, and verify.

RPM installation operations

Order:

rpm -i package file name to be installed

An example is as follows:

rpm -i example.rpm install example.rpm package;

rpm -iv example.rpm installs the example.rpm package and displays information about the files being installed during the installation process;

rpm -ivh example.rpm installs the example.rpm package and displays the information of the files being installed and the installation progress during the installation process;

RPM query operations

Order:

rpm -q …

Additional query commands:

a Query all installed packages The following two additional commands are used to query information about installation packages;

i Display the information of the installation package;

l Display the directories in which all files in the installation package are installed;

s Displays the status of all files in the installed version and which directories are installed; the following two additional commands are used to specify whether the installation package or the installed files need to be queried;

p queries the information of the installation package;

f Query is the installed file information;

An example is as follows:

rpm -qa | grep tomcat4 to see if tomcat4 is installed;

rpm -qip example.rpm View the information of the example.rpm installation package;

rpm -qif /bin/df View the information of the installation package where the /bin/df file is located;

rpm -qlf /bin/df View the directory where each file in the installation package where the /bin/df file is located is installed;

RPM uninstall operation

Order:

rpm -e installation package that needs to be uninstalled

Before uninstalling, you usually need to use the rpm -q ... command to find out the name of the installation package that needs to be uninstalled.

An example is as follows:

rpm -e tomcat4 uninstall tomcat4 package

RPM upgrade operation

Order:

rpm -U packages that need to be upgraded

An example is as follows:

rpm -Uvh example.rpm upgrade example.rpm package

RPM verification operation

Order:

rpm -V packages that need to be verified

An example is as follows:

rpm -Vf /etc/tomcat4/tomcat4.conf

The output information is similar to the following:

S.5....T c /etc/tomcat4/tomcat4.conf

Among them, S indicates that the file size has been modified, and T indicates that the file date has been modified. Due to space limitations, please refer to the rpm help file for more verification information: man rpm

Additional commands for RPM

--force Force operations such as forced installation and deletion;

--requires show the dependencies of the package;

--nodeps ignore dependencies and continue;

 

------------------------------------------------------------------------------------

 

 Install to the specified directory using the relocate parameter

rpm -ivh --relocate /=/opt/temp xxx.rpm;

Install with prefix:

rpm -ivh --prefix= /opt/temp  xxx.rpm

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326565450&siteId=291194637