首先执行的安装指令是:
yum -y install gcc
yum -y install gcc-c++
yum -y install gcc gcc-c++ kernel-devel。
然后报错内容:
Error Downloading Packages:
mpfr-2.4.1-6.el6.x86_64: failure: Packages/mpfr-2.4.1-6.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
libgomp-4.4.7-17.el6.x86_64: failure: Packages/libgomp-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
gcc-c++-4.4.7-17.el6.x86_64: failure: Packages/gcc-c++-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
libgcc-4.4.7-17.el6.x86_64: failure: Packages/libgcc-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
cpp-4.4.7-17.el6.x86_64: failure: Packages/cpp-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
libstdc++-4.4.7-17.el6.x86_64: failure: Packages/libstdc++-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
gcc-4.4.7-17.el6.x86_64: failure: Packages/gcc-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
cloog-ppl-0.15.7-1.2.el6.x86_64: failure: Packages/cloog-ppl-0.15.7-1.2.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
ppl-0.10.2-11.el6.x86_64: failure: Packages/ppl-0.10.2-11.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
libstdc++-devel-4.4.7-17.el6.x86_64: failure: Packages/libstdc++-devel-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
看报错的大意就是说,镜像找不到,即源没有找到;然后我就到网上搜了下,看可以用下面方法解决:
[Errno 256] No more mirrors to try. 得知这可能是错误的缓存源导致,直接两个命令解决:
yum clean all
yum makecache
但是我这里执行到 yum makecache 这个指令的时候还是又报错如下:
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrorlist.centos.org‘"
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
[[email protected] softback]# yum -y install gcc gcc-c++ kernel-devel
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrorlist.centos.org‘"
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
[[email protected] softback]# yum install gcc-c++ libstdc++-devel
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrorlist.centos.org‘"
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
国内服务器在运行命令yum -y install wget的时候会出现这种问题,
这种错误,是因为没有配置/etc/resolv.conf。
解决方法:编辑resolv.conf文件,添加:nameserver 8.8.8.8
然后保存退出即可。