首页 > 其他 > 详细

yum& ip centos6

时间:2016-11-15 01:31:04      阅读:190      评论:0      收藏:0      [点我收藏+]

centos6适用:

[root@node1 ~]# cat yum_ip.sh 

#!/bin/bash

# is used to centos 6

mv /etc/sysconfig/network-scripts/ifcfg-eth0{,.bak}

cat >  /etc/sysconfig/network-scripts/ifcfg-eth0 << eof

DEVICE=eth0

HWADDR=00:50:56:37:EA:E6

TYPE=Ethernet

UUID=544ae0fc-e9c1-4752-b3ab-9dbdf08b69b4

ONBOOT=yes

NM_CONTROLLED=no

BOOTPROTO=none

IPADDR=192.168.1.160

NETMASK=255.255.255.0

GATEWAY=192.168.1.1

DNS=202.106.0.20

eof


cat >  /etc/resolv.conf << eof

nameserver 202.106.0.20

eof


for i in `ls  /etc/yum.repos.d/`

do

mv  /etc/yum.repos.d/$i{,.bak}

done  

cat > /etc/yum.repos.d/aliyun.repo << eof

[aliyun]

name=ali

baseurl=http://mirrors.aliyun.com/centos/6/os/x86_64/

gpgcheck=0

enabled=1

[epel]

name=epel

baseurl=http://mirrors.aliyun.com/epel/6/x86_64/

gpgcheck=0

enabled=1

eof


/etc/init.d/network restart


本文出自 “Linux” 博客,请务必保留此出处http://ridingonhorse.blog.51cto.com/11265295/1872815

yum& ip centos6

原文:http://ridingonhorse.blog.51cto.com/11265295/1872815

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!