lamp源代碼安裝:
1.安裝gcc glib 包含着開發工具中
Development Tools --開發工具
Legacy Software Development -- 傳統軟體開發工具
Development Libraries –開發工具庫
Java development –源代碼基于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
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
然後将該路徑放到環境變量當中去:
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 –jxvf php-5.3.7.tar –C /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