Linux package Management (CentOS)

Source: Internet
Author: User
Tags gpg

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 are package manager)


Source code: NAME-VERSION.TAR.GZ

VERSION:major.minor.release


RPM Package Naming method:

name-version-release.arch.rpm

VERSION:major.minor.release

Release:os

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

YUM:RPM Package Manager Front-end tools

Apt-get:deb Package Manager Front End Tool

RPM front-end management tools on Zypper:suse

Dnf:fedora 22+ RPM Package Manager Front End management tool


To view the library files on which the binaries depend: ldd/path/to/binary_file

Manage and view native-mounted library files: ldconfig

/sbin/ldconfig-p: Displays all available library file names 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: Package The compilation of the application of the components of one or several package files, so as to quickly and easily implement package installation, uninstallation, query, upgrade and verify management operations

1, the composition of the program list (each package unique)

A script that runs when a file is inventoried, installed, or uninstalled

2. Database (public)

Package name and version, dependencies, function description, file path and checksum information for each file generated by the installation


How to manage Packages:

Using Package Manager: RPM

Using the front end tool: Yum, DNF


Ways to get Packages:

(1) System-issued CD-ROM or 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, package integrity


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: Does not check the legitimacy of the source

--nodigest: Package integrity is not checked

--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

Notes:

(1) Do not upgrade the kernel, Linux supports multi-core version coexistence, so the new version of the kernel can be installed directly

(2) If the original package configuration file has been modified after installation, upgrade, the new version of the same profile provided does not directly overwrite the old version of the configuration file, and the new version of the file renamed (filename.rpmnew) retained


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 a package file that has not been installed

--whatprovides CAPABILITY: Query which package is supplied by the specified CAPABILITY

--whatrequires CAPABILITY: Query which package the specified 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


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


Verification of the validity and completeness of package source legality:

Integrity Verification: SHA256

SOURCE legality verification: RSA


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

New if no database exists beforehand; otherwise, no action is taken

REBUILDDB: Rebuilding

Recreate the database directly, whether it is present or not


RPM Command Summary:
Installation:-IVH,--nodeps,--replacepkgs
Uninstall:-E,--nodeps
Upgrade:-UVH,-FVH,--nodeps,--oldpackage
Queries:-Q,-qa,-QF,-qi,-QD,-QC,-Q--scripts,-Q--changlog,-Q--provides,-Q--requires
Checksum:-V

Import GPG key:--import,-K,--nodigest,--nosignature
Database rebuild:--initdb,--REBUILDDB


Yum Package Management:

Yum:yellow Dog, Yellowdog Update Modifier

Yum Repository:yum Repo

Storage of many RPM packages and related 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, which means random selection

Cost=: Default is 1000


Yum command usage: yum [options] [command] [package ...]

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 Package name and summary information with the specified keyword

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

-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

Variables available in the repo configuration file for Yum

$releasever: Major version number of the current OS release

$arch: Platform

$basearch: Base Platform

To create a yum repository:

Createrepo [Options] <directory>


Package Compilation Installation:

TESTAPP-VERSION-RELEASE.SRC.RPM---after installation, use the Rpmbuild command to make the RPM package in binary format before installing

Source code----preprocessing----compile (GCC)------Execute

Source Code organization format:

Multiple files: Between the code in the file, there is likely to be a cross-file dependency

C, C + +: Make (Configure--makefile.in--Makefile)

C Code compilation installation three steps:

./configure:

(1) Pass the parameter through the option, specify enable feature, install path, etc., refer to User's designation and makefile.in file generation makefile when executing

(2) Check the external environment of dependence;

Make

Build your application According to the makefile file

Make install

Move the app to the specified location


Development tools:

AUTOCONF: Generate Configure Script

Automake: Generate makefile.in

Recommendation: View Install,readme before installation


Source code acquisition of open source program:

Official self-built site:

Apache.org (ASF)

mariadb.org

...

Code hosting:

SourceForge

Github.com

Code.google.com


C + +: gcc (GNU c complier)

Compile C source code:

Premise: Provide development tools and development environment

Development tools: Make, GCC, etc.

Development environment: Development Library, header file

GLIBC: Standard Library

To provide development components through "package groups"

CentOS 6: "Development Tools", "Server Platform development"

First Step: Configure script

Options: Specify the installation location, specify the enabled features

--help: Get the options it supports

Option Categories:

Installation path settings:

--prefix=/path/to/somewhere: Specifies the default installation location; default is/usr/local/

--sysconfdir=/path/to/somewhere: Configuration File Installation Location

System types:

Optional Features: Optional Features

--disable-feature

--enable-feature[=arg]

Optional Packages: Optional Package

--with-package[=arg]

--without-package

Step Two: Make

Step Three: Make install


Post-installation configuration:

(1) Export the binary program directory to the PATH environment variable

Edit File/etc/profile.d/name.sh

Export Path=/path/to/bin: $PATH

(2) Export Library file path

Edit/etc/ld.so.conf.d/name.conf

Add a new library file in the same directory as this file

To have the system regenerate the cache

Ldconfig [-v]

(3) Export header file

Implemented in a link-based manner

Ln-sv

(4) Export Help manual

Edit/etc/man.config File

Add a Manpath

This article is from the "Ricky Technology Blog" blog, make sure to keep this source http://r1cky.blog.51cto.com/10646564/1773859

Linux package Management (CentOS)

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.