Common commands of yum and rpm and Common commands of yumrpm
Directory
Installation Package of common command packages for yum and rpm query package uninstalling all other options for yum and rpm all options in yum
Common commands for yum and rpm
Yum and rpm have many usage methods. I will only introduce what we may encounter frequently. If it is not commonly used, it will be pasted to the end of the article.
Installation of software packages
Use rpm-ivh package_name when installing the rpm installation package
Instance: rpm-ivh screen-4.0.3-19.el6.x86_64
Force installation: rpm-ivh package_name -- force (universal installation option) syntax format of the yum Installation Software: yum install package_name
Instance: yum install screen-4.0.3-19.el6.x86_64.rpm
Query a software package
The query of a software package can be used together with the installation and uninstallation of the software package. When we only know the package file but not the package name, or only know the keyword of the package name, we can use this to search, then install or uninstall the package.
Query in rpm. Syntax: rpm-qa | grep keyword
Instance: rpm-qa | grep screen, which filters out the desired results and then performs corresponding operations. Query in yum
Method 1: Syntax: yum list installed | grep keyword
Instance: yum list installed | grep screen Method 2: Syntax: yum provides keyword
Instance: yum provides screen
Uninstall the Software Package
Uninstall syntax in rpm: rpm-e package name
Example: uninstall syntax in rpm-e screen yum: yum remove package name
Instance: yum remove screen-4.0.3-19.el6.x86_64.rpm
The above are some of our commonly used commands. We usually use these three commands, which combine queries with the other two to complete most of our operations.
[Note]: When installing and uninstalling the package, yum is able to install the package dependency. Some rpm commands that cannot be installed at one time can be installed with yum. In addition, we can use this command when uninstalling this link. Yum history undo 4 where 4 is the fourth in the list and Undo is reverse execution. As shown in the figure, the first is an installation command, and the reverse is to uninstall it. If we use yum to install five packages based on dependencies, when we use undo, we can reverse uninstall these five packages.
All other options for yum and rpm
All options in rpm
Rpm-I installation-v display process-vv display detailed process-h display progress-ivh common installation options-nodeps ignore dependency detection-replacepkgs repeat installed packages, file Overwrite -- replacefiles part of the package to be installed conflicts with other Installed Package files. You can continue to install the package without overwriting -- nosignature: do not check source legitimacy -- nodigest: do not check package Integrity -- noscripts: do not execute the package script % pre: script before installation; -- nopre % post: script after installation; -- nopost % preun: uninstall the script before installation; -- nopreun % postun: script after uninstallation; -- The package specified by nopostun-U is newer than the package that has been installed or the package specified by-F is newer than the package that has been installed -- the package specified by oldpackage is older than the package that has been installed -- force -- replacepkgs, -- replacefiles, -- oldpackage-q query whether the package is installed-qa query all packages installed-qf file path query which rpm package the specified file comes from-ql package name query which files the package provides -qp # rpm package for uninstalled packages, specify the rpm file and use other query sub-options to perform various query operations-q -- changelog package name view update log-qc package name view the configuration file provided by the software package-qd package name View document file provided by the software package-qi package name View Details of the software package-q -- scripts view the script before and after installation-q -- provides package name view a software package provides capabilities-qR package name view the capabilities on which a software package is running-q -- whatprovides capability name check which package provides a capability-q -- whatrequires capability name to check which capabilities are dependent on package-e uninstall-e package name rpm-e 'rpm-q vsftpd 'or rpm-e vsftpd -- allmatches if multiple versions are installed, one rpm can be deleted at a time -- When nodeps is deleted do not check dependencies-V verify which files of installed packages have been changed or lost, the change type is as follows: S file Size differs M Mode differs (includes permissions and file type) 5 digest (formerly MD5 sum) differs D Device major/minor number mismatch L readLink (2) path mismatch U User ownership differs G Group ownership differs T mTime differs P capabilities differ-K rpm package verification package validity -- import public key import Public Key rpm-qa "gpg-pubkey *" query Public Key rpm-e 'rpm-qa "gpg-pubkey *" 'Delete the public key -- initdb initialization/var/lib/rpm database -- rebuilddb re-build the Baotou INDEX DIRECTORY
All options in yum
Yum repolist all show all repositories enabled show enabled repositories disabled show disabled repositories yum list [all] available show all available, uninstalled installed displays all installed packages. updates displays the updatable packages. yum install pkg1 [pkg2] yum reinstall pkg1 [pkg2] yum update [pkg1] [pkg2] yum list updates or yum check-update yum erase or yum remove yum info pkg1 display package details yum provides | whatprovides file path (Supports file name wildcards) queries the rpm package from which a file comes, whether or not yum clean all is installed to clear the cache yum makecache yum dep List pkg1 query the capabilities on which the specified package depends yum history display yum history operation yum history info # detailed display of a history yum history undo # undo a yum operation yum localinstall | install install the local rpm package in the rpm path, use yum to solve the dependency relationship yum localupdate | update rpm path to update the local rpm package, use yum to solve the dependency relationship yum groupinstall grppkg1 grouplist to list all the packet groups groupinfo grppkg1 display the rpm package contained in this package group groupremove grppkg1 unmount the packet group yum install -- nogpgcheck temporarily does not perform gpg check, avoid silent interactive q. However, it is not thorough. We recommend that you use yum-y install vsftpd &>/dev/null createrepo to store the rpm path.