linux的yum使用阿里源

阿里云Linux安装软件镜像源

阿里云是最近新出的一个镜像源。得益与阿里云的高速发展,这么大的需求,肯定会推出自己的镜像源。
阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/

CentOS系统更换软件安装源
第一步:备份你的原镜像文件,以免出错后可以恢复。

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
第二步:下载新的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
第三步:运行yum makecache生成缓存

yum clean all

yum makecache

------------------------------------------------------------------------------------

以上很有可能会有网络问题,即unresolve,需要更改网络dns

方法1:

 vim /etc/resolv.conf添加dns:

nameserver 8.8.8.8

方法2:(如果方法1无效,请采用方法2:)

2. 修改dns

[root@iz25m0z7ik3z ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

文末添加

DNS1=8.8.8.8
       DNS2=8.8.4.4


3. 重启network 服务

[root@iz25m0z7ik3z ~]# service network restart

[plain]  view plain  copy
  1. Shutting down interface eth0:  Device state: 3 (disconnected)  
  2.                                                            [  OK  ]  
  3. Shutting down interface eth1:                              [  OK  ]  
  4. Shutting down loopback interface:                          [  OK  ]  
  5. FATAL: Module off not found.  
  6. Bringing up loopback interface:                            [  OK  ]  
  7. Bringing up interface eth0:  Active connection state: activated  
  8. Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/2  
  9.                                                            [  OK  ]  
  10. Bringing up interface eth1:  RTNETLINK answers: File exists  
  11. RTNETLINK answers: File exists  
  12.                                                            [  OK  ]  
  13. FATAL: Module off not found.  

4. 如下提示表示network  服务 与 NetworkManager服务冲突

[plain]  view plain  copy
  1. Bringing up interface eth0:  Active connection state: activated  
  2. Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/2  
  3.                                                            [  OK  ]  

应该是之前安装了图形界面“X Window System”导致。

5. 停止NetworkManager

[root@iz25m0z7ik3z ~]#  service NetworkManager stop

[plain]  view plain  copy
  1. Stopping NetworkManager daemon:                            [  OK  ]  

6. 再次重启 network 服务

[root@iz25m0z7ik3z ~]#  service network restart

[plain]  view plain  copy
  1. Shutting down interface eth0:                              [  OK  ]  
  2. Shutting down interface eth1:                              [  OK  ]  
  3. Shutting down loopback interface:                          [  OK  ]  
  4. FATAL: Module off not found.  
  5. Bringing up loopback interface:                            [  OK  ]  
  6. Bringing up interface eth0:  Determining if ip address 10.44.153.37 is already in use for device eth0...  
  7.                                                            [  OK  ]  
  8. Bringing up interface eth1:  Determining if ip address 101.200.188.182 is already in use for device eth1...  
  9. RTNETLINK answers: File exists  
  10.                                                            [  OK  ]  
  11. FATAL: Module off not found.  

7. 该警告一般是由于网卡解析arp协议导致的,可在网卡的配置文件中加入ARPCHECK=NO参数来屏蔽该检查

[root@iz25m0z7ik3z ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

文末添加

ARPCHECK=no

再次启动网卡

[plain]  view plain  copy
  1. Shutting down interface eth0:                              [  OK  ]  
  2. Shutting down interface eth1:                              [  OK  ]  
  3. Shutting down loopback interface:                          [  OK  ]  
  4. FATAL: Module off not found.  
  5. Bringing up loopback interface:                            [  OK  ]  
  6. Bringing up interface eth0:                                [  OK  ]  
  7. Bringing up interface eth1:  RTNETLINK answers: File exists  
  8.                                                            [  OK  ]  
  9. FATAL: Module off not found.  

至此yum update 一切正常。


  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值