您的位置:首页 > 运维架构 > Linux

CentOS使用yum安装软件时出现Could not retrieve mirrorlist

2016-05-22 13:23 786 查看
本人在安装CentOS操作系统后,通过yum下载一些软件时,报以下错误:

“Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=i386&repo=addons error ”错误:[root@server mysql-5.0.56]# yum install gcc

    Loaded plugins: fastestmirror

    Loading mirror speeds from cached hostfile

    Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=i386&repo=addons error was

    [Errno 4] IOError:

    Error: Cannot find a valid baseurl for repo: addons

解决方法:

(1)使用root登陆后

(2)输入:vi  /etc/systemconfig/network-scripts/ifcfg-eth0 

(3)在此文件中加入DNS1=8.8.8.8

(4)然后保存

(5)service  network restart
(重启网络服务);  注意:我当时没重启,没成功。

 (6) yum install gcc      //正常下载
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息