#!/bin/sh
##http://mirrors.aliyun.com/
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 lvnian at 2015-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
hostname $1
cp /etc/hosts /etc/hosts.bak
cp /etc/sysconfig/network /etc/sysconfig/network.bak
sed -i -e ‘/HOSTNAME=/d‘ -e "1aHOSTNAME=$1" /etc/sysconfig/network