• notice
  • Congratulations on the launch of the Sought Tech site

Detailed usage notes of rpm command-Detailed explanation of rpm command

rpm command operations mainly include installation, query, uninstallation, and upgrade.

One, RPM installationCommand 

rpm -parameter The name of the package file to be installed

Common parameter combinations: -ivh: installation shows the installation progress -install--verbose--hash.The installation command is easier to understand.

Two, RPM query command
rpm -q…  q means query query.

    There are three query commands, one is to query the information of the installed rpm package (this package has been installed on the server), and the other is based on the specified rpm package (with the address of the package) ) Query the information attached to this package.The third type is to check which package was generated based on the installed file.

    1,Query the information of the installed rpm package: For example: [ root@kermit~]# rpm -qa jenkins can check whether jenkins is installed on the server.If it is installed, the installed package name will be listed without the.rpm suffix.

    Three parameters can be used when querying: -i Display the information of the installation package; -l show which directories all files in the installation package are installed into; -s show the status of all files in the installation version And the directory to which it is installed; the following two additional commands are used to specify whether to query the installation package or the installed file; for example

[ root@kermit local]# rpm -qa jenkins local]# rpm -qai jenkins Name : jenkins Relocations: (not relocatable)  Version : 2.9< span class="pln"> Vendor: < span class="pun">(none)  Release :  1.1 Build Date: Tue 14 Jun 2016 10:34:53 AM CST Install Date: Sat span> 12 Nov span> 2016 12 span>:56:49 PM CST Build Host:< span class="pln"> atlas Group :  Development/Tools/Building Source RPM: jenkins-2.9-1.1.src .rpm Size : 68831594 License: MIT/X License, GPL/CDDL, ASL2 Signature< span class="pln"> : DSA/SHA1, Tue 14 Jun 2016 10:34:57 AM CST, Key ID 9b7d32f2d50582e6 URL < /span>: http://jenkins.io/ Summary : Jenkins< /span> Continuous Integration< /span> Server Description< /span> : Jenkins< /span>monitors executions of repeated jobs, such as building a software project or jobs run by cron. Among those things, current Jenkins focuses on the following two jobs :... Authors: -------- Kohsuke Kawaguchi <span class="pln">span class="pln">kk@kohsuke .org> [ root@kermitlocal]# rpm -qas jenkins normal /etc/< span class="pln">init.d/jenkins normal /etc/ logrotate.d/jenkins normal /etc/sysconfig /jenkins normal /usr< /span>/lib/ jenkins normal /usr/lib/jenkins/jenkins.< /span>war normal /usr/sbin/rcjenkins normal /var/cache/ jenkins normal /var/lib/jenkins normal /var/log/ jenkins [root@kermit local]# 
     2.Query the information of the local rpm package: For example:[ root@ kermit ~]# rpm -qp Installation package path.This query is the same as above, and can also take -i, -l, -s parameters.What is listed is not the installed information, but the information in the currently specified rpm file.These three parameters can also be used together.But it makes no sense.

[ root@ kermit local]# rpm -qp /usr/local/jenkins-2.9-1.1.noarch.rpm jenkins-2.9-1.1.local]# rpm -qpi /usr/local/jenkins-2.9-1.1.noarch.rpm Name: jenkins Relocations: (not relocatable) Version: 2.9 Vendor: (none) Release: 1.1 Build Date: Tue 14 Jun 2016 10:34 :53 AM CST Install Date: (not installed) Build Host: atlas Group: Development/Tools/Building Source RPM: jenkins-2.9-1.1.src.rpm Size: 68831594 License: MIT/X License, GPL/CDDL, ASL2 Signature : DSA/SHA1, Tue 14 Jun 2016 10:34:57 AM CST, Key ID 9b7d32f2d50582e6 URL: http://jenkins.io/ Summary: Jenkins Continuous Integration Server Description: Jenkins monitors executions of repeated jobs, such as building a software project or jobs run by cron.Among those things, current Jenkins focuses on the following two jobs:...Authors: -------- Kohsuke Kawaguchi @kohsuke.org>< /span> [root@kermit local]# rpm -qpl /usr/local/jenkins-2.9-1.1.noarch.rpm /etc/init.d/jenkins /etc/logrotate.d/jenkins /etc/sysconfig/jenkins /usr/lib/ jenkins /usr/lib/jenkins/jenkins.war /usr/sbin/rcjenkins /var/cache/jenkins /var/lib/jenkins /var/log/jenkins [ root@kermit local]# 
     3.According to the specified file (file generated after installation) to check the information of the installation package, use [ root@kermit ~]#  rpm -qf specifies the file address.The same can also take -i, -l, -s parameters.For example, we saw above that there will be a file /usr/lib/jenkins/jenkins.war after the installation package is installed, so we can check it through this file.Examples are as follows:

[ root@kermitlocal]# rpm -qf /usr/lib/jenkins/jenkins.war jenkins-2.9-1.1.noarch [ root@kermitlocal]# rpm -qfi /usr/lib/jenkins/jenkins.war Name : jenkins Relocations: (not relocatable) Version : 2.9< /span> Vendor: < /span>(none) Release : 1.1 Build Date< span class="pun">: Tue < span class="lit">14 Jun < span class="lit">2016 10: 34:53 AM CST Install Date: Sat 12 Nov 2016 12:56:49 PM CST < /span>Build Host:  atlas Group  : Development/Tools/Building Source RPM : jenkins-2.9 span>-1.1.src .rpm Size : 68831594 License< span class="pun">: MIT/X License, GPL/< /span>CDDL, ASL2  Signature : DSA/SHA1, Tue 14 Jun 2016 10: span>34:57 AM CST, Key ID 9b7d32f2d50582e6 URL : http://jenkins.io/< /span> Summary : Jenkins Continuous Integration Server Description : Jenkins monitors executions of repeated jobs, such as building a software project or jobs run by cron. Among those things , current Jenkins focuses on the following two jobs:... Authors: -------- Kohsuke Kawaguchi </span>/span>kk@kohsuke .org> [ root@kermitlocal]# rpm -qfl /usr/lib/jenkins/jenkins.war /etc/init.d/jenkins /etc/logrotate.d/jenkins /etc/sysconfig< /span>/jenkins / usr/lib/jenkins /usr/lib/jenkins/jenkins.< /span>war /usr /sbin/rcjenkins /var/cache/jenkins /var/lib< /span>/jenkins / var/log/jenkins [root@kermitlocal]# rpm -qfs /usr/lib/jenkins/jenkins.war normal /etc/init.d/jenkins normal /etc /logrotate.d/jenkins normal < /span>/etc/ sysconfig/jenkins normal /usr/lib/jenkins normal /usr/lib/jenkins/jenkins.war normal /usr< span class="pun">/sbin/rcjenkins normal /var/cache/jenkins normal /var/lib/jenkins normal /var/log/< /span>jenkins [root@kermit local]# 
Three, RPMUninstall command
rpm -e installation package that needs to be uninstalled

However, 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. The uninstall command is also relatively simple.

Four.RPM upgrade command

rpm -U Packages that need to be upgraded

There are other RPM verification operations.RPM verification command: rpm -V The package to be verified.The commonly used parameter combinations of RPM are as follows:

-Uvh: Upgrade package--Update;
-qpl: List file information in RPM software package [Query Package list];

Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+