标签: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
原文地址:http://ridingonhorse.blog.51cto.com/11265295/1872815