1. 程式人生 > >在liunx環境下在線安裝GCC

在liunx環境下在線安裝GCC

找不到 libs try 配置 repos .rpm bsp arch body

首先執行的安裝指令是:

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

[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

然後保存退出即可。

在liunx環境下在線安裝GCC