Centos6.5安装GCC遇到的问题及解决

前端之家收集整理的这篇文章主要介绍了Centos6.5安装GCC遇到的问题及解决前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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

我执行的安装指令是: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

[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指令,就可以安装成功了!

原文链接:https://www.f2er.com/centos/378408.html

猜你在找的CentOS相关文章