【服务器篇之linux-yum安装镜像源无效解决】

问题:使用yum安装某些软件报如下错误

[root@localhost git-2.9.5]# yum  install autoconf 
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
No package autoconf available.
Error: Nothing to do

解决:

1.先查看网卡配置里的DNS1是否配置正确

[root@localhost ~]# cd /etc/sysconfig/network-scripts
[root@localhost network-scripts]# ls
ifcfg-eth0   ifdown-ippp  ifdown-routes  ifup-bnep  ifup-plip    ifup-sit          network-functions
ifcfg-lo     ifdown-ipv6  ifdown-sit     ifup-eth   ifup-plusb   ifup-tunnel       network-functions-ipv6
ifdown       ifdown-isdn  ifdown-tunnel  ifup-ippp  ifup-post    ifup-wireless
ifdown-bnep  ifdown-post  ifup           ifup-ipv6  ifup-ppp     init.ipv6-global
ifdown-eth   ifdown-ppp   ifup-aliases   ifup-isdn  ifup-routes  net.hotplug
[root@localhost network-scripts]# cat ifcfg-eth0
iDEVICE="eth0"
BOOTPROTO="static"
IPV6INIT="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="00074650-ea89-4b5f-a029-2a290a911ded"
IPADDR=192.168.247.10
NETMASK=255.255.255.0
GATEWAY=192.168.247.2
DNS1=202.96.128.86

并且用ping 地址 或者 curl 地址检测 能否正常上网

[root@localhost network-scripts]# ping www.baidu.com
PING www.a.shifen.com (14.215.177.39) 56(84) bytes of data.
64 bytes from 14.215.177.39: icmp_seq=1 ttl=128 time=5.51 ms
64 bytes from 14.215.177.39: icmp_seq=2 ttl=128 time=5.02 ms
64 bytes from 14.215.177.39: icmp_seq=3 ttl=128 time=4.95 ms
64 bytes from 14.215.177.39: icmp_seq=4 ttl=128 time=5.19 ms

这样就排除了 DNS1设置错误

 

2. 那就可能是镜像源失效了,需要重新设置镜像源,现在国内阿里云的镜像比较全,就以它为例

​1、备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup


2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo 

CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 

CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 


3、运行yum makecache生成缓存​

 

你可能感兴趣的:(物联网)