安装gcc镜像下载不了

之前安装gcc好像都很顺畅,可是今天不知道咋回事在一个centos系统的虚拟机上使用yum命令安装gcc的时候一直报错。c++

我执行的安装指令是:yum -y install gcc gcc-c++ kernel-develcentos

报错内容(部分):缓存


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.app

  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..net

  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.server

  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.xml

  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.blog

  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.get

  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

[root@app 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

[root@app 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 

而后保存退出便可。

而后在执行 yum makecache 指令,等该指令结束后再执行安装gcc指令,就能够安装成功了!

相关文章
相关标签/搜索