源码搭建lamp

lamp源代码安装:

1.安装gcc glib 包含着开发工具中
      Development Tools --开发工具
      Legacy Software Development  -- 传统软件开发工具
      Development Libraries �C开发工具库
      Java development �C源代码基于java
如果是图形的软件包
      Kde环境需要安装:
      Kde software development
      Gnome环境需要安装:
      Gnome software development
      X software development
源代码搭建lamp需要3个过程:配置 编译 安装

将http,php,mysql包移到linx根目录下
1.mysql:
先解压缩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.tar.gz mysql

cd /usr/local/mysql
groupadd mysql
useradd -r -g mysql mysql
chown -R mysql .
chgrp -R mysql . scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
bin/mysqld_safe --user=mysql &
vim /etc/profile
在第44行:PATH=$PATH:/usr/local/mysql/bin
然后重新读取文件: . /etc/profile
cd /usr/local/mysql
cp support-files/my-large.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
查看是否有mysql的端口 chkconfig --list |grep mysql
如果没有,执行以下命令:chkconfig --add mysqld
做个链接: ln -s /usr/local/mysql/include mysql

标准库文件存放目录:
/lib/   /usr/lib   /usr/local/lib
让系统找到mysql库文件
vim /etc/ld.so.conf
可以写在:ld.so.conf.d/*
cd /etc/ld.so.conf.d/
vim mysqld.conf
/usr/local/mysql/lib

2.apache:
tar -jxvf httpd-2.2.19.tar.bz2  -C /usr/local/src/ (源代码放在这)
cd /use/local/src/
cd hhttpd-2.2.19.tar.bz2
配置运行:./configure --prefix=/usr/local/apache  --sysconfdir=/etc/httpd               --enable-ssl --with-z  --enable-so
编译过程:make

安装过程:make install

cd /etc/httpd/  (查看配置脚本)
会有一个httpd.conf

cd /usr/local/apache/htdocs

切换到 apache下,执行 bin/apachectl start
netstat -tupln |grep http
然后将该路径放到环境变量当中去:
vim /etc/profile
45行后面:bin:/usr/local/apache/bin
重新读取文件: . /etc/profile
查看路径:echo $PATH
下面也是生成库文件:
cd /etc/ld.so.conf.d
vim httpd.conf
/usr/local/apache/lib
然后让系统加载这些指令: ldconfig -v
做个链接:cd /usr/include
           ln -s /usr/local/apache/include httpd

3.安装php的源码并进行配置和调试
(1):tar �Cjxvf  php-5.3.7.tar  �CC  /usr/local/src
(2):  cd /usr/local/src/php-5.3.7
(3):./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-mbstring=all
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

make
make   install
vim  /etc/httpd/httpd.conf
验证安装
在apache的根目录下创建一个index.php
cd  /usr/local/apache/htdocs/
Vim  index.php
4、验证安装
在安装完PHP之后,会在apache安装目录的modules目录下生成数据库文件libphp5.so,同时
会在apache主配置文件httpd.conf下插入:Load Module php5_module modules/libphp5.so
cd  /usr/local/apache/modules/
ls -l
total 20348
-rw-r--r-- 1 root root     9149 Mar 18 22:44 httpd.exp
-rwxr-xr-x 1 root root 20798513 Mar 18 23:27 libphp5.so
5、apache与PHP的整合
在apache主配置文件httpd.conf中的适当位置插入以下语句(查找AddType):
vim  /etc/httpd /httpd.conf
AddType application/x-httpd-php  .php

加一句话: Addtype application/x-httpd-php.php
6.在浏览器中进行测试:
apachectl start

image

 

 

 

 

 

 

你可能感兴趣的:(源代码,工具,software,160,Legacy)