#更新yum 源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

yum install tree -y


grep keepcache /etc/yum.conf 

sed -i 's/keepcache=0/keepcache=1/g' /etc/yum.conf 

grep keepcache /etc/yum.conf 


#关闭selinux:

setenforce 0         #临时生效

sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config  #永久生效

setenforce 0    

sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config  


#关闭防火墙

/etc/init.d/iptables stop

chkconfig iptables off

chkconfig --list iptables


#时间同步

/usr/sbin/ntpdate pool.ntp.org

echo '#time sync by gao at 2010-2-1'>>/var/spool/cron/root

echo '*/10 * * * * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1'>>/var/spool/cron/root

crontab -l


#修改主机名

hostname MASTER

cp /etc/hosts /etc/hosts.bak

cp /etc/sysconfig/network /etc/sysconfig/network.bak

sed -i ' 10.0.0.3 MASTER' /etc/hosts 

sed -i ' 10.0.0.4 Slave' /etc/hosts 

sed -i -e '/HOSTNAME=/d' -e '1aHOSTNAME=MASTER' /etc/sysconfig/network

logout