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

装机_yum&ip

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

标签:装机 yum ip

适用于centos7

[root@node7_1 ~]# cat yum_ip.sh 

#!/bin/bash

# is used to centos 7


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

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

TYPE=Ethernet

BOOTPROTO=none

NetworkManager=no

DEFROUTE=yes

PEERDNS=yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

IPV6_AUTOCONF=no

IPV6_DEFROUTE=no

IPV6_PEERDNS=no

IPV6_PEERROUTES=no

IPV6_FAILURE_FATAL=no

NAME=eno16777728

UUID=76f9cf7b-5390-44da-af35-16fdf334f81f

DEVICE=eno16777728

ONBOOT=yes

IPADDR=192.168.1.200

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/7/os/x86_64/

gpgcheck=0

enabled=1

[epel]

name=epel

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

gpgcheck=0

enabled=1

eof


/etc/init.d/network restart


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

装机_yum&ip

标签:装机 yum ip

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

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