Use of RPM packages:
RPM Package Naming format:
SOURCE program: Name-version.tar. {GZ|BZ2|XZ} packaged together source code
Version:major.minor.release
RPM Package: name-version-release.arch.rpm This is a packaged binary program.
Release: usually contains the RPM production release number and also includes the applicable OS
Arch: What kind of hardware architecture does this work on, and how many bits
Example: bash-4.3.2-2.el6.x86_64.rpm
OS Platform:
El6:redhat Enterprise Linux 6
El5:
CentOS5
CentOS6
Suse11
Arch
x86_64
i386, i586, i686
Ppc
Noarch
nginx-1.4.16-5.noarch.rpm
For example, a source: There are 10 features
Most users use only 6 of their features, the remaining 4?
Subcontracting: Packaging A large program into multiple packages
Main package: bash-4.3.2-2.el6.x86_64.rpm
Support Package: bash-hello-4.3.2-2.el6.x86_64.rpm
bash-world-4.3.2-2.el6.x86_64.rpm
Dns:bind, Bind-devel, Bind-libs, bind-utils
Verification of source legality:
SOURCE program: Through MD5 or SHA1 check code verification;
RPM Package: The legitimacy provided by publishers is credible
Verification Package Integrity: check code
Positive source legal: public key, using private key encryption, external public key decryption, can be decrypted, it can be considered as the original author
Ways to get the RPM package:
1, the publisher's CD-ROM or site server
Take CentOS for example:
Http://mirrors.163.com
Http://mirrors.sohu.com
The following two are used to find the RPM package
2, Http://rpmfind.net
3, Http://rpm.pbone.net
Attention:
1, the publisher, the issue of CD-ROM package, the need to upgrade, the official release of the upgrade package;
2, Fedora EPEL There are a lot of RPM packages
RPM Package Management: Installation
Use wget+ address to download rpm
Rpm-i,--install
# rpm-i/path/to/rpm_package ...
-V:
-VV:
-VVV:
-h:hash, the number of # shows the installation progress, a # represents 2% progress;
--test: Testing only, not actually performing the installation process
If there is a dependency:
Resolving dependencies
Ignore dependencies:--nodeps
Reinstall:
-IVH--replacepkgs
The original profile is not overwritten, and the newly installed profile will be renamed to a file with a. rpmnew suffix;
RPM Package Management: Uninstall
RPM-E,--erase
RPM-E package_name
If you uninstall a package that is dependent on another program:
1, the dependence of the unloading together;
2, ignore the dependency relationship;
--nodeps
3, no longer uninstall
RPM Package Management: Query
Rpm-q
To query all installed packages: RPM-QA
Query Package description information: Rpm-qi package_name
Name:bash Relocations: (not relocatable) does not support relocation
version:4.1.2 Vendor:centos
Release:15.el6_4 Build date:thu 09:21:24 PM CST
Install date:wed 09:48:43 AM CST Build Host:c6b10.bsys.dev.centos.org (System)
Group:system environment/shells Source rpm:bash-4.1.2-15.el6_4.src.rpm
size:3139291 license:gplv3+
SIGNATURE:RSA/SHA1, Thu 09:46:10 PM CST, Key ID 0946fca2c105b9de
Packager:centos Buildsystem
Url:http://www.gnu.org/software/bash Source Address
Summary:the GNU Bourne Again Shell
Description:
The GNU Bourne Again Shell (Bash) is a shell or command language
Interpreter that's compatible with the Bourne shell (SH). Bash
Incorporates useful features from the Korn shell (Ksh) and the C shell
(CSH). Most SH scripts can is run by bash without modification.
To query whether a single package is installed: Rpm-q package_name
After the query package is installed, in the current system generation file list: RPM-QL (list) package_name
This is to see after the installation of the program, are scattered in which directories, RPM package installed in the/BIN/SBIN/LIB/ETC and other such directories, including binary programs, libraries or configuration files
Query which package the file is built from: rpm-qf/path/to/somefile
[Email protected] ~]# RPM-QF/ETC/PASSWD
Setup-2.8.14-20.el6_4.1.noarch can see that/etc/passwd is the file that was generated after the setup package was installed
Help documents generated after query package installation: RPM-QD package_name
View the directory where the Help documentation for a package is produced after it is installed
Configuration files generated after query package installation: RPM-QC package_name
See where the configuration files for the package installation users are
[Email protected] ~]# RPM-QC bash
/etc/skel/.bash_logout
/etc/skel/.bash_profile
/etc/skel/.bashrc
Query package-related scripts: Rpm-q--scripts package_name
There are four types of scripts:
Preinstall: Pre-installation script
Postinstall: Post-installation script
Preuninstall: Pre-uninstall script
Postuninstall: Post-uninstallation script
Query for information about RPM package files that have not been installed: Q Change to QP
List of files that will be generated after the query is installed: RPM-QPL (list)/path/to/package_file here to parking file, not only with the name, because it is not installed
Query its simple description information: Rpm-qpi (information)/path/to/package_file
RPM Package Upgrade:
Rpm-u: Upgrade or install
Rpm-f: Upgrade
RPM {-UVH|-FVH}/path/to/package_file file
--nodeps: Ignoring dependencies
--force: Forced installation
Note: Do not perform upgrade operations on the kernel;
Multiple versions of the kernel can coexist, therefore, it is recommended to perform installation operations;
RPM Package Management: Checksum
Check if the files generated after the package installation have been modified;
Rpm-v package_name (verify checksum) Check if the installed file has been changed
[Email protected] ~]# rpm-v wget
If the wget after installation of the file has been modified, such as/etc in a corresponding file modified, then the change prompt will be displayed, the following format:
The size of S file size differs changed
M Mode differs (includes permissions and file type) permissions change
5 Digest (formerly MD5 sum) differs
D device Major/minor number mismatch no match (device type, different device of the same type)
L Readlink (2) path mismatch paths mismatch
U User ownership differs owner
G Group ownership differs
T MTime differs time stamp
P capabilities differ capability
RPM Package Management: Verifying source legitimacy and package integrity
Package integrity: Through a one-way encryption mechanism (MD5|SHA1)
SOURCE legitimacy: Via Public key Cryptography (RSA)
Command: GPG, PGP
Import the public key of the creator, the public key of the CentOS distribution in the ISO file;
Import command: RPM--import/path/to/gpg-key-file
Check: rpm-k/path/to/package_file file because it is not installed at this time
RPM--checksig/path/to/package_file
--nosignature: Does not check the legitimacy of the source
--nodigest: Do not check integrity
[Email protected] ~]# rpm--import rpm-gpg-key-centos-6
[Email protected] ~]# rpm-k httpd-2.2.15-45.el6.centos.i686.rpm
Httpd-2.2.15-45.el6.centos.i686.rpm:rsa SHA1 (MD5) PGP MD5 OK
RPM Package Management: Database rebuild
Database:/var/lib/rpm/This is the location of the RPM management tools database
Reconstruction:
RPM--INITDB: Initialization
If a database does not exist beforehand, the new one;
RPM--REBUILDDB: Rebuilding
Rebuilding the database directly will overwrite the original library;
This is the information stored in the RPM database.
[Email protected] rpm]# ll/var/lib/rpm
Total 19208
-rw-r--r--. 1 root root 860160 Oct 02:31 basenames Package base Name
-rw-r--r--. 1 root root 12288 Oct 07:03 conflictname
-rw-r--r--. 1 root root 245760 Oct 02:31 dirnames package path
-rw-r--r--. 1 root root 1339392 Oct 02:31 filedigests
-rw-r--r--. 1 root root 12288 Oct 03:10 Group
-rw-r--r--. 1 root root 12288 Oct 03:10 Installtid
-rw-r--r--. 1 root root 12288 Oct 03:10 Name
-rw-r--r--. 1 root root 12288 Oct 07:03 obsoletename
-rw-r--r--. 1 root root 14245888 Oct 03:10 Packages Detailed information
-rw-r--r--. 1 root root 684032 Oct 03:10 providename
-rw-r--r--. 1 root root 577536 Oct 03:10 provideversion
-rw-r--r--. 1 root root 12288 Oct 03:10 Pubkeys
-rw-r--r--. 1 root root 110592 Oct 02:31 requirename
-rw-r--r--. 1 root root 65536 Oct 02:31 requireversion
-rw-r--r--. 1 root root 24576 Oct 02:31 sha1header
-rw-r--r--. 1 root root 12288 Oct 02:31 Sigmd5
-rw-r--r--. 1 root root 12288 Oct 07:03 triggername
-rw-r--r--. 1 root root 24576 Oct 03:10 __db.001
-rw-r--r--. 1 root root 180224 Oct 03:10 __db.002
-rw-r--r--. 1 root root 1318912 Oct 03:10 __db.003
-rw-r--r--. 1 root root 491520 Oct 03:10 __db.004
Learning Log---linuxのrpm Package Manager