Linux Notes 4.0

Source: Internet
Author: User
Tags gpg yum repolist

Command:
Mount Mount CD
wget download File
Du view usage space (space used by file and directory disks)
-S only displays sum (sum),-H to K,m, as unit
DD if= of= bs= count= copy files and convert and format the contents of the original file
If represents the input file (/dev/zore/full zero character device)
of represents output files
BS represents the block size for bytes
Count represents the number of blocks being copied

Report
1. Accidental deletion of processing
Boot into rescue mode:
CENTOS6: Incoming CD-->rescue install system
CENTOS7: Incoming CD-->troubleshooting-->rescue a CentOS system
Find deleted files or directories, restore with relative paths
2, rpm mistakenly uninstall:
In rescue mode, re-installed with RMP
Note: Installation path with special command:--root=/mnt/sysimage

Package Management

Software run and compile
Abi:application binary Interface (Application binary interface) operating system interface standard
Api:application Programming Interface (Application design Interface)
Program Source----preprocessing----compile----Links (link library files)
Static compilation:. A (Static library: LIB.A)
Dynamic compilation:. So (Dynamic library: lib.so)

Link
The main function of the link is to handle the parts of each module that are referenced to each other, so that each module can be properly connected, divided into static links and dynamic links.
Static links
Copy the dependent Library of the program to the package
Libxxx.a
Embedding Packages
Upgrade difficult, need to recompile
Take up more space and migrate easily
Dynamic links
Only add dependencies to a dynamic link
Libxxx.so
Links point to
Easy to upgrade with less space to use

Development language
System-Level development
C
C++
Application-level development
Java
Delphi
Python
Go
Php
Perl
Ruby

Package Manager
Part of a binary application
binary files, library files, configuration files, Help files
Package Manager
Debian:deb file, dpkg Package Manager
rehat:rpm file, RPM Package Manager, rpm (RPM Pack manager)

Package naming
Source code: Name-version (Version number). tar.gz|bz2|xz
Version:major (major version number). minor (minor version number). Release (issue number)
RPM Package: name-version-release.arch.rpm
Release:release. OS
Common Arch (architecture): i686, x86_64, platform-independent Noarch

Package Installation Tools
Between packages: There may be dependencies, or even cyclic dependencies
To resolve the dependency package management tool:
YUM:RPM Package Manager Front End tool (low-level call RPM, cannot replace rpm completely)
Apt-get:deb Package Manager Front End Tool
RPM front-end management tools on Zypper:suse
Dnf:fedora + RPM front-end management tools

Library files
View the library files that the binaries depend on
Ldd/path/to/binary_file
Manage and view native-mounted library files
Ldconfig: Loading library files
/sbin/ldconfig-p/: Displays all available library file names and file path mappings that have been cached by this computer
Configuration file:/etc/ld.so.conf,/etc/ld.so.conf.d/*.conf
Cache files:/etc/ld.so.cache

Package composition (unique for each package)
RPM in-Package files
RPM metadata (name, version, dependency, description, etc.)
Script for installation or uninstallation (former pre; Post post)
Database (public):/var/lib/rpm
Package name Name and version
Dependent relationships
Function description
File path and checksum information generated after package installation

The source of the package
Ways to get Packages:
(1) System-issued CD-ROM or official server
CentOS image (version too old, usually not used)
https://www.centos.org/download/
Http://mirrors.aliyun.com
Http://mirrors.sohu.com
Http://mirrors.163.com
(2) Official site of the project
(3) Third party organizations
Fedora-eple:extra Packages for Enterprise Linux
Rpmforge:rhel recommended, the package is full
Search engine:
http://pkgs.org
Http://rpmfind.net
Http://rpm.pbone.net
https://sourceforge.net/
(4) Make your own
Note: Third-party packages are recommended to check their legality (source legality, package integrity)

RPM Package Management
Use the RPM command to manage packages on CentOS:
Installation, uninstallation, upgrade, query, checksum, database maintenance

Installation:
Rpm-i (--install); V (displays the installation process); H (to # Show package Management execution progress)
--text: Test installation, not actually performing the installation, i.e. dry run mode
--nodeps: Ignore dependencies, Force installation
--replacepkgs|replacefiles: Overlay installation, forced reload
--nosignature: Do not check source legitimacy (unsafe)
(Attached: RPM--import/etc/pki/rpm-gpg/rpm-gpg-key-centos-{6,7}: Import Key)
--nodigest: Package integrity is not checked (unsafe)
--noscripts: Do not execute script

Upgrade:
-U (--upgrade) old version is upgraded, no older version is installed
-F (--freshen) An older version is upgraded, no upgrade is done without an old version
Upgrading is not recommended, overwriting older versions, kernel upgrades generally install new versions directly and retain the original version, but General software does not hold two versions
--oldpackage: Downgrade
--force: Forced installation
Note: If the configuration file of the original package was modified after installation, the same profile provided by the new version does not overwrite the modified profile, but instead renames the new version of the file (filename. RPMNWE) Save after

Inquire
Rpm-q (--query) query [select-options] [Query-options] Package name (path not required)
Select-options (select option)
-A: All packages
-F: To see which package installation of the specified file was generated
-P: Query operation for a package file that has not been installed (this is the file name instead of the package name)
--whatprovides CAPABILITY (Ability): query which package is provided by the specified function
--whatrequires CAPABILITY: Query which package is dependent on the specified function
Rpm2cpio package file |cpio-itv: Preview in-Package files
Rpm2cpio package file |cpio-id: "*.conf" release in-Package files
Query-options (Problem option)
--changelog: Query rpm Package for Changelog
-C: Querying the program's configuration file
-D: Querying the program's documentation
-i:informatio Description Information
-L: View all files generated after the installation of the specified package
--scripts: Package comes with script
--provides: Lists the capabilities provided by the specified package
-r: Query the capabilities that the specified package depends on
Commonly used:-qi,-QF,-qp heel rpm file,-QL

Unloading
-E (--erase) Uninstall
--allmatches: Removes all matches to the
--nodeps
--noscript
--notriggers: Ignoring triggers
--test: Test Uninstall

Check
-V (--verify) checksum
Results:
S:file size differs
M:mode differs (Include permissions (license) and file type)
5 (for hash value): Digest (formerly (original) MD5 sum) differs
D:device Major/minor number mismatch
L:readlink (2) path mismatch (matching error)
U:user ownership differs
G:group ownership differs
T:mtime differs
P:capabilities differ

Package source legality and package integrity check
Public Key Cryptography
Symmetric: Encrypt, decrypt using the same key
Asymmetric: The key is in pairs
Public key: Private key, public owner
Secret key: Private key, cannot be exposed
Import the key first to verify
Import:
RPM--import/etc/pki/rpm-gpg/rpm-gpg-key-centos-{6,7}: Import Key
(Path in disc:
6:/media/centos_6.9_final/rpm-gpg-key-centos-6
7:/run/media/root/centos\ 7\ x86_64/rpm-gpg-key-centos-7)
Check:
Rpm-k|checksig: Check package integrity and signature
To view the key:
Rpm-qa "gpg-pubkey*": View the contents of the imported key

RPM Database
Database rebuild:/var/lib/rpm
RPM--INITDB|--REBUILDDB
INITDB: Initializing, not present, new, existing, no action taken
REBUILDDB: Rebuilding the database index directory for an installed header
It is not recommended to rebuild the database

YUM
Centos:yum, DNF
Yum:yellowdog Updata MODFILER,RPM's front-end program to address package interdependencies, locate packages between multiple libraries, and up2data alternative tools
Based on C/s structure (client/server)
The Yum Repository:yum repo (Yum repository profile) stores a wide range of RPM packages and related metadata files for packages, placed in a specific directory Repodata
File server:
HTTP//, https://, ftp://, file://

Yum configuration file
/ETC/YUM.CONF: Public configuration for all warehouses (rarely changed)
Cachedir (cache directory) =/var/cache/yum/$basearch (CPU Architecture)/$releasever (version number)
Keepcache (keep installation package cache) =0 (default)
DebugLevel (Debug)
LogFile (yum log path) =/var/log/yum.log
Exactarch (architecture)
Obsoletes (OBSOLETE)
Gpgcheck (check package signature and integrity) =1 (default)
Plugins (plug-in enabled)
Installonly_limit (parallel installation) =5 (install 5 packages simultaneously)
Bugtracker_url (Bug Tip)
Distroverpkg (System release version)

/etc/yum.repos.d/*.repo: Provides configuration for the point of the warehouse
[Repositoryid] (Cannot have spaces)
Name=repository Name or description information
baseurl=//path (either a local disc or a network)
Gpgcheck=0 do not check the | | check
Gpgkey= Import Key Path
Enabled=0 disabled (default) |
Enablegroups (Disable Group)
Failovermethod (pick path) =roundrobin (random selection, default) |priority (in order)
Cost (priority) = default = 1000 (the smaller the higher)
mirrorlist= files for storing paths

Using the online ready-made Yum Source configuration:
(1) Download to/etc/yum.repos.d/under the wget command
(2) Yum-config-manager--add-repo= website: Generate yum Source directly
--disable|--enable Warehouse Name: Disable | Enable Warehouse

Yum command
Usage:
Show Warehouse list:
Yum repolist[all|enabled|disabled] (available | disabled)
Show Packages:
Yum List[all|glob (wildcard)] (can follow multiple packages)
Yum list[available (available) |install (installed) |updates (updated)][glod]
To install the package:
Yum install Package1 [Package2] [...] (Can be installed more than one)
Yum Reinstall Package1 [Package2] [...] (reinstall)
Upgrade package (not recommended)
Yum update package1 [Package2] [...]
Yum Downgarde package1 [Package2] [...]
Check for available upgrades:
Yum Check-update
To uninstall a package:
Yum remove|erase package1 [Package2] [...]
View Packages: (similar to Rpm-qi)
Yum Info
View which package is provided by the specified attribute (which can be a file): (query file, similar to RPM-QF)
Yum provides|whatprovides feature (features)/file
Clean up Local cache: (/var/cache/yum/$basearch/$releasever cache)
Yum clean [package|metadata metadata |expire-cache invalidation cache |rpmdb|plugins Plugin |all]
Build cache: (typically no manual build, default exists)
Yum Makecache
Search:
Yum search string (string), 1 to develop keyword search package name and summary (summary) information
View the capabilties (capability) on which the specified package depends:
Yum Deplist Package
View Yum History:
Yum history
Work with undo to undo historical actions:
Yum History Undo # (historical entry), Redo redo the article
Yum log:
/var/log/yum.log
To install and upgrade the local package with Yum:
Yum Localinstall (replace with install) Rpmfile/rpmpackage
The advantage of a more RPM installation is that you can automatically install dependent packages
Yum localupdate (replace with update) Rpmfile/rpmpackage
Package Group Management:
View Package group Name:
Yum Grouplist
Install package Group:
Yum Groupinstall (Yum installation package group case insensitive, install package case sensitive)
To view package group information:
Yum GroupInfo
Upgrade Package Group:
Yum Groupupdate
To unload a package group:
Yum Groupremove

Options:
--nogpgcheck: Prohibit Gpgcheck
-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

Yum Warehouse
Custom Create Warehouse:
Createrepo Catalog (storage RPM package)

Package compilation
Package Compilation Installation:
Source code---preprocessing----compile--------
Make project manager to implement the complex process above
Make: (for C, C++,java with maven)
Configure script (custom installation, such as path)-->makefile.in (template file)-->makefile (record custom content, such as installation path)

Compile and install three steps
1,./configure
(1) Pass the parameter through the option, specify Enable feature (function), install path, etc, generate makefile according to selection and makefile.in
(2) Runtime, check dependent external environment (software dependencies)
2. Run make to build the application according to the makefile file
3, make install copy files to the corresponding path
Note: See Install,readme before installing

Linux Notes 4.0

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.