In the CentOS VM provided by the company,/ETC/YUM.REPOS.D has only one Build.repo, which provides only a few sources within the company, and many packages are not found in these sources. So to add another source, the following post describes how to add USTC, Sohu, and 163 yum sources in CentOS: http://www.husw.net/blog/post/1386/. Excerpts are as follows:
This article introduces the Yum source support version is the CentOS 6 series, theoretically supports the RHEL6 series.
The Update method is as follows:
Enter the Yum source configuration directory First
Cd/etc/yum.repos.d
Yum source with the backup system
MV Centos-base.repo Centos-base.repo.save
Download other faster Yum sources
Yum Source for USTC:
wget Http://centos.ustc.edu.cn/CentOS-Base.repo
163 Yum Source:
wget Http://mirrors.163.com/.help/CentOS-Base-163.repo
Yum Source of Sohu
wget Http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
After the Yum source has been updated, it is recommended that the operation be immediately effective
Yum Makecache
[Yasi]: An error was encountered while performing the last step, that is, yum Makecache: Loaded plugins:fastestmirror Repository base are listed more than once in the Configurat Ion Repository updates is listed more than once in the configuration Repository extras are listed more than once in the con Figuration Repository Centosplus is listed more than once in the configuration Repository contrib are listed more than In the configuration Loading mirror speeds from cached hostfile * addons:mirrors.163.com * base:mirror.metr Ocast.net * extras:mirror.beyondhosting.net * fasttrack:centos.vipernetworksystems.com *: centos.vipernetworksystems.com http://mirrors.163.com/centos/6/addons/x86_64/repodata/repomd.xml: [Errno 14] Pycurl ERROR-"The requested URL returned error:404" trying other mirror. Http://mirror.centos.org/centos/6/addons/x86_64/repodata/repomd.xml: [Errno] Pycurl ERROR-"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 reason is that http://mirrors.163.com/centos/6/addons/x86_64/repodata/repomd.xml and http ://mirror.centos.org/centos/6/addons/x86_64/repodata/repomd.xml really does not exist, may be updated out. The solution is,find an available URL to replace it or comment out the entire item in the corresponding. Repo file。 Here I use the latter.
For example, in Centos-base-163.repo, comment out the entire addon item #[addons] #name =centos-$releasever-addons-163.com #mirrorlist =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 in Centos-base-sohu.repo #[addons] #name =centos-$releasever-addons-sohu.com #mirrorlist =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, execute Yum makecache. After that, Yum can find the package I want to install, such as GDB, Subversion, gcc-c++ and so on.
Note: sometimes use yum list xxx cannot find a package, you can try to use Yum search xxx。 For example, yum list vim reports error:no matching Packages to list. and Yum search vim returns: Vim-x11.x86_64:the vim version of the VI editor for the X Window System vim-common.x86_64:the Co Mmon files needed by any version of the Vim editor vim-enhanced.x86_64:a version of the Vim editor which includes Enhancements Vim-minimal.x86_64:a Minimal version of the VIM editor