Software Preparation:
Mysql-5.0.56.tar.gz
http://dev.mysql.com/get/Downloads/
Httpd-2.2.12.tar.gz
http://labs.xiaonei.com/apache-mirror/httpd/
Php-5.3.0.tar.gz
Http://cn.php.net/get/php-5.3.0.tar.gz/from/this/mirror
First, install MySQL
Copy Code code as follows:
Groupadd MySQL #添加一个MYSQL组
useradd-g MySQL MySQL #添加一个用户到MYSQL组中
Tar zxvf mysql-5.0.56.tar.gz
CD mysql-5.0.56
Cat README | Less #查看使用文档
Cat Install-source | Less #查看安装说明
./configure--help #查看配置帮助
./configure--PREFIX=/USR/LOCAL/MYSQL5--enable-thread-safe-client--with-charset=utf8
#set: Set installation directory, client support thread, set font to UTF8
If #--enable-thread-safe-client does not open, you will encounter problems compiling PHP
Make #编译
Make install #安装
CP support-files/my-medium.cnf/etc/my.cnf #拷贝默认配置文件
scripts/mysql_install_db--user=mysql #初始化: The mysql_install_db file must be uncompressed in the compiled directory.
Cd/usr/local/mysql #进入安装目录
Chown-r Root. #给mysql5目录赋予root权限.
Chown-r mysql var #给var目录赋予mysql权限
Chgrp-r MySQL. #给mysql5目录赋予mysql组权限
Bin/mysqld_safe--user=mysql & #启动MYSQL服务.
Bin/mysql #进入MYSQL操作
Mysql> Grant all on *.* to root@ ' 192.168.% ' identified by ' password '; #设置root可管理的网段及密码
mysql> flush Privileges; #刷新生效.
PS: You can modify the my.cnf file to optimize MySQL
Second, the installation of Apache
Copy Code code as follows:
Tar zxvf httpd-2.2.12.tar.gz
CD httpd-2.2.12
VI server/mpm/worker/worker.c #修改源文件连接数
#define DEFAULT_SERVER_LIMIT #默认子进程数
#define MAX_SERVER_LIMIT 20000 #最大子进程数
#define DEFAULT_THREAD_LIMIT #默认链接线程数
#define MAX_THREAD_LIMIT 20000 #最大链接线程数
### #以上配置可根据自己的服务器配置修改默认值的大小.
Cat README | Less #查看使用文档
Cat INSTALL | Less #查看安装说明
./configure--help #查看配置帮助
./configure \
--PREFIX=/USR/LOCAL/APACHE2 \
--enable-module= ' most ' #装一些默认常用的
--enable-mods-shared= "All" #全部共享.
--enable-file-cache #文件缓存.
--enable-cache #缓存
--enable-disk-cache #硬盘缓存
--enable-mem-cache #内存缓存
--enable-headers #http头控制模块
--enable-expires #过期头控制模块
--enable-proxy #apache代理模块
--enable-proxy-balancer #apache代理均衡模块
--enable-ssl #HTTPS
--enable-rewrite #rewrite
--enable-so #兼容性
--with-mpm=worker
Make #编译
Make install #安装
Third, the installation of PHP extension Lib library
Copy Code code as follows:
Gd-2.0.35.tar.gz
Jpegsrc.v7.tar.gz
Libpng-1.4.0beta73.tar.gz
Libxml2-sources-2.7.3.tar.gz
Libxslt-1.1.24.tar.gz
Zlib-1.2.3.tar.gz #直接./configure && make && make install the default Lib directory installation is in/USR/L Ocal/lib under.
Four, install PHP
Copy Code code as follows:
Tar zxvf php-5.3.0.tar.gz
CD php-5.3.0
Cat README | Less #查看使用文档
Cat INSTALL | Less #查看安装说明
./configure--help #查看配置帮助
./configure \
--PREFIX=/USR/LOCAL/PHP5 \
--WITH-APXS2=/USR/LOCAL/APACHE2/BIN/APXS \ #你的APACHE安装路径apxs是一个apache安装配置时生成的一个小小的perl脚本. It enables such modules as resin to get all of Apache's configuration paths.
--WITH-MYSQL=/USR/LOCAL/MYSQL5 \ #MYSQL安装路径
--ENABLE-FTP \ #开启FTP模块
--enable-debug \ #开启DEBUG
--enable-mbstring \ #打开mbstring
--enable-mbregex \ #正则
--with-gd=/usr/local \ #gd库
--with-png-dir=/usr/local/lib \ #png
--with-zlib-dir=/usr/local/lib \ #zlib
--with-jpeg-dir=/usr/local/lib \ #jpeg
--enable-libxml \
--with-libxml-dir=/usr/local/lib \ #libxml扩展
#--with-xsl=/usr/local/lib \ #xslt扩展
--ENABLE-PDO \
--with-pdo-sqlite \
--with-pdo-mysql=/usr/local/mysql5/bin/mysql_config \ #pdo
--ENABLE-SOAP \ #soap服务扩展
--enable-sockets \ #sockets扩展
--with-xmlrpc #xmlrpc扩展
--with-config-file-path=/etc #设置PHP. ini storage location
./configure--PREFIX=/USR/LOCAL/PHP5--with-apxs2=/usr/local/apache2/bin/apxs--WITH-MYSQL=/USR/LOCAL/MYSQL5
--enable-ftp--enable-debug--enable-mbstring--enable-mbregex--with-gd=/usr/local
--with-png-dir=/usr/local/lib--with-zlib-dir=/usr/local/lib--with-jpeg-dir=/usr/local/lib
--enable-libxml--with-libxml-dir=/usr/local/lib--enable-pdo--with-pdo-sqlite
--with-pdo-mysql=/usr/local/mysql5/bin/mysql_config--enable-soap
--enable-sockets--WITH-XMLRP
Make
Make install
Configure Apache and PHP, MySQL startup
Automatically start MySQL
Copy Code code as follows:
Cp/usr/local/mysql5/share/mysql/mysql.server/etc/init.d/mysqld
Ln-s/etc/init.d/mysqld/etc/rc3.d/kmysqld
Ln-s/etc/init.d/mysqld/etc/rc3.d/smysqld
Service mysqld Start
/usr/local/apache2/bin/apachectl start