RPM command under Linux and Yum Command, use of Package Manager

Source: Internet
Author: User
Tags asymmetric encryption

Package Manager: Package, package management (install, upgrade, uninstall, query and verify)
Deb:debian
Rpm:redhat Package Manager
RPM is the package Manager

Components of the package:
Binary program:/bin,/sbin,/usr/bin,/usr/sbin
Library files:/lib64,/usr/lib64
Configuration file:/etc
Help files: manual,info, etc.

The role of the Package Manager:
Package: In a single archive file;
Installation: To expand the packaging files in the current;
Uninstall: Integrate and delete the package files;
Upgrade: Replace the old program;
Inquire:
Verification: The source legitimacy of the package, the integrity of the package;

RPM Package: The main function is packaging--rpmbuild: Based on the specs file for packaging


Subcontracting mechanism:
Testapp-version.tar.gz
Main package: Testapp-version
Support package: testapp-devel-version \ \ Package Other less common installation packages under the main package
Version is typically available in three versions: Major.minor.release

The naming mechanism for RPM packages:
name-version-release.arch.rpm
RELEASE:RPM Version number

Between packages and packages: there may be dependencies;
For example, if x is installed, you must install Y again to use the X function properly.

RPM Database: Under the/var/lib/rpm directory

How to get the RPM package:
1. The package provided by the release version;
2.fedora-epel program Project;
3. Project official site;
4. Search Engine
Rpmfind.net
Rpm.phone.net
pkgs.org

View CentOS Version: Cat/etc/centos-release

Equipment files for the CentOS identification disc:/dev/cdrom
ls | Wc-l viewing the total number of files

implement package management based on RPM command:
Installation:

RPM {-i|--install} [install-options] Pack-age_file.
-I: Direct installation
-V: Show detailed procedure,-VV,-VVV
-h:hash Mark

RPM-IVH Installation
RPM-E Uninstall
RPM-VVH detailed display of the installation process
Rpm-q Query Installation

Example: use RPM to install the package and display the installation process in detail, and uninstall:

First we need to mount the package:

1. Create a mount directory,/media/cdrom, Mount success:

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/11/ Wkiol1xz5kagknhsaaczkr6cqd4347.jpg "" 485 "height=" 102 "/>

2. To view the installable packages, first we have to go to the Mount directory,/media/cdrom, to see a package directory under its directory packages:

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/11/ Wkiol1xz5k2rhkgeaahhydcfnoi384.jpg "" 490 "height=" 211 "/>

You can use Wc–l to view the total number of files:

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/11/ Wkiol1xz5k6dduhnaacv3si3nd0017.jpg "" 495 "height="/>

3. Choose an installation package to install, install successfully:

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/11/ Wkiol1xz5lgwotmlaakocnqza3e706.jpg "" 502 "height=" 355 "/>

4. Uninstall the installation package:

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/11/ Wkiol1xz5llc0pl2aabhrbbroxw672.jpg "" 502 "height="/>

One or more capabilities per RPM package (capability)
Dependent packages If you do not want to be in control:
--nodeps Ignore dependency installation;

The first installation package shows that there is a dependency, then we can ignore the dependent direct installation using--nodeps;

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/11/ Wkiol1xz5lxht4ijaaehmkjujn4610.jpg "" 503 "height="/>
--replacepkgs Reload a package;

To install a package that has already been installed:

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/11/ Wkiol1xz5lqjun9yaacwsp28mw8776.jpg "" 507 "height=" "The/>
--oldpackage downgrade: Unfamiliar or unaccustomed after upgrade, can downgrade back to the previous

Version
--force forced escalation;

RPM {-u|--upgrade} [install-options] pack-
Age_file ...

RPM {-f|--freshen} [install-options] pack-
Age_file ...

-UVH: If there is an older version of the package, then upgrade it, if not, install it.
-FVH: If an older version of the package is upgraded, it is not installed if it is not.


Unloading:
RPM {-e|--erase} [--allmatches] [--nodeps] [--noscripts] [--notriggers] [--test] package_name ...

Uninstall we used to be just-e, so the following other options are generally not too useful.

Enquiry:
RPM {-q|--query} [select-options]- pick Options [query-options]- query Options
Common options:
-qa Querying all installations
The-QF query here specifies which package installation of the file is generated. Query as directory:/etc/fstab
The-QC query specifies the configuration file that is generated by the package installation.
-QD queries the specified package to install the generated help documentation.
-qi queries for information about the specified package.
-QL a list of all files generated by the query package installation.
-QR query packages depend on which packages are provided
-Q--scripts Query package related script:
Preinstall: Pre-installation script
Postinstall: Post-installation script
Preuninstall: Pre-uninstall script
Postunistall: Post-uninstallation script

-P: The query is for a package file that is not installed and is usually used with-q;

Example: Using-PQC to query the configuration file generated by the installation package:
650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/11/ Wkiol1xz5lzbdx9kaabw6tchgx0374.jpg "486" height= "/>"

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

Package Check:
Source Legitimacy Verification: asymmetric encryption
Package Integrity Verification: one-way encryption
command to import keys: RPM--import secret key Path
Checksum: Rpm-k indicates the installation package

Secret key location:/etc/pki/rpm-gpgs

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/14/ Wkiom1xz4o-iybwzaactoaz-xom144.jpg "" 462 "height="/>

Import secret key:

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/14/ Wkiom1xz4pgybtbraabpz6hs76g603.jpg "" 476 "height="/>

Check:

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/14/ Wkiom1xz4plrwlncaabrgd0fstk514.jpg "" 483 "height="/>


Yum:yellowdog Updater Modified
YUM:RPM Package front-end management tool; automatically resolves package dependencies;
Yum relies on the Yum repository: Yum repositories
File server:
Ftp://hostname/path/to/repo \\hostname for FTP host name
Http://hostname/path/to/repo
File:///path/to/repo


configuration files for the Yum program :
/etc/yum.conf Defining a global configuration: configurations that are applicable to all warehouses
/etc/yum.repos.d/*.rpo a file is typically used for a warehouse or a group of similar or related functions

Define a warehouse to point to:
[REPO_ID]
Name=
Baseurl= can have multiple paths, but the content must be the same, and it is not recommended to point to multiple.
Mirrorlist=scheme://hostname/path/to/mirror_list_file
ENABLED={1|0} 1 Enable 0 disable default enable
GPGCHECK={1|0} 1 Test 0 no test
Gpgkey= indicates which secret key to use to verify
Cost= indicates the cost of the Yum Warehouse

Define the variables that are available when the warehouse points:
$releasever: Reference the major version number of the current system
$basearch: The basic architecture of the current system
I386,i486,i586,i686:i386,x86_64

Example: http://mirrors.aliyun.org/Centos/$releasever/os/$basearch \ $releasever refers to the Centos system version, $basearch refers to the system architecture, such as 32-bit or 64-bit;


use of the yum command
Yum [options] [command] [package ...]
Installation: Yum Install
Uninstall: Yum Remove
Enquiry: Yum Info
Search KEYWORD
List all|installed|availiable
Probides/path
Upgrade: Yum update; checkupdate query upgradeable
Reinstall: Reinstall
Downgrade: Downgrade
Cleanup cache: Clean
Build cache: Makecache
Package Group: Grouplist List all package groups
GroupInfo ""
Groupinstall "grp_name" installation group files
Groupremove "Grp_name" unload group file
Warehouse: repolist all|enabled|disabled List Warehouse

1. Install and uninstall the package using Yum:

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/14/ Wkiom1xz4pbru9w4aafw9kxzmxm649.jpg "" 484 "height=" 237 "/>

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/14/ Wkiom1xz4pqsp954aaerroosxxs279.jpg "" 483 "height=" 218 "/>

2. Use Yum to query the installation package information:

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/11/wKioL1Xz5M_ Zsa4faafwrmaoh-o645.jpg "" 493 "height=" 239 "/>

3. Use Yum to view package groups:

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/11/ Wkiol1xz5nhcq7-eaadjlq4zuqu820.jpg "" 502 "height=" 234 "/>

4. Use Yum to view the enabled repositories:

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/11/ Wkiol1xz5nkzszdiaadh9uubke0539.jpg "" 509 "height=" 131 "/>


How to use the release version of the CD as a local repository:
Mount a disc to a directory
Define the warehouse and use file:///to indicate its access path

To create a local warehouse:
Yum Install Createrepo
Createrepo/path/to/rpmfiles

DNF: Next-generation front-end manager;

RPM command under Linux and Yum Command, use of Package Manager

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.