Package management in Linux: YUM

Source: Internet
Author: User
Tags yum repolist

Package management in Linux: YUM

Lab environment:

One CentOS release 6.6 (Final)

IP Address: 172.16.249.230

Attached: CentOS release 6.6 CD image file

CentOS-6.6-x86_64-bin-DVD1.iso

CentOS-6.6-x86_64-bin-DVD2.iso

YUM (Yellow dog Updater, Modified) is developed by the Duke University team to modify the Yellow Dog Updater of Yellow Dog Linux. It is a character front-end Software Package Manager based on RPM package management. The RPM package can be automatically downloaded and installed from the specified server, and dependencies can be handled. All dependent software packages can be installed at one time without tedious download and installation. It is used by Yellow Dog Linux, and Fedora, Red Hat Enterprise Linux, CentOS, and SUSE.

RedHat 6.2 modify yum source in Linux use CentOS source for free

Configure the epel yum Source

Redhat local yum source configuration

Description of yum configuration file

Install yum in RedHat 6.1)

YUM installation and cleaning

Build yum local source on CentOS 6.4

1. Introduction to YUM repository and client

YUM repository: yum repository

File servers that store numerous rpm packages and package-related metadata

File Server:

HTTP: http: // ip/centos/$ releasever/OS/$ basearch/

FTP: ftp: // ip/centos/$ releasever/OS/$ basearch/

NFS: Network File System, nfs: // ip/centos/$ releasever/OS/$ basearch/

FILE: local, file: // centos/$ releasever/OS/$ basearch/

YUM Client: Client

Configuration File: points to the warehouse location and various configuration information. Each yum client can have multiple warehouses.

Cache file:/var/cache/yum/

Ii. Detailed description of the YUM configuration file

There are two methods to configure yum. One is to directly configure yum under the/etc directory. conf file, the other is in/etc/yum. repos. d directory. repo file.

(1). Detailed description of the yum. conf file

# Cat/etc/yum. conf

[Main]

Cachedir =/var/cache/yum/$ basearch/$ releasever

# Cache directory of the RPM package downloaded by yum

Keepcache = 0

# Whether the cache is saved; 1: Save; 0: Do not save.

Debuglevel = 2

# Debugging level (0-10). The default value is 2 (I do not know about the specific debugging level application ).

Logfile =/var/log/yum. log

# Location of the yum Log File

Exactarch = 1

# Whether to allow updating RPM packages of different versions during update, for example, whether to update i686 RPM packages on i386.

Obsoletes = 1

# This is an update parameter. For details, refer to yum (8). In short, it is equivalent to upgrade, which allows you to update outdated RPM packages.

Gpgcheck = 1

# Whether to check GPG (GNU Private Guard), a key signature method.

Plugins = 1

# Whether to allow the use of plug-ins. The default value is 0, but we usually use the yum-fastestmirror plug-in.

Installonly_limit = 5

# How many kernel packages can be retained.

Bugtracker_url = http://bugs.centos.org/set_project.php? Project_id = 19 & ref = http://bugs.centos.org/bug_report_page.php? Category = yum

Distroverpkg = centos-release

# This is the default, if you make this bigger yum won't see if the metadata

# Is newer on the remote and so you'll "gain" the bandwidth of not having

# Download the new metadata and "pay" for it by yum not having correct

# Information.

# It is esp. important, to have correct metadata, for distributions like

# Fedora which don't keep old packages around. If you don't like this checking

# Interupting your command line usage, it's much better to have something

# Manually check the metadata once an hour (yum-updatesd will do this ).

# Metadata_expire = 90 m

# Put your repos here or in separate files named file. repo

# In/etc/yum. repos. d

(2). Details about the/etc/yum. repos. d/*. repo File

What is a repo file?

The repo file is the configuration file of the yum source (software warehouse) in CentOS. Generally, a repo file defines the details of one or more software warehouses, for example, we will download the software package to be installed or upgraded from where, and the setting content in the repo file will be read and applied by yum!

We will use a repo file that comes with the system as an example (# is followed by a comment I added ):

[Base]

Name = CentOS-$ releasever-Base

# Baseurl = http://developer.centos.org/centos/?releasever/ OS /?basearch/

Gpgcheck = 1

Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6


[Base]

# The Name Of The software source is in square brackets and will be obtained and recognized by yum.

Name = CentOS-$ releasever-Base

# The Name Of The software warehouse is also defined here. It is usually used to facilitate reading the configuration file,

The $ releasever variable defines the release version, which is usually 5, 6, 7, and other numbers,

This variable has different values based on the current system version architecture,

This allows you to select a software package suitable for the current system during yum upgrade ......

# Baseurl = http://developer.centos.org/centos/?releasever/ OS /?basearch/

# The first character of the above line of baseurl is '#', indicating that the line has been commented and will not be read,

The $ basearch variable defines the system architecture, which can be i386, x86_64, or ppc equivalent.

This line specifies a baseurl (source image server address)

Enabled = 1

# This option indicates that the source defined in this repo is enabled, and 0 indicates disabled.

Gpgcheck = 1 #

This option indicates that the rpm downloaded in this repo will undergo gpg verification. It has been determined that the rpm package source is valid and safe.

Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

# Define the gpg key used for verification

3. Build a YUM Repository

Brief steps

(1) confirm the File Sharing Method

(2) Place the rpm package in a location that can be accessed by various yum clients

(3) create metadata for the yum Repository

Createrepo command

# Yum-y install createrepo


Create a metadata file for the yum Repository

# Createrepo package file directory

Lab case:

In this article, I create a local CD yum to build a local YUM repository.

(1) attach a Local CD

# Mkdir/mnt/cdrom


# Creating a mount directory

# Mount-t iso9660/dev/cdrom/mnt/cdrom


# Attach a CD to the/mnt/cdrom directory

# Ls/mnt/cdrom


# View/mnt/cdrom directory content

[Root @ LinuxHost yum. repos. d] # mkdir/mnt/cdrom

[Root @ LinuxHost yum. repos. d] # mount-t iso9660/dev/cdrom/mnt/cdrom

Mount: block device/dev/sr0 is write-protected, mounting read-only

[Root @ LinuxHost yum. repos. d] # ls/mnt/cdrom

CentOS_BuildTag isolinux RPM-GPG-KEY-CentOS-Debug-6

EFI Packages RPM-GPG-KEY-CentOS-Security-6

EULA RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Testing-6

GPL repodata TRANS. TBL

Images RPM-GPG-KEY-CentOS-6

(2) configure the local YUM Source

# Cd/etc/yum. repos. d/


# Enter the/etc/yum. repos. d directory

# Ls


# Viewing directory content


# Mv CentOS-Base.repo CentOS-Base.repo.bak

# Mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.bak


# Rename the above two files


# Vi CentOS-Media.repo


# Edit CentOS-Media.repo


(3) Modify CentOS-Media.repo content

C6-media

Name = CentOS-$ releaserver-Media

# Custom Yum source name

Baseurl = file: // mnt/cdrom/

# Local CD mounting path

Gpgcheck = 1

# Check GPG-KEY

Enabled = 1

# Enable Yum Source

Gpgkey = file: /// mnt/cdrom/RPM-GPG-KEY-CentOS-6

# GPG-KEY path

 

[Root @ LinuxHost yum. repos. d] # cat CentOS-Media.repo

C6-Media

Name = CentOS-$ releaserver-Media

Baseurl = file: // mnt/cdrom

Gpcheck = 1

Enabled = 1

Gpgkey = file: /// mnt/cdrom/RPM-GPG-KEY-CentOS-6


Check to list available yum repository metadata

[Root @ LinuxHost yum. repos. d] # yum repolist

Loaded plugins: fastestmirror, refresh-packagekit, security

Loading mirror speeds from cached hostfile

Repo id repo name status

C6-Media CentOS-$ releaserver-Media 6,518

Repolist: 6,518

Now that the local YUM source configuration is complete, we can use the yum command to install the management package.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

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.