码迷,mamicode.com
首页 > 其他好文 > 详细

yum& ip centos6

时间:2016-11-15 01:33:25      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:yum ip

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

标签:yum ip

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!