Centos6 5安裝GCC遇到的問題及解決

2021-07-28 10:36:42 字數 2668 閱讀 6106

以前安裝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 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

could not retrieve mirrorlist 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

could not retrieve mirrorlist 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指令,就可以安裝成功了!

Centos6 5編譯安裝GCC4 9

解壓後 先確定系統是否安裝gcc 編譯gcc先需要系統中有乙個版本的gcc 可以使用yum install gcc安裝,預設安裝的是4.4版本。編譯gcc 需要 mpfr gmp mpc 聯網的環境下執行 contrib download prerequisites當然是在終端切換到root使用者下...

CentOS 6 5 原始碼安裝gcc 5 2 0

centos 6.5中直接在終端安裝的gcc和g 的版本有些年代了,想嘗鮮的需要原始碼安裝。1.安裝編譯器 原始碼安裝gcc 5.2.0需要編譯器來編譯原始碼 先有雞還是先有蛋 於是乎如果系統沒有安裝c c 編譯器的首先還是需要安裝編譯器。yum install gccgcc c 安裝gcc和g w...

centos6 5 原始碼安裝gcc 4 8 5

2 tar xvf gcc 4.8.5.tar.bz2 解壓到為gcc 4.8.5 3 cd gcc 4.8.5 進入檔案目錄 該步操作需要注意,是在gcc 4.8.5目錄下執行的,執行的結果是在gcc 4.8.5目錄下建立mpfr gmp mpc三個軟連線。5 cd 返回到上層目錄 6 mkdir...