CENTOS 6.6 SHELL Initialization Script

Source: Internet
Author: User

CENTOS 6.6 SHELL Initialization Script

This script may be required after CENTOS6.6 is installed. When learning about CENTOS, you can run this script to perform some configuration, which helps you not to be troubled by the yum selinux ip addresses of these firewalls.

#!/bin/bash # Determine if it is a root user if [[ "$(whoami)" != "root" ]]; then echo "pleaserunthisscriptasroot." >&2 exit 1 fi echo -e "\ 033 [31m this is the system initialization script. Please run it with caution! Are you sure you want to annotate the specified row \ 033 [0 m" # Comment out the next line exit 1; # Disable SELINUX selinux(){ sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux setenforce0 } # Setting Dynamic IP addresses ip(){ sed -i 's/ONBOOT=no/ONBOOT=yes/' /etc/sysconfig/network-scripts/ifcfg-eth0 servicenetworkrestart> /dev/null } # Set Time and time zone Synchronization 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/ntpdatepool.ntp.org>/dev/null2>&1' > /var/spool/cron/root ; chmod 600 /var/spool/cron/root /sbin/service crondrestart } # Configure yum Source yum_update(){ yum-y install wget cd /etc/yum .repos.d/ mkdir bak mv ./*.repobak wget-O /etc/yum .repos.d /CentOS-Base .repohttp: //mirrors .aliyun.com /repo/Centos-6 .repo wget-O /etc/yum .repos.d /epel .repohttp: //mirrors .aliyun.com /repo/epel-6 .repo } # Clear iptables rules and disable them iptables(){ iptables-F iptables-PINPUTACCEPT iptables-POUTPUTACCEPT serviceiptablessave } other(){ # Here you can customize the something you want to do } main(){ ip yum_update selinux zone_time iptables other } main

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.