×××lamp
一 编译环境
Yum grouplist
Development libraries
Development tools
Legacy software development
图形界面还需要
X software development
Gnome software development
Kde software development
没装可以用 yum groupinstall
安装源码包之前要先去掉以前的,可以使用
yum list all |grep -E "mysql|httpd|php"
yum remove 包1 包2 包3
或则 rm -rf /etc/httpd
二 源码编译步骤:
1)配置
2)编译
3)安装
三 ×××
1》Httpd的源代码
Tar -jxvf httpd-2.2.19.tar.bz2 -C /usr/local/src/
Cd /usr/local/src/httpd-2.2.19/
./configure --help 看选项
--prefix 安装路径
--sysconfdir 配置文件的路径
--with-ssl=dir openssl开发库的位置,如果已经安装 而且是通过rpm包安装的,应该安装在标准路径下,直接使用 --enable-ssl即可
---with-mpm 设定apache的运行方式 默认prefork work 模式
./configure常用的选项有如下
--prefix=/usr/local/apache
--sysconfdir=/etc/httpd
--enable-so 启用以dso模式加载模块
--enable-ssl
--with-ssl=/usr/local/ssl
--enable-rewrite 支持URL重写
--with-z 使用zlib
--enable-mods-shared=most
--enable-suexec
--with-suexec-caller=daemon(用户名)
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-ssl --with-z --enable-so
Make
Make install
vim /etc/httpd/httpd.conf
P29 根目录变化了
Cd /usr/local/apache/htdocs/ //主目录
Cd ..
Bin/apachectl start
Netstat -tupln |grep http
改变启动方式:
Vim /etc/profile
P45 PATH=$PATH:/usr/local/apache/bin
. /etc/profile
Echo $PATH
导出头文件
Cd /usr/include/
Ln -s /usr/local/apache/include httpd
导出库文件
Cd /etc/ld.so.conf.d/
Vim httpd.conf
/usr/locla/apache/lib
Ldconfig -v |grep httpd
2》php的源代码
Tar -jxvf php-5.3.7.tar.bz2 -C /usr/local/src/
Cd /usr/local/src/php-5.3.7
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config -- enable-mbsting=all
Make
Make install
Vim /etc/httpd/httpd.conf
Addtype application/x-httpd-php .php //增加这么一行
Apachectl stop
Apachectl start
Cd /usr/local/apache/htdocs/
Mv index.html index.php
Vim index.php
*********************************************
<?php
Phpinfo();
?>
*********************************************
3》绿色版mysql
Tar -zxvf mysql-5.5.15-linux2.6-i686.tar.gz -C /usr/local/
Cd /usr/local/
Ln -s mysql-5.5.15-linux2.6-i686 mysql
Cd mysql/
Less INSTALL-BINARY //安装指导 按照上面的步骤走
步骤如下:
Cd /usr /local/mysql
Groupadd mysql
Useradd -r -g mysql mysql //-M 不创建家目录
Chown -R mysql .
Chgrp -R mysql .
Scripts/mysql_install_db --user=mysql
Chown -R root .
Chown -R mysql data
Bin/mysqld_safe --user=mysql &
Netstat -tupln |grep mysql //将看到3306 证明mysql已启动
更改启动方式:
(1)
Vim /etc/profile //修改系统变量
P45 PATH=$PATH:/usr/local/mysql/bin
. /etc/profile //当前生效不必等到下次启动
Echo $PATH //查看变量
Mysqld_safe stop
Mysqld_safe --user=mysql &
Netstat -tupln |grep mysql
(2)
Cd /usr/local/mysql/support-files/
Cp my-large.cnf /etc/my.cnf
Cp mysql.server /etc/init.d/mysqld
Chkconfig --add mysqld
Vim /etc/init.d/mysqld
P13
Ll /etc/re.d/rc3.d/ |grep my
Service mysqld stop
Netstar -tupln |grep mysql //查找不到
Service mysqld start
Netstat -tupln |grep mysql
导出头文件
Cd /uer/include
Ln -s /usr/local/mysql/include mysql
导出库文件
Cd /etc/ld.so.conf.d//
Vim mysqld.conf
/usr/local/mysql/lib
Ldconfig -v |grep mysql
四 测试
测试主页
Cd /usr/local/apache/htdocs/
Mv index.html index.php
Vim index.php
*********************************************
<?php
Phpinfo();
?>
*********************************************
测试连通性
Cd /usr/local/apache/htdocs/
Mv index.html index.php
Vim index.php
*****************************************************************
<?php
$link=mysql_connect ("127.0.01","root"," ") ;
If ($link)
Echo "ok"
Else
Echo "no"
?>
****************************************************************