RPM is the abbreviation for "Redhat package Manager". RPM is a set of management programs for database records that install Linux hosts in the way we need the packages. In other words, there is a database on RPM in a Linux system that records the installed packages and dependencies between packages and packages. RPM package is pre-compiled on the Linux machine and packaged files, installation is very fast, but the disadvantage is that the installation of the environment must be consistent with the compile-time environment or equivalent, there is a dependency between package and package, uninstall needs to be removed from the package since the first. If the dependent package is required by the system, you cannot unload the package, or it will cause the system to crash.
We can take a look at the RPM package in the system installation CD and mount the optical drive to the/MNT directory:
[[email protected] ~]# mount /dev/cdrom /mnt/mount: block device /dev/ sr0 is write-protected, mounting read-only[[email protected] ~]# ls / mnt/centos_buildtag isolinux RPM-GPG-KEY-CentOS-Debug-6EFI Packages RPM-GPG-KEY-CentOS-Security-6EULA RELEASE-NOTES-en-US.html rpm-gpg-key-centos-testing-6gpl repodata trans. tblimages rpm-gpg-key-centos-6[[email protected] ~]# ls /mnt/packages/|head389-ds-base-1.2.11.15-60.el6.x86_64.rpm389-ds-base-libs-1.2.11.15-60.el6.x86_ 64.rpmabrt-2.0.8-34.el6.centos.x86_64.rpmabrt-addon-ccpp-2.0.8-34.el6.centos.x86_64. Rpmabrt-addon-kerneloops-2.0.8-34.el6.centos.x86_64.rpmabrt-addon-python-2.0.8-34.el6.centos.x86_64. Rpmabrt-cli-2.0.8-34.el6.centos.x86_64.rpmabrt-desktop-2.0.8-34.el6.centos.x86_64. rpmabrt-gui-2.0.8-34.el6.centos.x86_64.rpmabrt-libs-2.0.8-34.el6.centos.x86_64.rpm
RPM Installation and uninstallation
Install a RPM package
[Email protected] ~]# rpm-ivh/mnt/packages/libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64.rpm Preparing ########################################### [100%] 1:libjpeg-turbo-devel ############# ############################## [100%]
command RPM-IVH filename
-I: Installation meaning
-V: Visualize
-H: Show installation progress
The following parameters are commonly used when installing RPM packages:
--force: Force the installation, even if overwriting files belonging to other packages.
--nodeps: When the RPM package to be installed depends on other packages, install this package even if the other packages are not installed.
Upgrade a RPM Package
Command RPM-UVH filename
-U: The Meaning of the upgrade
uninstalling an RPM package
Command RPM-E filename
When uninstalling the filename and installation is different, when the installation is an existing file as a parameter, and uninstall only need to package name.
RPM Query
query whether an RPM package is installed
Command rpm-q RPM Package name (here the package name is not with the platform information and suffix name)
[Email protected] ~]# rpm-q libjpeg-turbo-develpackage libjpeg-turbo-devel are not installed[[email protected] ~]# rpm-i Vh/mnt/packages/libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64.rpmpreparing ... ################################# ########## [100%] 1:libjpeg-turbo-devel ########################################### [100%][[email protected] ~]# rpm -Q libjpeg-turbo-devellibjpeg-turbo-devel-1.2.1-3.el6_5.x86_64
You can use RPM-QA to query all installed RPM packages of the current system
[Email protected] ~]# Rpm-qa |headim-chooser-1.3.1-3.el6.x86_64setup-2.8.14-20.el6_4.1.noarchibus-1.3.4-8.el6.x86 _64xml-common-0.6.3-33.el6.noarchfontpackages-filesystem-1.41-1.1.el6.noarchiso-codes-3.16-2.el6.noarchkbd-misc-1.15-11.e L6.noarchdmz-cursor-themes-0.4-4.el6.noarchpolicycoreutils-2.0.83-24.el6.x86_ 64ncurses-base-5.7-4.20090207.el6.x86_64
get information about an installed RPM package
Command RPM-QI Package name (also does not need to add platform information and suffix name)
[[email protected] ~]# rpm -qi libjpeg-turbo-develname : libjpeg-turbo-devel relocations: (not relocatable) version : 1.2.1 vendor: centosrelease : 3.el6_5 build date: 2013 December 10 Tuesday 07 37 minutes 03 seconds Install date: 2016 May 15 Sunday 00 08 minutes 36 seconds Build Host: c6b10.bsys.dev.centos.orggroup : development/libraries Source RPM: libjpeg-turbo-1.2.1-3.el6_5.src.rpmSize : 321085 license: wxwidgetssignature : rsa/sha1, 2013 December 10 Tuesday 09 01 minutes, 18 seconds, key id 0946fca2c105b9depackager : centos buildsystem
List A RPM package installation file
Command RPM-QL Package Name
[Email protected] ~]# RPM-QL libjpeg-turbo-devel/usr/include/jconfig.h/usr/include/jerror.h/usr/include/ jmorecfg.h/usr/include/jpeglib.h/usr/lib64/libjpeg.so/usr/share/doc/libjpeg-turbo-devel-1.2.1/usr/share/doc/ libjpeg-turbo-devel-1.2.1/coderules.txt/usr/share/doc/libjpeg-turbo-devel-1.2.1/example.c/usr/share/doc/ libjpeg-turbo-devel-1.2.1/jconfig.txt/usr/share/doc/libjpeg-turbo-devel-1.2.1/libjpeg.txt/usr/share/doc/ Libjpeg-turbo-devel-1.2.1/structure.txt
by the above command you can see the installation of "Libjpeg-turbo-devel" this RPM package to get these files. You can also find RPM packages with known files.
List which rpm package a file belongs to
Absolute path to the command RPM-QF file
[Email protected] ~]# rpm-qf/usr/lib64/libjpeg.solibjpeg-turbo-devel-1.2.1-3.el6_5.x86_64
This article is from the "Learn Notes for students" blog, please make sure to keep this source http://sanyisheng.blog.51cto.com/11154168/1795716
RPM Install and uninstall RPM query