CENTOS 6.6 init Shell script

Source: Internet
Author: User


This script is what you might need to do after you've just installed CENTOS6.6. When learning CentOS, you can run this script to do some configuration to help you not be bothered by these firewall yum SELinux IP.

#!/bin/bash  #判断是不是root用户if  [[  "$ (whoami)"  !=  "root"  ]]; then      echo  "PLEASE RUN THIS SCRIPT AS ROOT ."  >&2    exit 1fi echo -e  "\033[31m  This is the system initialization script, Please run it carefully! OK use note Specify line  \033[0m "#请注释下一行exit  1; #关闭SELINUXselinux () {sed -i  ' s/selinux=enforcing/selinux= Disabled/g '  /etc/sysconfig/selinuxsetenforce 0} #设置动态ipip () {     sed -i   ' s/onboot=no/onboot=yes/'  /etc/sysconfig/network-scripts/ifcfg-eth0      service network restart > /dev/null}  #设置时间时区同步zone_time () {     rm -rf /etc/localtime    ln -s /usr/share/zoneinfo/asia/shanghai  /etc/localtime     #  Update Time     /usr/sbin/ntpdate  Pool.ntp.org    echo  ' */5 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null  2>&1 '  > /var/spool/cron/root;chmod 600 /var/spool/cron/root     /sbin/service crond restart} #配置yum源yum_update () {    yum - y install wget    cd /etc/yum.repos.d/    mkdir  Bak    mv ./*.repo bak    wget -o /etc/yum.repos.d /centos-base.repo http://mirrors.aliyun.com/repo/centos-6.repo    wget -o / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo} #  empty the Iptables rule and close the Iptables () {    iptables -f    iptables -p input accept     iptables -p output accept    service iptables  save}other () {#  can customize what you want to do here Something} main () {    ip    yum_update     selinux    zone_time    iptables     other}main


This article is from the "xxlixin" blog, make sure to keep this source http://xxlixin1993.blog.51cto.com/9498220/1744396

CENTOS 6.6 init Shell script

Related Article

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.