5th Chapter Package Management (1) _rpm package Installation

Source: Internet
Author: User

1. Package Introduction

1.1 Package Classification

(1) source package : such as C, C + + source package, script installation package can be installed automatically after execution.

(2) binary package : Redhat series (e.g. CentOS): for rpm packages , Debian series (e.g. Ubuntu): for deb Packages , these are the respective system default packages), they are all compiled files

1.2 Source Package

(1) advantages of the source package

① Open Source, if you have enough ability, you can modify the original code

② is free to choose the functions you need

③ software is compiled and installed, so more suitable for your own system, more stable, more efficient

④ Easy to unload

(2) The shortcomings of the source code package

① installation process is many steps, especially when installing large software collections (such as lamp environment), prone to spelling errors.

② compile process time is longer, installation is longer than binary installation time

③ because it is a compilation installation, the installation process once the error, novice difficult to solve.

1.3 RPM Package

(1) advantages of two packages

① Package Management system is simple, with only a few commands to implement package installation, upgrade, query and Uninstall

② installation speed is much faster than the source package installation

(2) disadvantages of binary packages

① compiled, no longer visible source code

② feature selection is not as flexible as the source package

  ③ Dependency Issues , such as A→b→c, install C First, install B, and finally install a. Uninstall first A, then B, finally C)

2. RPM Package Management

2.1 rpm Command Management

(1) RPM package naming principle (e.g. httpd-2.2.15-53.el6.centos.1.i686.rpm)

①HTTPD: Package Name

②2.2.15: Software version

③53: Number of software releases

④el6.centos: the right Linux platform

⑤i686: Suitable hard and soft platform

⑥RPM:RPM Package Extension

(2) RPM package dependencies

 ① Tree-dependent: a→b→c, first installed C again B, finally A. Uninstall first A and B last C)

② ring-dependent: a→b→c→a, use the command to install the ABC simultaneously.

③ module dependencies: such as library dependencies. Available to module dependent Web query: www.rpmfind.net

(3) RPM Package installation, uninstallation and upgrade command: RPM [option] Package full name (or package name)

Options

Meaning

Note

-I.

Install packages

Format:RPM–IVH Package full name , such as:

#rpm –IVH httpd-2.2.15-53.el6.centos.1.i686.rpm

-E

Uninstalling the installation package

Format: Rpm–e package name, such as:

#rpm –e httpd (but be aware of dependencies)

-U

Upgrade the installation package

Format: RPM–UVH Package full Name

-V

verbose , show more information

-H

Hash , Show Progress

--nodeps

No dependency detection

(4) RPM Package query : Format #rpm [options] Package full name (or package name)

Options

Meaning

Note

-Q

Query

-qa : All installed Packages

-qi : query software Information

-QIP : Query for package information not installed

-ql : Show as List

P align= "left" > -QLP : Query for package information not installed

-qf : Query which package the system files belong to

-QR : Query the dependencies of the package

-QRP : Query dependencies for packages not installed

① query whether the HTTPD package is installed:

#rpm –q httpd

② query all installed RPM packages

#rpm –q

③ Querying httpd Package software information in list form

#rpm –QL httpd

④ Query system file belongs to which RPM package

#rpm –qf/etc/yum.conf (System file name)

⑤ query httpd dependencies for packages not installed:

#rpm –QRP/Path/HTTPD package full name

(5) RPM Package inspection : Format: Rpm–v installed package name

The items inspected

Meaning

Verify that the contents of the

8 bits of information

S: File size changed

M: File type or file permissions (RWX) changed

5: File MD5 checksum is changed (can be seen as file content changes)

D: Whether the device has changed

L: File path is changed

U: Whether the owner of the file has changed

G: Whether the genus Group of the file has changed

T: Changes in file modification time

File type

C: Profile (config file)

D: Ordinary documents (documentation)

G: Ghost file, indicating that the file should not appear in this RPM package, if present, indicates that the package may be a problem.

L: Authorization document (license file)

R: Profile (Read Me)

Note

① can only be used to verify that the installation package has been changed.

② Case Study: #rpm –V httpd

"description" After the command is run, the current httpd package is compared to the package that was just installed. If it is not modified, it is returned directly, and if it has been modified, it will show which file has been modified and the item (represented by 8 information bits). Such as

S.5 .... T. c/etc/httpd/conf/httpd.conf, indicates that httpd.conf this file s, 5, T is modified, other unchanged. Where c indicates that the file is a configuration file type

(6) file extraction in RPM Package: Format: #rpm2cpio Package full Name | Cpio–idv. File absolute Path

①rpm2cpio: Convert RPM package to CPIO format

②cpio: is a standard tool that is used to create software archive files and extract files from archive files. Its command format is as follows: Cpio [options] < [file | device]

A. The –i:copy-in mode, that is, restore, unzip the backup file. -o:copy-out mode, the file is copied into the backup file, that is, compression. -D: Automatically create a new directory when restoring. -V: Displays the restore process.

B. Extract the files from the specified file or device by entering redirect <.

③ Application Examples

 #rpm –qf/bin/ls  //  query ls command belongs to which package  #  MV /bin/ ls /tmp///  The analog ls command was mistakenly deleted.  //  extract the ls command from the RPM package to/bin/ls under the current directory  Span style= "COLOR: #000000" > #rpm2cpio /mnt/cdrom/packages/coreutils-8.4 -19 . el6.i686.rpm |  Cpio–idv.  /bin/ls  #   CP /root/bin/ls /bin///  copy the LS command to the/bin/directory and repair the file loss. 

2.2 Yum Online Management

2.2.1 IP address configuration and network Yum source

(1) IP address configuration:

①vi/etc/sysconfig/network-scripts/ifcfg-eth0

② change onboot= "No" to onboot= "yes"

③ Restart Network Service: #service networks restart

(2) Network Yum source

 ① #vi/etc/yum.repos.d/centos-base.repo

[Base]      container name, must be placed in the [] name        container description, you can freely write mirrorlist  mirror site, you can comment out     the BaseURL Yum source server address. The default is the CentOS official Yum source Server enabled     if this container is active, if not written or written as enable= 1 is in effect, enable=0 does not take effect Gpgcheck    If 1 refers to the RPM digital certificate is in effect, if 0 does not take effect Gpgkey      The digital certificate is saved in the public key file location. Without modification. 

②yum Source Setup Example

2.2.2 Yum Command

(1) query The list of all available packages: #yum lists

(2) Search all the keywords related to the server: #yum search keyword

(3) installation : #yum –y Install package name (where-y automatically answer yes), such as #yum–y install gcc-c++

(4) upgrade : #yum –y Update package name (Note that if you do not write the package name, all software and Linux kernels will be upgraded!)

(5) uninstall : #yum –y Remove Package name (note that uninstallation will also remove its dependent package!) )

2.2.3 Yum software Group Management commands

(1) List of all available software groups : #yum grouplist

(2) install The specified software group : #yum groupinstall software group name (group name can be queried by grouplist, Yum does not know the Chinese name of the software group name, there are spaces in the name, to enclose the entire name in quotation marks)

 ① switch English: #LANG =en_us yum grouplist or

# Lang=en_us

#yum grouplist

② switch Chinese: #LANG =zh_cn.utf8

(3) uninstall the specified software group : #yum groupremove software Group name

2.2.4 disc Yum Source setup

(1) Mounting disc: #mount/dev/cdrom/mnt/cdrom/

(2) to invalidate the network Yum source file:

#cd/etc/Yumrepos.d/#mv centos-base.repo cenos-base.repo.bak  // renaming  #mv centos-debuginfo.repo cenos-debuginfo.repo.bak#mv Centos-vault.repo  Centos-vault.repo.bak

(3) Modify disc yum source file: #vim Centos-media.repo

5th Chapter Package Management (1) _rpm package Installation

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.