1. local yum source 1. the system has installed a software package that can use yum by default, so you can directly configure: [root @ localhost ~] # Cd/etc/yum. repos. d/& nbs
1. local yum source
1. the system has installed the yum software package by default, so you can directly configure it:
[Root @ localhost ~] # Cd/etc/yum. repos. d/yum source configuration file directory
[Root @ localhost yum. repos. d] # mv CentOS-Base.repo CentOS-Base.repo.bak first rename the network yum source configuration file (invalidate it)
[Root @ localhost yum. repos. d] # vim CentOS-Media.repo edit local yum source file
C6-media
Name = CentOS-$ releasever-Media local yum source name (can be modified at will)
Baseurl = file: // mnt/sr0 disk Mount directory/mnt/sr0
Gpgcheck = 1
Enabled = 1 use this yum source (0 is not enabled)
Gpgkey = file: // mnt/sr0/RPM-GPG-KEY-CentOS-6 local yum source key
II. network yum source (the premise is that you must be connected to the internet. The yum source used here is the address of the University of Science and Technology of China:
University of Science and Technology: http://centos.ustc.edu.cn/centos)
[Root @ localhost yum. repos. d] # mv CentOS-Base.bak CentOS-Base.repo if you did not change the name before you do not need to perform this step
[Root @ localhost yum. repos. d] # vim CentOS-Base.repo edit network yum source file
[Base]
Name = CentOS-$ releasever-Base
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = OS
Baseurl = http://centos.ustc.edu.cn/centos/?releasever/ OS /?basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# Released updates
[Updates]
Name = CentOS-$ releasever-Updates
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = updates
Baseurl = http://centos.ustc.edu.cn/centos/?releasever/updates/?basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# Additional packages that may be useful
[Extras]
Name = CentOS-$ releasever-Extras
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = extras
Baseurl = http://centos.ustc.edu.cn/centos/?releasever/extras/?basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# Additional packages that extend functionality of existing packages
[Centosplus]
Name = CentOS-$ releasever-Plus
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = centosplus
Baseurl = http://centos.ustc.edu.cn/centos/?releasever/centosplus/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# Contrib-packages by Centos Users
[Contrib]
Name = CentOS-$ releasever-Contrib
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = contrib
Baseurl = http://centos.ustc.edu.cn/centos/?releasever/contrib/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
III. notes:
It is recommended that only one yum source be valid when yum is used, because the network yum source is used by default.