如何在centos6下安装gcc

1.打开终端

2.切换知root:su root

3.使用yum安装gcc:yum install gcc(安装过程中始终选择y)

4.同理 安装g++:yum -y install gcc-c++

如果安装过程中报错
比如
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.
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.
cpp-4.4.7-23.el6.x86_64: failure: Packages/cpp-4.4.7-23.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.
gcc-4.4.7-23.el6.x86_64: failure: Packages/gcc-4.4.7-23.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.

那么我猜你一定是没有联网,联网就好了