Installed _yum&ip

Source: Internet
Author: User
Tags aliyun

Suitable for CENTOS7

[Email protected]_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

Nm_controlled=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


This article is from the "Linux" blog, so be sure to keep this source http://ridingonhorse.blog.51cto.com/11265295/1872812

Installed _yum&ip

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.