環境:centos-6.4x86-64php
所需軟件:httpd-2.4.4.tar.bz2apr-1.4.6.tar.gz apr-util-1.5.1.tar.gz php-5.5.8.tar.bz2 mysql-5.6.15.tar.gzhtml
共享連接:http://pan.baidu.com/s/1i32vG3r http://pan.baidu.com/s/1pJFGBlL mysql
對於×××lamp平臺主要是想使用最新的軟件包,或者想自定義一些功能。對於×××首先要安裝mysql其次安裝httpd,最後安裝phpsql
那麼咱們就先來安裝mysql,將mysql的解壓到/usr/local/目錄下,解壓完成後切換到/usr/local/mysql-5.6.15/目錄下而後執行cmake .shell
cmake完成以後,進行make && make install數據庫
這個過程是至關漫長的,耐心等待。這個過程完了以後,建立mysql組和mysql用戶,而且mysql用戶是系統用戶。apache
建立組groupaddmysql,建立用戶useradd-r -g mysql mysql。而後切換到/usr/local/mysql目錄下修改所屬組和全部者爲mysqlcentos
而後執行scripts/mysql_install_db--user=mysql 初始化mysql瀏覽器
再把全部者修改成root,data的全部者還爲mysqlbash
接着須要產生mysql的配置文件,將mysql目錄下的my.cnf拷貝到/etc/my.cnf
產生mysql的控制腳本cp support-files/mysql.server/etc/init.d/mysqld,而且給mysqld可執行權限,而後將mysqld加入chconfig管理
而後將mysql下的bin目錄加入系統搜索路徑,編輯/etc/profile
而後用 ./etc/profile從新加載。而後爲mysql添加管理員和口令
mysqladmin –u root –p password ‘密碼’
之後訪問mysql數據庫時使用命令 mysql –u root –p
Mysql到這裏就安裝完成了,接着安裝httpd,由於httpd須要以來apr和apr-util,因此在安裝httpd前先安裝apr和apr-util
解壓apr和apr-util和httpd到/usr/local/src,解壓完成後切換到apr-1.4.6目錄,執行configure
以後執行make&& make install,完成後切換到apr-util-1.5.1目錄下執行
./configure--prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
完成後一樣執行make&& make install,再以後切換到httpd-2.4.4目錄下
執行./configure--prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so
--enable-ssl --enable-rewrite --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config--with-pcre -with-z --enable-mpms-shared=all
完成以後執行make&& make install
安裝完成以後添加/usr/local/apache/bin到系統搜索路徑
完成這些以後,編寫控制httpd的shell腳本放到/etc/init.d/目錄裏。
#!/bin/bash
prog=/usr/local/apache/bin/httpd
lockfile=/var/lock/subsys/httpd
start(){
if [ -e $lockfile ];then
echo "httpd server isstarted"
else echo -n "httpd server isstarting... "
sleep 1
$prog –k start &>/dev/null && echo "[ ok ]" && touch $lockfile||echo "[ failer ]"
fi
}
stop(){
if [ ! -e $lockfile ];then
echo "httpd server is stoped"
else echo -n "httpd server isstoping... "
sleep 1
$prog –k stop &>/dev/null&& echo "[ ok ]" && rm -rf $lockfile ||echo "[failer ]"
fi
}
status(){
if [ -e $lockfile ];then
echo "httpd server isstarted"
else echo "httpd server nofound"
fi
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo"USAGE:start|stop|restart|status"
;;
esac
httpd到這裏也安裝完成,接着安裝php,解壓php到/usr/local/src/,而後切換到/usr/local/src/php-5.5.8
而後執行./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 --enable-xml --with-png-dir --with-png --with-jpeg-dir --with-zlib --enable-mbstring --with-freetype-dir
完成以後執行make&& make install。再httpd的配置文件中添加AddTypeapplication/x-httpd-php .php,使httpd能夠處理php
完成後就該測試lamp平臺是否可用
在/usr/local/apache中編輯一個index.php網頁
而後運行
能夠運行,而後驗證php和mysql的連接,修改index.php
而後運行
一樣沒有沒問題
接着咱們就來架構一個論壇,我在這裏用的是wordpress的框架。安裝wordpress,首先解壓軟件包
解壓後造成一個wordpress文件夾
而後拷貝該文件夾到/usr/local/apache/htdocs下,切換到該目錄能夠看到一個readme.html的網頁,而後經過瀏覽器來訪問該網頁,看看安裝說明。
而後咱們根聽說明來進行安裝,訪問wp-admin/install.php
選擇建立配置文件
如今就開始
這裏是連接數據庫的,輸入數據庫名,用戶名及密碼,數據庫主機,表的前綴。
可是咱們如今的數據庫中尚未數據庫,因此咱們要建立數據庫
建立完成後到瀏覽器中點提交
這裏提示沒有權限寫入,沒有關係,咱們直接把文本拷貝到wp-config.php中,保存退出,而後點擊進行安裝
根據需求填入站點標題,用戶名,密碼,電子郵箱,而後點擊安裝
到這裏就已經安裝成功,點擊登陸,輸入賬號和密碼就能夠訪問後臺了。直接輸入192.168.29.20/wordpress就能夠進入前臺。