#!/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 $
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
This article is from the "Technology Change Destiny" blog, please be sure to keep this source http://lvnian.blog.51cto.com/7155281/1697324
Virtual machine Simple One-click Initial optimization