CentOS下的LAMP环境(大纲)
一、系统安装
1. 分区
/boot 100M左右
SWAP 物理内存的2倍(如果你的物理内存大于4G以上,分配4G即可)
/ 15G
/usr/local 20G (用于安装软件)
/data 剩余所有空间
2. 系统初始化脚本(根据具体需求关闭不需要的服务)
代码:
- #vi init.sh
- -------------------cut begin-------------------------------------------
- #welcome
- cat << EOF
- +--------------------------------------------------------------+
- | === Welcome to Centos System init === |
- +--------------http://www.linuxtone.org------------------------+
- +----------------------Author:NetSeek--------------------------+
- EOF
- #disable ipv6
- cat << EOF
- +--------------------------------------------------------------+
- | === Welcome to Disable IPV6 === |
- +--------------------------------------------------------------+
- EOF
- echo "alias net-pf-10 off" >> /etc/modprobe.conf
- echo "alias ipv6 off" >> /etc/modprobe.conf
- /sbin/chkconfig --level 35 ip6tables off
- echo "ipv6 is disabled!"
- #disable selinux
- sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
- echo "selinux is disabled,you must reboot!"
- #vim
- sed -i "8 s/^/alias vi='vim'/" /root/.bashrc
- echo 'syntax on' > /root/.vimrc
- #zh_cn
- sed -i -e 's/^LANG=.*/LANG="zh_CN.GB18030"/' /etc/sysconfig/i18n
- #tunoff services
- #--------------------------------------------------------------------------------
- cat << EOF
- +--------------------------------------------------------------+
- | === Welcome to Tunoff services === |
- +--------------------------------------------------------------+
- EOF
- #---------------------------------------------------------------------------------
- for i in `ls /etc/rc3.d/S*`
- do
- CURSRV=`echo $i|cut -c 15-`
- echo $CURSRV
- case $CURSRV in
- crond | irqbalance | microcode_ctl | network | random | sendmail |
- sshd | syslog | local | mysqld )
- echo "Base services, Skip!"
- ;;
- *)
- echo "change $CURSRV to off"
- chkconfig --level 235 $CURSRV off
- service $CURSRV stop
- ;;
- esac
- done
- -------------------cut end-------------------------------------------
#sh init.sh (执行上面保存的脚本,仍后重启)
脚本就是只留这几个服务
- crond | irqbalance | microcode_ctl | network | random | sendmail | sshd |
- syslog | local | mysqld
【编辑推荐】