CentOS6 for yum source method summary
The yum source in this article supports CentOS 6 series and RHEL6 series in theory.
The update method is as follows:
First, go to the yum source configuration directory.
Cd/etc/yum. repos. d
Yum source of the Backup System
Mv CentOS-Base.repo CentOS-Base.repo.save
Download other faster yum sources
Yum source of HKUST:
Wget http://centos.ustc.edu.cn/CentOS-Base.repo
163 yum Source:
Wget http://mirrors.163.com/.help/CentOS-Base-163.repo
Sohu yum Source
Wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
After updating the yum source, we recommend that you update it so that the operation takes effect immediately.
Yum makecache
[Yasi]:
An error occurs when the last step, yum makecache, is executed:
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* Addons: mirrors.163.com
* Base: pai.metrocast.net
* Extras: pai.beyondhosting.net
* Fasttrack: centos.vipernetworksystems.com
* Updates: centos.vipernetworksystems.com
Http://mirrors.163.com/centos/6/addons/x86_64/repodata/repomd.xml: [Errno 14] pycurl error 22-"The requested URL returned error: 404"
Trying other mirror.
Http://developer.centos.org/centos/6/addons/x86_64/repodata/repomd.xml: [Errno 14] pycurl error 22-"The requested URL returned error: 404"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd. xml) for repository: addons. Please verify its path and try again
The reason is that http://mirrors.163.com/centos/6/addons/x86_64/repodata/repomd.xmland the http://mirror.centos.org/centos/6/addons/x86_64/repodata/repomd.xml does not exist and may be updated. The solution is to find available URLs or comment out the items in the corresponding. repo file. Here I use the latter.
For example, in the CentOS-Base-163.repo, comment out the entire addon item
# [Addons]
# Name = CentOS-$ releasever-Addons-163.com
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = addons
# Baseurl = http://mirrors.163.com/centos/?releasever/addons/?basearch/
# Gpgcheck = 1
# Pgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Comment out the following content in CentOS-Base-sohu.repo
# [Addons]
# Name = CentOS-$ releasever-Addons-sohu.com
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = addons
# Baseurl = http://mirrors.sohu.com/centos/?releasever/addons/?basearch/
# Gpgcheck = 1
# Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5CentOS-Base-sohu.repo
Then run yum makecache. Then, yum can find the package I want to install, such as gdb, subversion, and gcc-c ++.
Note:
Sometimes a package cannot be found using yum list xxx. You can try yum search xxx.
For example, yum list vim reports Error: No matching Packages to list. Yum search vim returns:
The vim-X11.x86_64: the VIM version of the vi editor for The X Window System
The vim-common.x86_64: the common files needed by any version of The VIM editor
Vim-enhanced.x86_64: A version of the VIM editor which has des recent enhancements
Vim-minimal.x86_64: A minimal version of the VIM editor
[Yasi]: an error occurs when the last step is yum makecache:
Loaded plugins: specified base is listed more than once in the specified updates is listed more than once in the configurationRepository extras is listed more than once in the configurationRepository centosplus is listed more than once in the specified contrib is listed more than once in the configurationLoading mirror speeds from cached hostfile * addons: mirrors.163.com * base: pai.metrocast.net * extras: pai.beyondhosting.net * fasttrack: centos.vipernetworksystems.com * updates: centos. vipernetworksystems. comhttp: // mirrors.163.com/centos/6/addons/x86_64/repodata/repomd.xml: [Errno 14] pycurl error 22-"The requested URL returned error: 404" Trying other mirror. http://developer.centos.org/centos/6/addons/x86_64/repodata/repomd.xml: [Errno 14] pycurl error 22-"The requested URL returned error: 404" Trying other mirror. error: Cannot retrieve repository metadata (repomd. xml) for repository: addons. please verify its path and try again
The reason is that. The solution is to find available URLs or comment out the items in the corresponding. repo file. Here I use the latter.
[Root @ wwn104 yum. repos. d] # vi CentOS-Media.repo
Change enabled = 1 to enabled = 0
Then modify: all the sources you use. For example, if sohu is used, modify sohu's:
[Root @ wwn104 yum. repos. d] # vi CentOS-Base-sohu.repo
Add the following content under [addons:
Enabled = 0
Then run yum makecache. Then, yum can find the package I want to install, such as gdb, subversion, and gcc-c ++.
Note: Sometimes a package cannot be found using yum list xxx. You can try yum search xxx. For example, yum list vim reports Error: No matching Packages to list. Yum search vim returns:
Vim-X11.x86_64: The VIM version of the vi editor for the X Window Systemvim-common.x86_64: The common files needed by any version of the VIM editorvim-enhanced.x86_64: A version of the VIM editor which des recent enhancementsvim-minimal.x86_64: A minimal version of the VIM editor