Solve the headache of installing the rpm package dependency, and solve the rpm package dependency.

Source: Internet
Author: User
Tags yum repolist

Solve the headache of installing the rpm package dependency, and solve the rpm package dependency.

Copyright Notice: This article is published at http://www.cnblogs.com/yumiko/. the copyright is available in yumiko_sunny. When reprinting, please indicate the original article link clearly in the article. If the content of this article is used for commercial purposes without the consent of the author, the right to pursue its legal liability will be reserved. If you have any questions, contact the author (793113046@qq.com) by email ).

 

1. Background

In the actual production environment, there are two main problems for installing the rpm package on the linux system.
1) dependency problems that emerge during rpm package installation. As a result, you need to install more packages manually according to the prompts or materials.
2) The yum source of the Internet cannot be connected due to Intranet/Internet isolation.

In view of the above, this article will introduce in detail the yum tool and the method for configuring the local yum source.

 

 

2. Introduction to yum tools
  • As the software manager of the rpm package, the yum tool can install, upgrade, and delete the rpm package, and automatically analyze the dependencies between the rpm packages, this greatly simplifies the maintenance cost of the rpm package.
  • The configuration of the yum tool is mainly controlled by two files:/etc/yum. conf and/etc/yum. repos. d/filename. repo
    • About the/etc/yum. conf file: mainly responsible for the global configuration [main]. You can also configure the software repository (repository) here)
    • About/etc/yum. repos. d/filename. repo: mainly responsible for the configuration of the specific software warehouse (if the above yum. the software repository is configured in conf. You can also choose not to configure it here). filename can be customized.

 

 

3. Detailed description of main parameters in the/etc/yum. conf file

This file is mainly responsible for global configuration. If you do not configure repository in this file, you do not need to change it.

The following is the default yum. conf configuration of the system yum. The specific explanation is as follows:

[Root @ sunny yum. repos. d] # cat/etc/yum. conf [main] -- main defines the global attribute. Only one cachedir =/var/cache/yum -- defines the yum cache directory, for storing and downloading stored rpm packages and other keepcache = 0 -- whether the cached data is saved after successful installation. 0: Do not save. 1: Save debuglevel = 2 -- debug level (0-10). The default value is 2 logfile =/var/log/yum. log -- Define the yum log directory distroverpkg = redhat-release -- determine the current system version by specifying the rpm package for the system release. The default value is redhat-releasetolerant = 1 -- define whether to tolerate errors related to software packages in command lines. 0: intolerable; 1: tolerating exactarch = 1 -- defines whether yum only upgrades the package of the current architecture when the rpm package is updated.
-- When set to 1, the i386 package will not be upgraded to i686
Obsoletes = 1 gpgcheck = 1 -- defines whether to perform GPG verification on the rpm package. 0: Do not verify, 1: Check plugins = 1 -- define whether to use the plug-in. 0: not allowed, 1: allowed

# Default.
# Installonly_limit = 3

# Put your repos here or in separate files named file. repo
# In/etc/yum. repos. d

 

In addition to the preceding parameters, the following main parameters may be used:
Exclude: this parameter is used to block RPM packages that do not want to be updated. Wildcards can be used to separate multiple RPM packages with spaces.

 

 

4. Detailed description of main parameters in the/etc/yum. repos. d/filename. repo File

This file is mainly responsible for the configuration of the specific software warehouse. If you have configured it in the/etc/yum. conf file, you can choose not to configure it.
The following is a default software repository configuration file for the system yum:

[root@sunny yum.repos.d]# cat rhel-debuginfo.repo [rhel-debuginfo]name=Red Hat Enterprise Linux $releasever - $basearch - Debugbaseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/enabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

The parameters are described as follows:
[Rhel-debuginfo]: used to differentiate different repository. In a filename. repo file, one or more repository can be defined.
Name: used to describe repository
Baseurl: Specifies the source location for obtaining the rpm package. Three protocols are supported: http: //, ftp: //, and file.
Enabled: used to define whether the software repository is available. 0: unavailable, 1: available
Gpgcheck: defines whether to perform GPG verification on the rpm package.
Gpgkey: defines the location of the verified gpg key file.

 

 

5. Introduction to Common commands

The following are common commands for yum management:

Yum repolist: view available software Repository Information
Yum list rpm package: Check the installation status of the rpm package. Wildcards * are supported. If the package is installed, the available software warehouse is displayed.
Yum list installed | grep rpm package: Check whether the rpm package is installed
Yum info rpm package: View rpm package details
Yum check-update: check for available rpm package updates
Yum install rpm package: install the rpm package. Wildcards are supported *
Yum remove rpm package: delete rpm package
Yum clean packages: Clear rpm package cache
Yum clean headers: Clear rpm header file Cache
Yum clean all: Clear rpm header files and package cache

 


6. Example of configuring local yum Source

The system used in this example is redhat 5.8 64-bit. The specific process and description are as follows:

-- Install the gcc-c ++ package and prompt that the package cannot be installed because the dependency is missing.
-- If you use manual installation, other dependency Packages may exist during the rpm package installation prompt.
[Root @ sunny Desktop] # rpm-ivh gcc-c ++-4.1.2-52. el5.x86 _ 64.rpm warning: gcc-c ++-4.1.2-52. el5.x86 _ 64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 error: Failed dependencies: gcc = 4.1.2-52. el5 is needed by gcc-c ++-4.1.2-52. el5.x86 _ 64 libstdc ++-devel = 4.1.2-52. el5 is needed by gcc-c ++-4.1.2-52. el5.x86 _ 64
-- The following describes how to install the tool from the image disc by configuring the local source yum.



-- Check the file system. cdrom [root @ sunny ~] is not mounted at this time. # Df-hFilesystem Size Used Avail Use % Mounted on/dev/mapper/VolGroup00-LogVol00 16G 6.1G 8.7G 42%/dev/sda1 99 M 13 M 81 M 14%/boottmpfs 1004 M 0 1004 M 0%/dev/shm
-- Create the cdrom mount point directory
-- The Directory Name of the mount point is random. Here, the directory named cdrom is created as the mount point [root @ sunny ~]. # Mkdir/cdrom

-- Mount cdrom and view the mounting status [root @ sunny ~] # Mount/dev/cdrom [root @ sunny ~] # Df-hFilesystem Size Used Avail Use % Mounted on/dev/mapper/VolGroup00-LogVol00 16G 6.1G 8.7G 42%/dev/sda1 99 M 13 M 81 M 14%/boottmpfs 1004 M 0 1004 M 0%/dev/shm/Dev/sr0 3.9G 3.9G 0 100%/Cdrom
-- Enter the cdrom directory to determine the rpm package location
-- Note that,The absolute path of the rpm package directory will be used as the url source path of the following yum[Root @ sunny Server] # pwd/cdrom/Server

-- Create the filename. repo file. The author defines filename. repo as newyum. repo.
--Note that because baseurl and gpgkey are both local locations, the file: // protocol is used.
--Note that file: // is followed by the absolute path of the file. Therefore, file: // starts with/. Therefore, file: // (three /)[Root @ sunny yum. repos. d] # vi/etc/yum. repos. d/newyum. repo [redhatcdrom] name = local resource baseurl =Fill: // cdrom/ServerEnabled = 1 gpgcheck = 1 gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release -- Query available software repositories at this time, display the available [root @ sunny yum. repos. d] # yum repolistLoaded plugins: katello, product-id, security, subregion-managerUpdating certificate-based repositories. unable to read consumer identityredhatcdrom | 1.5 kB redhatcdrom/primary | 920 kB redhatcdrom 3285/3285 repo id repo name statusredhatcdrom local resource 3,285 repolist: 3,285
-- Use yum to install the gcc-c ++ package
-- We can see that during the installation process, yum processes the dependency and installs the corresponding package [root @ sunny yum. repos. d] # yum install gcc-c ++-yLoaded plugins: katello, product-id, security, subrole-managerUpdating certificate-based repositories. unable to read consumer identityredhatcdrom | 1.5 kB redhatcdrom/primary | 920 kB redhatcdrom 3285/3285 Setting up Install ProcessResolving Dependencies--> Running transaction check ---> Package gcc-c ++. x86_64 0: 4. 1.2-52. el5 set to be updated --> Processing Dependency: libstdc ++-devel = 4.1.2-52. el5 for package: gcc-c ++ --> Processing Dependency: gcc = 4.1.2-52. el5 for package: gcc-c ++ --> Running transaction check ---> Package gcc. x86_64 0: 4. 1.2-52. el5 set to be updated --> Processing Dependency: glibc-devel> = 2.2.90-12 for package: gcc ---> Package libstdc ++-devel. x86_64 0: 4. 1.2-52. el5 set to be updatedredhatcdrom/filelists | 2.8 MB 00:00 --> Running transaction check ---> Package glibc-devel.x86_64 0: 2. 5-81 set to be updated --> Processing Dependency: glibc-headers = 2.5-81 for package: glibc-devel --> Processing Dependency: glibc-headers for package: glibc-devel --> Running transaction check ---> Package glibc-headers.x86_64 0: 2. 5-81 set to be updated --> Processing Dependency: kernel-headers >=2.2.1 for package: glibc-headers --> Processing Dependency: kernel-headers for package: glibc-headers --> Running transaction check ---> Package kernel-headers.x86_64 0: 2. 6.18-308. el5 set to be updated --> Finished Dependency ResolutionDependencies Resolved ==================== ========================================================== =================== Package Arch Version Repository Size ====================== ========================================================== ======================================== Installing: gcc-c ++ x86_64 4.1.2-52. el5 redhatcdrom 3.8 MInstallingFor dependencies: gcc x86_64 4.1.2-52. el5 redhatcdrom 5.3 M glibc-devel x86_64 2.5-81 redhatcdrom 2.4 M glibc-headers x86_64 2.5-81 redhatcdrom 596 k kernel-headers x86_64 2.6.18-308. el5 redhatcdrom 1.4 M libstdc ++-devel x86_64 4.1.2-52. el5 redhatcdrom 2.8MTransaction Summary ========================================== ========================================================== ========= Install 6 Package (s) upgrade 0 Package (s) Total download size: 16 MIs this OK [y/N]: Exiting on user CommandComplete! -- Query the installation result and confirm that the installation is complete. [Root @ sunny yum. repos. d] # yum list gcc-c * Loaded plugins: katello, product-id, security, sub‑managerupdating certificate-based repositories. unable to read consumer identityInstalled Packagesgcc-c ++. x86_64 4.1.2-52. el5 installed

 

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.