In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you the "Linux how to achieve package management and the use of rpm commands", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to achieve package management and the use of rpm commands in Linux" this article.
Package management for Linux:
Program: instruction + data
Program: algorithm + data structure
The form of existence of the application:
1. Source code: a text file that contains all the code in the programming language of the entire application
two。 Binary: a file that can be executed directly after a series of conversion operations.
Install the application using the source code:
Preprocessing (preprocessor)-- > compilation (compiler)-- > assembly (assembler)-- > link (linker)-- > binary program files that can be executed directly
POSIX:POS,Portable Operating System, portable operating system
API:Application Program Interface, application programming interface
ABI:Application Binary Interface, apply binary interface
Unix-like:ELF
Windows:exe,msi
Library-level compatibility, library-level virtualization
Cywin: a shared library that simulates Linux in Windows systems
WinE: a library for simulating Windows in Linux systems
Application level programming language:
Java/Python/Perl/ruby/PHP/GO
Java:hadoop2, hbase, ELK, (JVM)
Python:Openstack, saltstack (PVM)
System-level programming language:
C / C +
Linux
Unix
Source code compilation: needs to be supported by a compilation development environment
C _ blank
Compiler development environment: preprocessor, compiler, header file, development library file
Java/Python:
Compiler development environment: preprocessor, compiler, development library files
In general: there are multiple source code files, and these files directly have a certain relationship; we call this relationship a dependency relationship.
Autoconf
Automake
Software project building tools:
C/C++:make
Java:maven
Python:buildout
Redhat
Package Manager:
Install, uninstall, upgrade, query and verify programs in the designated system
Different Linux distributions have different package managers:
Debian:dpt, Debian Package Toolkits, dpkg tools, package files with .deb suffix names
Redhat:rpm, Redhat Package Manager, rpm tool, .rpm suffix name
Rpm becomes the industry standard for Linux's package manager
Rpm is written in Perl language and re-rpm in C language
Rpm is package manager
S.u.S.E:rpm, .rpm
Gentoo: uses FreeBSD's portage package management mechanism and emerge's tools
ArchLinux:pacman
Take CentOS as an example, the relevant content of the rpm package manager:
Package Manager for CentOS:
Naming rules for packages:
Source code package:
Software_name-VERSION.tar.gz
VERSION:major.minor.release
Major: the major version number, which usually represents the version branch of major feature improvements
Minor: minor version number, which usually represents a change in a function in a branch of a version
Release: release number, fixed some bug or optimized a piece of code
Apache-tomcat-7.0.63.tar.gz
Rpm package naming rules:
Source code package: source code
Software_name-VERSION.src.rpm
Binary package:
Software_name-VERSION- [release]. [os]. Arch.rpm
VERSION:major.minor.release
[release]: the release number of the rpm packet
[os]: supported operating system version, el6, el7, suse11, fedora22,...
Arch: hardware platform type, I 386, x64 (amd64), ppc, sparc, noarch,...
Puppet-3.8.7-1.el7.noarch.rpm
When making rpm packages, its makers usually use subcontracting technology to build rpm packages.
Build multiple packages according to the different functions of the program
Packages that are subcontracted are generally divided into two categories:
Main package:
Software_name-VERSION- [release]. [os]. Arch.rpm
Ancillary feature Pack:
Software_name-function-VERSION- [release]. [os]. Arch.rpm
Generally speaking, the main package and the subsidiary package have the same version number, release number, operating system and compatible platform identification.
Therefore, the main package is often relied on by all the ancillary feature packages, which cannot be installed without installing the main package.
Function:devel, utils, libs, tools, manual, client, common,...
Dependencies:
A-- > B-- > CD-- > A dependent black hole
Front-end tools for package management:
RHEL | frontend management tools of CentOS system: yum, Yellow dog Update Midifier
Yum will start transactions when implementing installation, upgrade, uninstallation, etc.
The so-called transaction regards the operation as a whole, either all or none at all.
Fedora 22+:dnf
Front-end tool of Debian system: apt-get,apt-cache
Apt-get: implement installation, uninstall and other functions
Apt-cache: implement keyword-based search function to manage local cache and cached metadata
Suse front-end tool: zypper
Rpm package Manager:
1.rpm command line tool
2.yum tool
Rpm command line tool:
Features:
1. Package the component files of the compiled application into one or more package files
two。 Software package installation, uninstall, upgrade, query, verification and database management functions
A list of the files in the rpm package:
1. The file of the program
two。 List of documents
3. Script files that run when the software is installed or uninstalled are divided into four categories:
Preinstall: script run before the formal installation operation begins,% pre
Postinstall: script executed after installation,% post
Preuninstall: script run before the official uninstall operation starts,% preun
Postuninstall: script executed after the uninstall is complete,% postun
Rpm database (public):
The name and version of the installed package
/ var/lib/rpm
The way to get the package:
1. CD-ROM of the distribution version of the system
two。 Official file server or mirror site:
Http://mirrors.aliyun.com
Http://mirrors.sohu.com
Http://mirrors.163.com
Https://mirrors.tuna.tsinghua.edu.cn
Http://mirrors.hust.edu.cn
...
3. The official site for a project:
4. Rpm package sites produced by third-party organizations
Fedora EPEL: the official community organization of Red Hat, which also includes EPEL images in the mirror site.
Search engine:
Http://pkgs.org
Http://rpmfind.net
Http://rpm.pbone.net
5. Make it yourself
Recommendation: after obtaining the package, perform an integrity check
Source legitimacy:
The data encrypted by the digital signature of the program provider is decrypted and verified by its public key.
Package integrity:
Sha-1 parity check code
The use of rpm and yum tools
Rpm command line tool:
Install, uninstall, upgrade (downgrade), query, file verification, verification, database maintenance
Common options for the rpm command:
-v: displays the information of the installation routine, only the name of the installation software
-vv: displays very detailed operation information
Installation:
Rpm {- I |-- install} [install-options] PACKAGE_FILE...
Install-options:
-h,-- hash: use 50 "#" to indicate the installation progress
-- test: it's not really about installing the package, it's just testing whether it can be done properly during installation, dry run mode
-- nodeps: ignore installation errors caused by dependencies and are not recommended
-- replacefiles: when installing a software package, the files in the package will directly replace the files that were originally installed
-- replacepkgs: reinstall without uninstalling the package
-- noscripts: do not run any scripts
-- nopre
-- nopost
-- nosignature: regardless of whether the source of the package is legitimate
-- nodigest: regardless of whether the package is complete
Example: ~] # rpm-ivh php-mysql-5.3.3-40.el6_6.x86_64.rpm php-pdo-5.3.3-40.el6_6.x86_64.rpm
Upgrade:
Rpm {- U |-- upgrade} [install-options] PACKAGE_FILE...
If you choose to install the package that is not installed in advance, install it completely; if you have already installed the old version, you can upgrade the installation.
Rpm {- F |-- freshen} [install-options] PACKAGE_FILE...
Only low-version packages that have been installed can only be upgraded and installed
Common options: same as installation
-- oldpackage: downgrade the installation and replace the new version of the package with the old version
-- force: force upgrade
Note:
1. It is strongly recommended not to upgrade the kernel; Linux can support multiple kernels, you can install a new version of the kernel directly, and you can manually replace it in the startup interface.
two。 Upgrading the installation may change the files, so by default, the system will not directly change the configuration file of the previously installed software, and the configuration file in the new package will be renamed, usually: FINENAME.rpmnew
Uninstall:
Rpm {- e |-- erase} [--allmatches] [--nodeps] [--noscripts] [--notriggers] [--test] PACKAGE_NAME...
-- allmatches: uninstalls all versions of packages that match the specified name
-- nodeps: ignore dependencies when uninstalling. It is not recommended to use
-- test: test uninstall, dry run mode
Query:
Rpm {- Q |-- query} [select-options] [query-options]
[select-options]
PACKAGE_NAME: give the package name directly
-AMAL: query the names of all installed packages
~] # rpm-qa | grep mysql
-fmam Murray file FILE: find out which package provided the specified file
-pmam Meltel package PACKAGE_FILE: perform query operations on package files that have not yet been installed
-- whatprovides CAPABILITY: query which package the specified CAPABILITY is provided by
-- whatrequires CAPABILITY: queries which package the specified CAPABILITY is dependent on
[query-options]
-- changelog: query the changelog of the rpm package
-cmaire: query which configuration files are included in the specified package
-dmine:: query which document files are in the specified package
-imam murmurinfo: query package-related information, including version number, release number, size, etc.
-lmmam Musi list: the list shows which files will be generated by the package installation
-- provides: lists all the CAPABILITY provided by the specified package
-Rmaine Mustang: query the dependencies of the specified package
-- scripts: view the contents of the scripts carried by the package
Specific usage:
-qf FILE
-qc |-ql |-qd |-qi PACKAGE_NAME
-qpl |-qpc |-qpd |-qpi PACKAGE_FILE
Check:
Rpm {- V |-- verify} [select-options] [verify-options]
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
Certification:
Rpm-import / PATH/TO/KEY_FILE
Rpm-K / PATH/TO/PACKAGE_FILE
Database Management:
Initialization and reconstruction of database
/ var/lib/rpm
Rpm {--initdb |-- rebuilddb}
[--dbpath DIRECTORY]
These are all the contents of this article entitled "how to manage packages and use rpm commands in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.