#!/bin/bash
Yum-y Install gcc-c++ library ncurses-devel libxml2-devel libtomcrypt-devel libtool libtool-ltdl-devel bzip2-devel
CD/TMP&&TAR-ZXF HTTPD-2.2.11.TAR.GZ&&CD httpd-2.2.11&&./configure--prefix=/usr/local/ APACHE-WITH-INCLUDED-APR--with-pcre--enable-mods-shared=moost
Make &&make Install
If [$?-eq 0];then
echo "/usr/local/apache/bin/apachectl restart" >>/etc/rc.d/rc.local
/usr/local/apache/bin/apachectl restart
Else
echo "Apache compile instal error"
Exit 1
Fi
Useradd-m-s/sbin/nologin MySQL
CD/TMP/&&TAR-ZXF mysql-5.1.55.tar.gz&&cd mysql-5.1.55&&./configure--prefix=/usr/local/ MySQL--with-charset-utf8--with-extra-charsets=gbk,gb2312
Make &&make Install
If [$?-eq 0];then
Yes|cp-r support-files/my-medium.cnf/etc/my.cnf
Yes|cp-f Support-files/mysql.server/etc/init.d/mysqld
Chkconfig--add mysqld
chmod 755/etc/init.d/mysqld
Ln-s/usr/local/mysql/bin/*/bin
Else
echo "MySQL Compile install error"
Exit 1
Fi
if [-e/usr/local/mysql/bin/mysql_install_db];then
/usr/local/mysql/bin/mysql_install_db--user=mysql
Else
echo "Chu Shi Hua shi bai"
Exit
Fi
Chown-r root:mysql/usr/local/mysql/
Chown-r mysql/usr/local/mysql/var/
echo "/etc/init.d/mysqld restart" >>/etc/rc.d/rc.local
/etc/init.d/mysqld restart
echo "Install PHP please waiting"
CD/TMP/&&TAR-ZXF PHP-5.3.6.TAR.GZ&&CD php-5.3.6&&./configure--prefix=/usr/local/php-- With-apxs2=/usr/local/apache/bin/apxs--with-mysql=/usr/local/mysql/--with-libxml-dir--with-png-dir-- With-freetype-dir--with-iconv-dir--with-zlib-dir--with-bz2--enable-soap--enable-mbstring--enable-sockets-- Enable-exif--disable-ipv6
Make&&make Install
If [$?-eq 0];then
echo "PHP compile OK"
Yes|cp-f/tmp/httpd.conf/usr/local/apache/conf/
/usr/local/apache/bin/apachectl restart
Else
echo "PHP compile Error"
Exit 1
Fi
#yes |cp-f/tmp/httpd.conf/usr/local/apache/conf/
#/usr/local/apache/bin/apachectl restart
# #AddType application/x-httpd-php. php. phtml add support for ". PHP" type Web page
# #DirectoryIndex index.php index.html identify common PHP home files
#<?php
#phpinfo ();
#?>
#curl 192.168.9.122/index.php
#iptables-X-F
CentOS 6.7 Lamp