Yum Solution rpm Package installation dependencies and Yum tools Introduction to the local source configuration method _linux

Source: Internet
Author: User
Tags gpg yum repolist

1. Background overview

In the actual production environment, there are two practical problems in installing RPM packages on Linux systems

1 installation of the RPM package process, the emerging problem of dependency, resulting in the need to follow the prompts or query information, manually install more packages

2 due to the isolation of the internal and external network, can not connect the external network yum source

In view of the foregoing, this article will detail the Yum tools and methods for configuring the local Yum source

2, Yum tool introduction

Yum Tool as the software manager of RPM package, it can do the daily management work of installation, upgrade and deletion of RPM package, and the dependence between RPM package can be analyzed automatically, which simplifies the maintenance cost of RPM package greatly.

The configuration of the Yum tool is mainly controlled by two files:/etc/yum.conf and/etc/yum.repos.d/filename.repo about/etc/yum.conf files: mainly assume global configuration [main], In addition, you can configure the Software warehouse here (repository)

• About/etc/yum.repos.d/filename.repo: The main commitment to the specific software warehouse configuration (if the above yum.conf configuration of the Software warehouse, here also can choose not to configure), filename can be defined by itself.

3,/etc/yum.conf document main parameters detailed

This file is mainly responsible for global configuration, if not in this file for repository configuration, generally do not need to change

The following is the default yum.conf configuration for the system Yum, as shown in detail:

[Root@sunny yum.repos.d]# cat/etc/yum.conf 
[main]--main defines global properties, only one 
Cachedir=/var/cache/yum--Defines the Yum cache directory, Used to store keepcache=0 such as the RPM package for download storage-The
cached data is saved after a successful installation. 0: Do not save, 1: Save 
debuglevel=2--Debug level (0-10), default to 2
logfile=/var/log/yum.log--Define Yum log directory
distroverpkg= Redhat-release--Determines the current system version by specifying the RPM package for the system release. The default value is Redhat-release
tolerant=1--Defines whether a package-related error is tolerated on the command line. 0: Intolerance, 1: Tolerance
exactarch=1--Define whether Yum only upgrades the current schema package when the RPM package is updated. -When set to 1, i386 package upgrades to i686
Obsoletes=1 gpgcheck=1 are not occurring-
define whether the RPM package is GPG verified. 0: No checksum, 1: Checksum
Plugins=1--Defines whether to use Plug-ins. 0: Not allowed, 1: Allow 
# Default.
# installonly_limit = 3
# put YOUR REPOS this OR in separate files named File.repo
# IN/ETC/YUM.REPOS.D

In addition to the above parameters, the main parameters that may be used are:
Exclude: This parameter is mainly used to screen the RPM package that you do not want to update, you can use wildcard characters and separate the multiple RPM packages with spaces.

4,/etc/yum.repos.d/filename.repo document main parameters detailed

The file is mainly responsible for the configuration of the specific software warehouse, if the/etc/yum.conf file in the configuration, you can choose not to configure.

The following is the default configuration file for a software warehouse in system Yum:

[Root@sunny yum.repos.d]# cat Rhel-debuginfo.repo 
[rhel-debuginfo]
name=red Hat Enterprise Linux $releasever- $basearch-debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/ debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-redhat-release

The parameters are explained as follows:

[Rhel-debuginfo]: Used to differentiate between different repository, in a Filename.repo file, you can define one or more repository

Name: For a description of the repository

BaseURL: For specifying the source location of the RPM package, support for http://, ftp://, file://three protocols.

Enabled: Used to define whether this software warehouse is available. 0: Not available, 1: Available

Gpgcheck: Defines whether a GPG checksum is performed on the RPM package.

Gpgkey: The location of the GPG key file that defines the checksum.

5. Introduction of COMMON commands

Here are the common commands for Yum management

Yum repolist: View available software warehouse information

Yum List RPM Package: View the RPM package installation, support wildcard *, if installed, display the available software warehouse

Yum List installed |grep RPM package: see if the RPM package is installed

Yum Info rpm Package: View RPM Package Details

Yum check-update: Check the available RPM package updates

Yum Install RPM Package: Install RPM package, support wildcard character *

Yum Remove rpm Package: Delete RPM Package

Yum Clean Packages: Clear the RPM package cache

Yum Clean headers: Clear rpm Header File cache

Yum Clean all: Clears the RPM header file and the package cache

6. Specific examples of configuring local yum sources

This example uses a system of Redhat 5.8 64-bit, with the following procedure and instructions:

--Install the gcc-c++ package, indicating that the dependencies are not installed because of the lack of a package--if you install it manually, there may be other dependencies that you need during installation of the prompt RPM package [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--Start by configuring the local source yum to install from a mirrored disc--View the file system, which is not mounted at this time cdrom [Root@sunny ~]# df-h filesystem Size Used Avail use% mounted on/dev/mapper/volgroup00-logvol00 16G 6.1G 8.7G 42%//dev/sda1 99M 13M 81M 14%/boot tmpfs 1004M 0 10 04M 0%/DEV/SHM--Create a CDROM mount point directory--The mount point directory name is random, where the author creates a directory named CDROM as the mount point [Root@sunny ~]# Mkdir/cdrom--mount CDROM, and view the Mount case [ Root@sunny ~]# mount/dev/cdrom/cdrom [root@sunny ~]# df-h filesystem Size Used avail use% mounted On/dev/mapper/volgro Up00-logvol00 16G 6.1G 8.7G 42%//dev/sda1 99M 13M 81M 14%/boot tmpfs 1004M 0 1004M 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 RPM package is located in a directory that is absolutelyThe path will be the URL source path for the following Yum [Root@sunny server]# Pwd/cdrom/server- Create the Filename.repo file, where the author defines filename.repo named newyum.repo--need to be aware that because BaseURL and Gpgkey are local locations, the FILE://protocol is used--note, file:// The following is the absolute path where the file is located, so the file://is followed by/, so it is file:///(three/) [Root@sunny yum.repos.d]# Vi/etc/yum.repos.d/newyum.repo [ Redhatcdrom] name=local resource baseurl=fill:///cdrom/server enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/ Rpm-gpg-key-redhat-release-Query the software warehouse available at this time, showing that the library you just configured is available [Root@sunny yum.repos.d]# yum repolist Loaded,
Product-id, security, Subscription-manager updating certificate-based repositories. Unable to read consumer identity Redhatcdrom | 1.5 KB 00:00 Redhatcdrom/primary | 920 KB 00:00 redhatcdrom 3285/3285 repo ID repo name Status redhatcdrom local resource 3,285 repolist:3,285--use Yum to install just the Gcc-c++ Package--you can see that during the installation, Yum handled the dependencies and installed the appropriate packages [Root@sunny yum.repos.d]# yum install gcc-c++-y Loaded Plugins:katello,
Product-id, security, Subscription-manager updating certificate-based repositories. UnaBLE to read consumer identity Redhatcdrom | 1.5 KB 00:00 Redhatcdrom/primary | 920 KB 00:00 redhatcdrom 3285/3285 Setting up Install Process resolving 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 K---> Package gcc.x86_64 0:4.1.2-52.el5 set to is updated--> processing dependency:glibc-devel >= 2.2.90-12 fo R PACKAGE:GCC---> Package libstdc++-devel.x86_64 0:4.1.2-52.el5 set to be updated Redhatcdrom/filelists | 2.8 MB 00:00--> Running transaction Check---> Package glibc-devel.x86_64 0:2.5-81 set to be updated--> Sing 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 is 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 is updated--> finished Dependency resolution dependencies resolved ============ ========================================================================== Package Arch Version Repository Size = = ================================================================================== installing:gcc-c++ x86_64 4.1.2-52.el5 Redhatcdrom 3.8 M installing for 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.8 M Transaction Summary ===========================================
===========================================Install 6 Package (s) Upgrade 0 Package (s) Total download size:16 M are this OK [y/n]: Exiting on user Command complete!
--Query the installation results to determine that the installation is complete. [Root@sunny yum.repos.d]# yum list gcc-c* Loaded Plugins:katello, Product-id, security, Subscription-manager updating CER
tificate-based repositories. Unable to read consumer identity installed Packages gcc-c++.x86_64 4.1.2-52.el5 installed

The above is a small series to introduce the Yum solution rpm package installation dependencies and Yum tools to introduce the local source configuration method, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.