1. Copy all centos Yum files, but actually only use base files.
[Root @ server yum. Repos. d] # ls
CentOS-Base.repo CentOS-Debuginfo.repo. B CentOS-Media.repo. B server. Repo. B
2. Check the file and learn the following points:
Enabled = 0 do not enable this yum;
[Root @ server yum. Repos. d] # Cat CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and
# Update Status of each mirror to pick mirrors that are updated to and
# Geographically close to the client. You shoshould use this for centos updates
# Unless you are manually picking other mirrors.
#
# If the specified list = does not work for you, as a fall back you can try
# Remarked out baseurl = line instead.
#
#
[Base]
Name = centos-$ releasever-Base
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = OS
# Baseurl = http://developer.centos.org/centos/?releasever/ OS /?basearch/
# Baseurl = http://mirror.centos.org/centos/6/ OS /x86_64/
Base url = http://mirrors.sohu.com/centos/6/ OS /x86_64/
Gpgcheck = 1
# Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-6
# Gpgkey = http://mirror.centos.org/centos/6/ OS /x86_64/RPM-GPG-KEY-CentOS-6
Gpgkey = http://mirrors.sohu.com/centos/6/ OS /x86_64/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://developer.centos.org/centos/?releasever/updates/?basearch/
# Baseurl = http://mirror.centos.org/centos/6/updates/x86_64/
Base url = http://mirrors.sohu.com/centos/6/updates/x86_64/
Http://mirrors.163.com/centos/6/updates/x86_64/
Gpgcheck = 1
# Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-6
# Gpgkey = http://mirror.centos.org/centos/6/ OS /x86_64/RPM-GPG-KEY-CentOS-6
Gpgkey = http://mirrors.sohu.com/centos/6/ OS /x86_64/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://developer.centos.org/centos/?releasever/extras/?basearch/
# Baseurl = http://mirror.centos.org/centos/6/extras/x86_64/
Base url = http://mirrors.sohu.com/centos/6/extras/x86_64/
Gpgcheck = 1
# Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-6
# Gpgkey = http://mirror.centos.org/centos/6/ OS /x86_64/RPM-GPG-KEY-CentOS-6
Gpgkey = http://mirrors.sohu.com/centos/6/ OS /x86_64/RPM-GPG-KEY-CentOS-6
######################################## ######################################## ######
# Additional packages that extend functionality of existing packages
[Centosplus]
Name = centos-$ releasever-plus
Using list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = centosplus
# Baseurl = http://developer.centos.org/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
Using list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = contrib
# Baseurl = http://developer.centos.org/centos/?releasever/contrib/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = file: // etc/pki/rpm-GPG/RPM-GPG-KEY-CentOS-6
[Root @ server yum. Repos. d] #