linux gcc try,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

[[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

然后保存退出即可。

然后在执行 yum makecache 指令,等该指令结束后再执行安装gcc指令,就可以安装成功了!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值