In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Rpm of package Management in Linux system
=
Overview:
The content of this chapter: software running environment, software package foundation, rpm package management, yum management, custom yum repository, compilation and installation.
=
Software running environment
★ API:Application Programming Interface (Application Development Interface)
☉ POSIX:Portable OS (International Standard)
Program source code-- > preprocessing-- > compilation-- > assembly-- > link
★ ABI:Application Binary Interface (Application binary Program Interface)
☉ Windows is not compatible with Linux
Linux: file format: ELF (Executable and Linkable Format)
Win: file format: exe,msl PE (Portable Executable)
☉ Library level Virtualization
Linux:WINE (provides a library to simulate windows and runs a win environment)
Windows:Cywin (provides the operating environment for linux)
★ development language:
☉ system-level development:
C _ blank + (dependent on the c library)
Httpd,nginx,vsftpd,go
☉ application-level development:
Java (dependent on jvm virtual machine)
Python (openstack Cloud Station), php,perl (dependent on per interpreter), ruby
★ program format
☉ cripple +
Source code: program code in text format
Compiler development environment: compiler, header file, development library
Binary format: program code in text format-> compiler-> binary format (binary program, library file, configuration file, help file),
☉ java/Python
Source code: compiles a format that can run on its virtual machine (jvm/pvm)
Development environment: compiler, development library
Binary system
★ project building tools
C/c++:make
Jave:maven
Package management
1. Overview:
Components of a ★ binary application:
Binaries, library files, configuration files, help files
★ package Management:
Source code-- > target binary format (binaries, library files, configuration files, help files)-- > organized into one or a limited number of "package files" (install, upgrade, uninstall, query, check)
☉ package Manager:
Deblan:dpt,dpkg is suffixed with ".deb"
Redhat:rpm (redhat package manager) with the suffix ".rpm"
S.u.S.E:rpm, ".rpm" command
★ package naming format
☉ source code: name-VERSION.tar.gz | bz2 | xz
ERSION: major (major version). Minor (minor version). Release (release number)
☉ rpm package naming format: name-VERSION-release.arch.rpm
VERSION:major.minor.release.arc
Release:rpm package release number
Changelog documentation (related documentation for content repair improvements)
Common arch:
X86: i386, i486, i586, i686
X86_64: x64, x86_64, amd64powerpc: ppc
Platform independent: noarch (for all platforms)
Example:
Bash-4.2.46-19.el7.x86_64.rpm
Release:release.OS
★ packages: classifying and unpacking
Application-VERSION-ARCH.rpm: main package
Application-devel-VERSION-ARCH.rpm: developing subpackages
Application-utils-VERSION-ARHC.rpm: other subpackages
Application-libs-VERSION-ARHC.rpm: other subpackages
Between ☉ packages: there may be dependencies, even circular dependencies
Automatically resolve dependency package management front-end tools:
Front-end tools for yum:rpm package manager
Apt-get:deb package Manager front-end tools
Rpm front-end management tools on zypper:suse
Dnf:Fedora 18 + rpm package Manager front-end management tools
two。 Library files:
★ looks at the library files that the binary depends on:
Ldd / PATH/TO/BINARY_FILE
★ manages and views library files loaded on this machine:
Ldconfig
/ sbin/ldconfig-p: displays all available library file names and file path mapping relationships that have been cached on this machine
Configuration file: / etc/ld.so.conf, / etc/ld.so.conf.d/*.conf
Cache file: / etc/ld.so.cache
3. Package Manager:
★ package Manager:
☉ function:
Package one or more package files from each component file of the compiled application, so as to easily and quickly realize the management operations such as installation, uninstallation, query, upgrade and verification of the package.
☉ package composition manifest: (each package is implemented separately)
List of files in the RPM package
RPM metadata, such as name, version, dependency, description, etc.
Scripts that run when installing or uninstalling
☉ Database (Public)
Path: / var/lib/rpm
Package name and version
Dependency relationship
Function description
File path and check code information generated after package installation
3. Source of the package:
How ★ manages packages:
Use the package manager: rpm
Use front-end tools: yum, dnf
The way ★ gets the package:
☉ system development version of CD-ROM or official server (or CentOS image site)
Https://www.centos.org/download/
Http://mirrors.aliyun.com
Http://mirrors.sohu.com
Http://mirrors.163.com
☉ project official site
☉ third-party organizations:
Fedora-EPEL:Extra Packages for Enterprise Linux
Recommended by Rpmforge:RHEL, the package is very complete
Search engine:
Http://pkgs.org
Http://rpmfind.net
Http://rpm.pbone.net
Https://sourceforge.net/
☉ made it himself.
Note: check its legitimacy: source legitimacy, package integrity
Detailed explanation of rpm Command Management package
Overview of 1.rpm syntax and options:
★ rpm:
Install, upgrade, uninstall, query and verify, database maintenance (all through the rpm command)
☉ syntax:
Rpm [OPTIONS] [PACKAGE_FILE]
☉ options:
-imam Musi install: install
-Umam MusicUPDAT: upgrade
-eMagneWhile: uninstall
-qrecom Mutual query: query
-VMagneWhile: verification
-- builddb,--initdb: database maintenance
two。 Installation and suboptions:
★ syntax:
Rpm {- I |-- install} [install-options] PACKAGE_FILE...
☉ options:
-v:verbose displays details
-vv: more detailed output
-h: hash marks outputs progress bars; each # indicates 2% progress
-- test: test installation, check and report dependencies and conflicts, but do not actually perform installation; called dry run (dry run) mode
-- nodeps: ignore dependencies and are not recommended
-- replacepkgs: replace the original package and reinstall (delete the original configuration file and then reinstall it)
-- nosignature: do not check package signature information or source validity
-- nodigest: do not check package integrity
Note: rpm comes with four types of scripts (--noscripts)
% pre: pre-installation script;-- nopre
% post: post-installation script;-- nopost
% preun: pre-uninstall script;-- nopreun
% postun: script after uninstallation;-- nopostun
☉ actually installs the commands used to perform the operation
Rpm-ivh PACKAGE_FILE
3. Upgrade and suboptions:
★ syntax:
Rpm {- U |-- upgrade} [install-options] PACKAGE_FILE...
Rpm {- F |-- freshen} [install-options] PACKAGE_FILE...
Note:
-U (upgrade): if there is an old version of the package installed, "upgrade" if there is no old version of the package, then "install"
-F (freshen): installed with
If the legacy package does not exist, the upgrade operation will not be performed
★ upgrade command:
Rpm-Uvh PACKAGE_FILE...
Rpm-Fvh PACKAGE_FILE...
-- oldpackage: degraded (rollback operation)
-- force: force upgrade
Note:
Do not upgrade the kernel; Linux supports the coexistence of multiple kernel versions, so you can install a new version of the kernel directly
If the configuration file of the source package has been modified after installation, the same configuration file provided by the new version will not directly overwrite the old version of the configuration file during the upgrade, but the new version of the file will be renamed (FILENAME.rpmnew) and retained.
4. Uninstall and suboptions:
★ function:
Remove installed packages
★ syntax:
Rmp {- e |-- erase} [--allmatches] [--nodeps] [--test] PACKAGE_NAME
Note:
Uninstall and query is the name of the package, because the package already exists; while installation and upgrade, the package does not exist, so it is the file path of the package
Simple usage of ★
Rpm-e PACKAGE_NAME...
☉ options:
-- allmatches: uninstalls all versions of packages with matching names
-- nodeps: ignore dependencies
-- test: test uninstall, dry run mode
5. Query:
★ syntax:
Rpm {- Q |-- query} [select-options] [query-options]
☉ [select-options] pick option
-Q PACKAGE_NAME: query whether a package or some packages are installed
-qa: query all installed packages
-qf FILE: check which package installs and generates the specified file
-p PACKAGE_FILE: query for package files that have not been installed
-- whatprovides CAPABILITY (capability): query which package provides the specified CAPABILITY
-- whatrequires CAPABILITY: query which package the specified CAPABILITY is dependent on
Rpm2cpio package files | cpio-itv preview of files in the package
Rpm2cpio package files | cpio-id "* .conf" releases files in the package
☉ [query-options] query options
-- changelog: query the changelog (change record) of the rpm package
-c: query the configuration file of the specified package
-d: query the help documents generated after the package installation is complete
-qi,-info: package related information, version number, size, package group to which it belongs, etc.
-lmaine Meltel list: view the list of all files generated after the specified package is installed.
-- scripts: view the script snippets that come with the package
-Rmaine Mushroom: query the CAPABILITY on which the specified package depends
-- provides: lists the CAPABILITY provided by the specified package
Common combined usage of ☉:
-qi PACKAGE;-qf FILE;-qc PACJAGE;-ql PACKAGE;-qd PACKAGE;- qpi PACKAGE_FILE;-qpl PACKAGE_FILE;-qpc PACKAGE_FILE,..
Demo:
[root@centos7] # rpm-Q treetree-1.6.0-10.el7.x86_64 [root@centos7] # rpm-ql tree/usr/bin/tree/usr/share/doc/tree-1.6.0/usr/share/doc/tree-1.6.0/LICENSE/usr/share/doc/tree-1.6.0/README/usr/share/man/man1/tree.1.gz [root@centos7] # rpm-qf / etc/fstab setup-2. 8.71-6.el7.noarch [root@centos7 ~] # rpm-qc bash/etc/skel/.bash_logout/etc/skel/.bash_profile/etc/skel/ .bashrc [root @ centos7 ~] # rpm-qi bashName: bashVersion: 4.2.46Release: 19.el7Architecture: x86_64Install Date: Sunday, November 6, 2016 18:31:30 Group: System Environment/ShellsSize: 3663618License: GPLv3+Signature: RSA/SHA256 Wednesday, 25 November 2015, 22:14:53 Key ID 24c6a8a7f4a80eb5Source RPM: bash-4.2.46-19.el7.src.rpmBuild Date: Friday, November 20, 2015 13:04:53 Build Host: worker1.bsys.centos.orgRelocations: (not relocatable) Packager: CentOS BuildSystem Vendor: CentOSURL: http://www.gnu.org/software/bashSummary: The GNU Bourne Again shellDescription: The GNU Bourne Again shell (Bash) is a shell or command languageinterpreter that is compatible with the Bourne shell (sh). Bashincorporates useful features from the Korn shell (ksh) and the C shell (csh). Most sh scripts can be run by bash without modification. [root@centos7 ~] # rpm-qc httpd/etc/httpd/conf.d/autoindex.conf/etc/httpd/conf.d/userdir.conf/etc/httpd/conf.d/welcome.conf/etc/httpd/conf.modules.d/00-base.conf/etc/httpd/conf.modules.d/00-dav.conf/etc/httpd/conf.modules.d/00-lua.conf/etc/httpd/conf.modules.d/00-mpm .conf / etc/httpd/conf.modules.d/00-proxy.conf/etc/httpd/conf.modules.d/00-systemd.conf/etc/httpd/conf.modules.d/01-cgi.conf/etc/httpd/conf/httpd.conf/etc/httpd/conf/magic/etc/logrotate.d/httpd/etc/sysconfig/htcacheclean/etc/sysconfig/httpd [root@centos7 ~] # rpm-qd httpd/usr/share/doc/httpd-2.4.6/ABOUT_APACHE/usr/ Share/doc/httpd-2.4.6/CHANGES/usr/share/doc/httpd-2.4.6/LICENSE/usr/share/doc/httpd-2.4.6/NOTICE/usr/share/doc/httpd-2.4.6/README/usr/share/doc/httpd-2.4.6/VERSIONING/usr/share/doc/httpd-2.4.6/httpd-dav.conf/usr/share/doc/httpd-2.4.6/httpd-default.conf/usr/ Share/doc/httpd-2.4.6/httpd-info.conf/usr/share/doc/httpd-2.4.6/httpd-languages.conf/usr/share/doc/httpd-2.4.6/httpd-manual.conf/usr/share/doc/httpd-2.4.6/httpd-mpm.conf/usr/share/doc/httpd-2.4.6/httpd-multilang-errordoc.conf/usr/share/doc/httpd-2.4.6/httpd-vhosts.conf/ Usr/share/doc/httpd-2.4.6/proxy-html.conf/usr/share/man/man8/apachectl.8.gz/usr/share/man/man8/fcgistarter.8.gz/usr/share/man/man8/htcacheclean.8.gz/usr/share/man/man8/httpd.8.gz/usr/share/man/man8/rotatelogs.8.gz/usr/share/man/man8/suexec.8.gz
6. Check:
★ syntax:
Rpm {- V |-- verify} [select-options] [verify-options]
Common uses of ☉:
Rpm-V PACHAGE_NAME
When there is no output result, it indicates the complete ok of the package. When there is a corresponding result output, the corresponding content has been modified, and the details are as follows:
S:file Size differs (whether the capacity size of the file has been changed)
Whether the type or property of the M:Mode differs (includes permissions and file type) file has been changed
5:digest (formerly MD5 sum) differs. This is a fingerprint. The content is different.
The primary / secondary code of the D:Device major/minor number mismatch device has been changed
L:readLink (2) path mismatch path has been changed
The owner of the U: User ownership differs file has been changed
The group of the G:Group ownership differs file has been changed
The creation time of the T:mTimediffers file has been changed
P:capabilities differ
★ package source validity verification and integrity verification:
Integrity verification: SHA256
Verification of Source legitimacy: RSA
☉ gets and imports the secret key of the trusted package maker
For CentOS distributions: rpm--import / etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
◆ authentication:
Verification is performed automatically when you install a program signed by this organization
Manual verification: rpm-K PACKAGE_FILE
◆ encryption method:
Public key encryption:
Symmetric encryption: encrypt and decrypt using the same key
Asymmetric encryption: keys are paired
Public key: public key, public owner
Secret key: private key, cannot be made public
◆ imports the required public key:
Rpm-K | checksigrpmfile: check the integrity and signature of the package
Rpm--import / etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Available on the CentOS 7 distribution CD: RPM-GPG-KEY-CentOS-7
Rpm-qagpg-pubkey*
Demo:
[root@centos7] # rpm-V httpd missing c / etc/httpd/conf.d/welcome.confS.5....T. C / etc/httpd/conf/httpd.conf
7. Database Reconstruction:
★ rpm database path:
/ var/lib/rpm
Query operation: get the database here
★ usage:
Rpm {--initdb |-- rebuilddb}
☉ options:
-- initdb: initializes the database. If there is currently no database, create a new database; sometimes no action is performed.
-- rebuilddb: rebuild. Whether it currently exists or not, the database will be recreated directly.
☉ gets help
CentOS6 man rpm
CentOS7 man rpmdb
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.