CentOS 5.2
MySQL 5.1.30
Apache 2.2.11
Php 5.2.8
Ngnix 0.6.34

[MySQL]
./configure \
–prefix=/usr/local/mysql \
–localstatedir=/var/lib/mysql \
–with-mysqld-user=mysql \
–enable-assembler \
–with-mysqld-ldflags=-all-static \
#–with-client-ldflags=-all-static \
–with-pthread \
–with-named-thread-libs=-lpthread \
–with-zlib-dir=/usr \
–with-charset=utf8 \
–with-extra-charsets=ascii,binary,gb2312,gbk,big5,utf8,latin1 \
–with-plugins=heap,innobase,myisam,myisammrg \
–with-big-tables \
–without-man \
–with-named-curses-libs=/usr/lib/libncursesw.so.5 \

配置
//增加mysql用户
useradd mysql
scripts/mysql_install_db –user=mysql
//设置权限
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /var/lib/mysql
chmod -R 750 /usr/local/mysql
chmod -R 750 /var/lib/mysql
//设置配置文件和启动文件
cp support-files/my-small.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
//(慎用)UNIX下执行文件的减肥工具strip
cd /usr/local/mysql/libexec
cp mysqld mysqld.old
strip mysqld
//配置服务
chkconfig –add mysqld
chkconfig –level 345 mysqld on
//启动服务
service mysqld start

[Apache]
./configure \
–prefix=/usr/local/httpd \
–disable-authn-file \
–disable-authn-default \
–disable-authz-host \
–disable-authz-groupfile \
–disable-authz-user \
–disable-authz-default \
–disable-auth-basic \
–disable-include \
–disable-filter \
–disable-charset-lite \
–disable-env \
–disable-setenvif \
–disable-status \
–disable-autoindex \
–disable-asis \
–disable-cgid \
–disable-cgi \
–disable-negotiation \
–disable-actions \
–disable-userdir \
–enable-rewrite \
–enable-deflate \
–with-mpm=worker \
#–enable-so \

配置
//设置配置文件和启动文件
ln -s /usr/local/httpd/bin/apachectl /etc/init.d/httpd
//配置服务
chkconfig –add httpd
chkconfig –level 345 httpd on

[PHP]
gunzip suhosin-patch-5.2.8-0.9.6.3.patch.gz
cd php-5.2.8
patch -p 1 -i ../suhosin-patch-5.2.8-0.9.6.3.patch
rm -fr configure
./buildconf –force
./configure \
–prefix=/usr/local/php \
–with-apxs2=/usr/local/httpd/bin/apxs \
–disable-rpath \
–disable-cli \
–disable-cgi \
–disable-path-info-check \
–disable-short-tags \
–disable-ipv6 \
–disable-all \
–with-pcre-dir \
–with-mysql=/usr/local/mysql \
–with-mysqli=/usr/local/mysql/bin/mysql_config \
–without-pear \
–with-freetype-dir \
–with-png-dir \
–with-jpeg-dir \
–with-xpm-dir \
–with-gd \
–enable-gd-native-ttf \
–with-zlib \
–enable-session \
–enable-spl \
–enable-apc \
–enable-suhosin \
–enable-mbstring \
–enable-xml \
–enable-libxml \
–with-libxml-dir \
–with-libexpat-dir \
–enable-pdo \
–with-pdo-mysql=/usr/local/mysql \
–with-iconv \

#chcon -t texrel_shlib_t /usr/local/httpd/modules/libphp5.so

[Nginx]
./configure \
–prefix=/usr/local/nginx \
–user=www \
–group=www \
–with-http_realip_module \
–without-http_charset_module \
–without-http_gzip_module \
–without-http_ssi_module \
–without-http_userid_module \
–without-http_auth_basic_module \
–without-http_autoindex_module \
–without-http_geo_module \
–without-http_map_module \
–without-http_fastcgi_module \
–without-http_memcached_module \
–without-http_limit_zone_module \
–without-http_empty_gif_module \
–without-http_upstream_ip_hash_module \
–with-zlib=/usr \
–with-pcre=../pcre-7.8 \
–enable-spl \