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