相关的软件包

httpd-2.2.19.tar.bz2

mysql-5.5.15-linux2.6-i686.tar.gz

php-5.3.7.tar.bz2

 

编译的环境

yum grouplist all |less

出现

Development Libraries

Development Tools

Legacy Software Development

 

 

一.编译Mysql

1.tar -zxvf mysql-5.5.15-linux2.6-i686.tar.gz  -C  /usr/local/

2.cd /usr/local/
3.ln -s mysql-5.5.15-linux2.6-i686/ mysql
4.cd  mysql
5.less INSTALL-BINARY
6.groupadd mysql
7.useradd -r -g mysql mysql
 
8.chown -R mysql .
9.chgrp -R mysql .
10.scripts/mysql_install_db --user=mysql
11.chown -R root .
12.chown -R mysql data
 
13.bin/mysqld_safe --user=mysql &
netstat -tupln|grep mysql
14 cd support-files/
 
15.cp my-large.cnf /etc/my.cnf
16.cp mysql.server /etc/init.d/mysqld
 
17.vim /etc/profile
44行 PATH=$PATH:/usr/local/mysql/bin
18 .  /etc/profile
10. chkconfig --add mysqld
11. cd /usr/local/include/(头文件)
12.ln -s /usr/local/mysql/include mysql
13.cd /etc/ld.so.conf.d/(库文件)
14.vim mysqld.conf
/usr/local/mysql/lib
 

 

源码构建Lamp坏境_源码

 
 二.编译Apache
1. cd /root
2.tar -zxvf httpd-2.2.19.tar.gz -C /usr/local/src/
3.cd /usr/local/src/
 4.cd httpd-2.2.19/
 5../configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --with-z --enable-ssl
6.编译apache  make
 
 
7. 安装apache make install
8.cd /usr/local/apache/
9. ./bin/apachectl start
    vim /etc/profile
44 PATH=$PATH:/usr/local/apache/bin/
10.. /etc/profile
 
11.
配置apache的头文件
cd /usr/include/
 ln -s /usr/local/apache/include/ apache
12.
配置apache的库文件
 
13.cd /etc/ld.so.conf.d/
14. vim apache.conf
/usr/local/apache/lib
 

 

源码构建Lamp坏境_职场_02

 
三.编译PHP
1.cd /root
2.tar -jxvf php-5.3.7.tar.bz2 -C /usr/local/src/
3.cd /usr/local/src/
4.cd php-5.3.7/
 
5.配置php二进制文件
  ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --enable-mbstring --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config
6.编译php二进制文件
  make
7.安装php二进制文件
 make install
 

 

源码构建Lamp坏境_源码_03

 
四。测试 
 1.cd /usr/local/apache/htdocs/
vim index.php
2.vim /etc/httpd/httpd.conf
167 <IfModule dir_module>
168     DirectoryIndex index.php index.html
169 </IfModule>
309     AddType application/x-compress .Z
310     AddType application/x-gzip .gz .tgz
311    AddType application/x-httpd-php .php
(1)测试php
vim index.php
<?php
phpinfo();
?>
 

源码构建Lamp坏境_源码_04

(2)测试Mysql
vim index.php
<?php
$link=mysql_connect('127.0.0.1','root',' ');
if ($link)
echo "scuess";
else
echo "fail";
 

源码构建Lamp坏境_职场_05