Centos6版本使用yum报错 Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfi Setting up Install Process No package gcc available. Error: Nothing to do

在使用Centos6版本yum时报错

Loaded plugins: fastestmirror, refresh-packagekit, security

Loading mirror speeds from cached hostfile

Setting up Install Process

No package gcc available.

Error: Nothing to do

出现这种错误的原因可能是因为没联网,试着ping 一下百度,如果ping的通还报错,说明yum镜像没了,国内比较快的有163源、sohu源。这里以163源为例子。那么可以依次执行以下命令

cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.backup
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
mv CentOS6-Base-163.repo CentOS-Base.repo
yum clean all

解决