Linux Package Management:
Api:application Programming Interface
Posix:portable OS
Program Source--preprocessing----compile-to-link
Static compilation:
Shared compilation:. So
Abi:application Binary Interface
Windows is incompatible with Linux
Library-level virtualization:
Linux:wine
Windows:cywin
System-Level development
C
C++
Application-level development
Java
Python
Php
Perl
Ruby
Components of a binary application:
binary files, library files, configuration files, Help files
Package Manager:
Debian:deb, DPT
REDHAT:RPM, rpm
Rpm:redhat Package Manager
RPM is the package Manager
Gentoo
ArchLinux
Source code: NAME-VERSION.TAR.GZ
VERSION:major.minor.release
RPM Package Naming method:
name-version-release.arch.rpm
VERSION:major.minor.release
Release.arch:
Release:release. OS
zlib-1.2.7-13.el7.i686.rpm
Common arch:
X86:i386, i486, i586, i686
X86_64:x64, x86_64, AMD64
Powerpc:ppc
Platform agnostic: Noarch
TestApp: Unpacking
TESTAPP-VERSION-ARCH.RPM: Main Package
TESTAPP-DEVEL-VERSION-ARCH.RPM: Support Package
testapp-testing-version-arhc.rpm
Between packages: dependencies exist
X, Y, Z
YUM:RPM Package Manager's front-end tool;
Apt-get:deb Package Manager front-end tool;
RPM Front-end management tool on Zypper:suse;
Dnf:fedora 22+ RPM Package Manager front-end management tool;
To view the library files that the binaries depend on:
Ldd/path/to/binary_file
Manage and view the library files that are loaded natively:
Ldconfig
/sbin/ldconfig-p: Displays all available library filenames and file path mappings that have been cached by this computer;
Configuration files are:/etc/ld.so.conf,/etc/ld.so.conf.d/*.conf
Cache files:/etc/ld.so.cache
Package Management:
Function: The compilation of the application's constituent files package one or several package files, so as to quickly and easily implement the package installation, uninstallation, query, upgrade and calibration management operations;
1, the composition of the program list (each package unique)
List of documents
Scripts to run when installing or uninstalling
2. Database (public)
Package Name and version
Dependency relationship;
function description;
The file path and checksum information of the files generated by the installation;
How to manage Packages:
Using Package Manager: RPM
Using the front end tool: Yum, DNF
Ways to get Packages:
(1) The system issued by the CD or the official server;
CentOS Image:
Http://mirrors.aliyun.com
Http://mirrors.sohu.com
Http://mirrors.163.com
(2) Official site of the project
(3) Third party organizations:
Fedora-epel
Search engine:
http://pkgs.org
Http://rpmfind.net
Http://rpm.pbone.net
(4) Make your own
Recommendation: Check its legality
source legitimacy;
The integrity of the package;
The RPM command management package on the CentOS system:
Installation, uninstallation, upgrade, query, checksum, database maintenance
Installation:
RPM {-i|--install} [install-options] package_file ...
-v:verbose
-VV:
-H: Show packages to manage execution progress; Each # represents 2% progress
RPM-IVH Package_file ...
[Install-options]
--test: Test installation, but do not actually perform the installation process; dry run mode;
--nodeps: Ignoring dependencies;
--replacepkgs: Reinstall;
--nosignature: Do not check the legitimacy of the source;
--nodigest: does not check package integrity;
--noscipts: Do not execute Package script fragment;
%pre: Pre-installation;--nopre
%post: Post-installation script;--nopost
%preun: Unloading the forefoot;--nopreun
%postun: Post-uninstall script;--nopostun
Upgrade:
RPM {-u|--upgrade} [install-options] package_file ...
RPM {-f|--freshen} [install-options] package_file ...
Upgrage: Install an older version of the package, then "Upgrade", or "install" if there is no legacy package;
Freeshen: Install an older version of the package, upgrade, or do not perform the upgrade if there is no legacy package;
RPM-UVH Package_file ...
RPM-FVH Package_file ...
--oldpackage: Downgrade;
--force: Forced escalation;
Note: (1) do not upgrade the kernel, Linux supports multi-core version coexistence, therefore, the direct installation of the new version of the kernel;
(2) If the original package configuration file has been modified after installation, long, the new version of the same configuration file provided does not directly overwrite the old version of the configuration file, and the new version of the file renamed (Filename.rpmnew) after the reservation;
Inquire:
RPM {-q|--query} [select-options] [query-options]
[Select-options]
-A: All packages
-F: To see which package installs the specified file for build
-p/path/to/package_file: Query operation for the package files that have not been installed;
--whatprovides CAPABILITY: Query The specified CAPABILITY is provided by which package;
--whatrequires CAPABILITY: The query specifies which packet the CAPABILITY is dependent on;
[Query-options]
--changelog: Query rpm Package for Changlog
-C: Querying the program's configuration file
-D: Querying the program's documentation
-i:information
-L: View all files generated after the installation of the specified package;
--scripts: Script fragment with package comes in
-r: Query the capability that the specified package depends on;
--provides: Lists the capability provided by the specified package;
Usage:
-qi package,-QF FILE,-QC package,-QL package,-QD package
-qpi Package_file,-qpl package_file, ...
-qa
Unloading:
RPM {-e|--erase} [--allmatches] [--nodeps] [--noscripts]
[--notriggers] [--test] Package_name ...
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
Validation and completeness of package source legality:
Integrity Verification: SHA256
SOURCE legality verification: RSA
Public Key cryptography:
Symmetric encryption: Encryption, decryption using the same key;
Asymmetric encryption: The key is in pairs,
Public key: Private key, public owner
Secret key: Private key, cannot be exposed
To import the required public key:
RPM--import/path/from/gpg-pubkey-file
Key files provided by the CentOS 7 release CD: Rpm-gpg-key-centos-7
Database rebuild:
RPM {--INITDB|--REBUILDDB}
INITDB: Initialization
If the database does not exist beforehand, it is created; otherwise, no action is taken;
REBUILDDB: Rebuilding
Re-create the database directly, regardless of the current presence or not;
Yum Repository:yum Repo
Stores a number of RPM packages, as well as the relevant metadata files for packages (placed in a specific directory: Repodata);
File server:
ftp://
/HTTP
nfs://
file:///
Yum Client:
Configuration file:
/ETC/YUM.CONF: Providing public configuration for all warehouses
/etc/yum.repos.d/*.repo: Provides configuration for the point of the warehouse
Definition of Warehouse point:
[Repositoryid]
Name=some name for this repository
baseurl=url://path/to/repository/
Enabled={1|0}
Gpgcheck={1|0}
Gpgkey=url
Enablegroups={1|0}
Failovermethod={roundrobin|priority}
The default is: Roundrobin, meaning random selection;
cost=
Default is 1000
The Yum source in the classroom: http://172.16.0.1/cobbler/ks_mirror/CentOS-6.6-x86_64/
CentOS 6.6 x84_64 epel:http://172.16.0.1/fedora-epel/6/x86_64/
Usage of the Yum command:
Yum [options] [command] [package ...]
command is one of:
* Install Package1 [Package2] [...]
* Update [PACKAGE1] [Package2] [...]
* Update-to [Package1] [Package2] [...]
* Check-update
* upgrade [Package1] [Package2] [...]
* Upgrade-to [Package1] [Package2] [...]
* Distribution-synchronization [Package1] [Package2] [...]
* Remove | Erase Package1 [Package2] [...]
* List [...]
* Info [...]
* provides | Whatprovides Feature1 [Feature2] [...]
* Clean [Packages | metadata | expire-cache | rpmdb | plugins | all]
* Makecache
* Groupinstall group1 [group2] [...]
* Groupupdate group1 [group2] [...]
* grouplist [hidden] [Groupwildcard] [...]
* Groupremove group1 [group2] [...]
* GroupInfo group1 [...]
* Search string1 [string2] [...]
* Shell [filename]
* RESOLVEDEP DEP1 [DEP2] [...]
* Localinstall Rpmfile1 [rpmfile2] [...]
(Maintained for legacy reasons Only-use install)
* Localupdate Rpmfile1 [rpmfile2] [...]
(Maintained for legacy reasons Only-use Update)
* Reinstall Package1 [Package2] [...]
* Downgrade Package1 [Package2] [...]
* Deplist Package1 [Package2] [...]
* Repolist [all|enabled|disabled]
* Version [all | installed | available | group-* | nogroups* | grouplist | groupinfo]
* History [Info|list|packages-list|packages-info|summary|addon-info|redo|undo|rollback|new|sync|stats]
* Check
* Help [command]
Show Warehouse list:
Repolist [all|enabled|disabled]
Show Packages:
List
# yum list [all | glob_exp1] [GLOB_EXP2] [...]
# Yum list {available|installed|updates} [GLOB_EXP1] [...]
To install the package:
Install Package1 [Package2] [...]
Reinstall Package1 [Package2] [...] (reinstall)
Upgrade Package:
Update [PACKAGE1] [Package2] [...]
Downgrade Package1 [Package2] [...] Downgrade
Check for available upgrades:
Check-update
To uninstall a package:
Remove | Erase Package1 [Package2] [...]
To view the package information:
info [...]
View which package is provided by the specified attribute (which can be a file):
provides | Whatprovides Feature1 [Feature2] [...]
To clean up the local cache:
Clean [Packages | metadata | expire-cache | rpmdb | plugins | all]
Build cache:
Makecache
Search:
Search string1 [string2] [...]
Search for the package name and summary information with the specified keywords;
View the capabilities that the specified package depends on:
Deplist Package1 [Package2] [...]
View Yum Transaction history:
History [Info|list|packages-list|packages-info|summary|addon-info|redo|undo|rollback|new|sync|stats]
To install and upgrade the local package:
* Localinstall Rpmfile1 [rpmfile2] [...]
(Maintained for legacy reasons Only-use install)
* Localupdate Rpmfile1 [rpmfile2] [...]
(Maintained for legacy reasons Only-use Update)
Related commands for package group management:
* Groupinstall group1 [group2] [...]
* Groupupdate group1 [group2] [...]
* grouplist [hidden] [Groupwildcard] [...]
* Groupremove group1 [group2] [...]
* GroupInfo group1 [...]
How to use a disc as a local yum repository:
(1) Mount the disc to a directory such as/media/cdrom
# mount-r-T Iso9660/dev/cdrom/media/cdrom
(2) Creating a configuration file
[CentOS7]
Name=
Baseurl=
gpgcheck=
Enabled=
Yum command-Line options:
--nogpgcheck: No GPG check is allowed;
-Y: Auto Answer "yes";
-Q: Silent mode;
--disablerepo=repoidglob: Temporarily disables the repo specified here;
--enablerepo=repoidglob: Temporarily enable the repo specified here;
--noplugins: Disable all plugins;
The variables available in the Yum repo configuration file:
$releasever: The major version number of the current OS release version;
$arch: platform;
$basearch: Basic platform;
$YUM 0-$YUM 9
http://mirrors.magedu.com/centos/$releasever/$basearch/os
To create a yum repository:
Createrepo [Options] <directory>
linux-Basics-Day 15th