MySQL编译安装
#安装编译代码需要的包
yum -y install make gcc-c++ cmake bison-devel  ncurses-devel
#mysql安装

wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.32.tar.gz
tar -zxvf mysql-5.6.32.tar.gz
cd mysql-5.6.32
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
make && make install 
groupadd mysql
useradd -s /sbin/nologin -g mysql mysql
chown -R mysql:mysql /usr/local/mysql
#初始化配置
cd /usr/local/mysql
scripts/mysql_install_db  --datadir=/usr/local/mysql/data --user=mysql
mv /etc/my.cnf /etc/my.cnf.bak
cp /usr/local/mysql/support-files/my-default.cnf/etc/my.cnf 
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile
source /etc/profile
#启动mysql
cp support-files/mysql.server /etc/init.d/mysqld
chkconfig mysqld on
service mysqldd start


配置释义:
-DCMAKE_INSTALL_PREFIX=/usr/local/server/mysql-5.6.12 设置安装目录    
-DMYSQL_DATADIR=/data/mysql 设置数据库存放目录    
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock 设置UNIX socket 目录    
-DMYSQL_USER=mysql 设置运行用户    
-DDEFAULT_CHARSET=utf8 设置默认字符集,默认latin1    
-DEFAULT_COLLATION=utf8_general_ci 设置默认校对规则,默认latin1_general_ci    
-DWITH_INNOBASE_STORAGE_ENGINE=1 添加InnoDB引擎支持    
-DENABLE_DOWNLOADS=1 自动下载可选文件,比如自动下载谷歌的测试包    
-DMYSQL_TCP_PORT=3306 设置服务器监听端口,默认3306    
-DSYSCONFDIR=/data/etc 设置my.cnf所在目录,默认为安装目录  
更多参数执行 # cmake . -LH 
Apache编译安装
tar zxvf httpd-2.2.8.tar.gz
cd httpd-2.2.8
./configure --prefix=/usr/local/apache2 --enable-modules=most --enable-so
cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
PHP编译安装
wget http://cn2.php.net/get/php-5.6.16.tar.gz/from/this/mirror
tar zxvf php-5.6.16.tar.gz
cd php-5.6.16
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-curl --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif  --disable-ipv6
make
make install


Apache结合PHP

vim /usr/local/apache2/conf/httpd.conf找到:
AddType application/x-gzip .gz .tgz
在该行下面添加:
AddType application/x-httpd-php .php
找到:

    DirectoryIndex index.html
< /IfModule>
将该行改为:

    DirectoryIndex index.html index.htm index.php
< /IfModule>
找到:
#ServerName www.example.com:80
修改为:
ServerName localhost:80

测试解析php
vim /usr/local/apache2/htdocs/1.php
写入:
< ?php
    echo "php解析正常";
?>
保存后,继续测试:
curl localhost/1.php

http://www.xtblinux.com/thread-27-1-2.html