linux下網站平台的搭建——apache +PHP+mysql
實驗環境 VMware 6.5.2+redhat Enterprise 5 AS
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_12568944165j62.jpg"></a>
我的核心版本
本文實驗基礎環境已經做好了一個dns的解析
本文中的幾個元件均為源碼包安裝 ,介于可能有版本的不同安裝略有差異
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894417VctE.jpg"></a>
本文大緻可以分為以下步驟
mysql的安裝與簡單配置
apache的安裝與簡單配置
PHP的安裝
論壇的配置
由于之前已經有一篇關于 mysql 源碼包的安裝 是以 再此不在詳細講述
具體請參考
http://yuzeying.blog.51cto.com/644976/154611
下面安裝 apache的源碼包
<a href="http://dev.mysql.com/downloads/">http://dev.mysql.com/downloads/</a>
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894418cbaA.jpg"></a>
[root@localhost tmp]# tar zxvf httpd-2.0.58.tar.gz
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894420CSIT.jpg"></a>
解壓之後
進入源碼目錄
[root@localhost tmp]# cd httpd-2.0.58
[root@localhost httpd-2.0.58]# ls
ABOUT_APACHE CHANGES InstallBin.dsp os
acconfig.h config.layout LAYOUT README
acinclude.m4 configure libhttpd.dsp README.platforms
Apache.dsp configure.in LICENSE server
Apache.dsw docs Makefile.in srclib
apachenw.mcp.zip emacs-style Makefile.win support
build httpd.spec modules test
BuildBin.dsp include NOTICE VERSIONING
buildconf INSTALL NWGNUmakefile
[root@localhost httpd-2.0.58]#
編譯前的準備
[root@localhost httpd-2.0.58]# ./configure --prefix=/usr/local/apache --enable-module=so
# apache 動态調用mysql
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894423fIUA.jpg"></a>
下一步 編譯
[root@localhost httpd-2.0.58]# make
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_12568944294YHq.jpg"></a>
這個過程稍顯緩慢
下一步 編譯安裝
[root@localhost httpd-2.0.58]# make install
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894435PKya.jpg"></a>
安裝完成
啟動一下看看
[root@localhost httpd-2.0.58]#/usr/local/apache/bin/apachectl start
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894439XYhC.jpg"></a>
下一步 PHP的安裝
<a href="http://www.phpbb.com/downloads.php">http://www.phpbb.com/downloads.php</a>
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_12568944429L5g.jpg"></a>
拷貝 或下載下傳 php源碼包
[root@localhost tmp]# tar zxvf php-4.4.9.tar.gz
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894444fjJU.jpg"></a>
解壓 完畢 進入源碼目錄
[root@localhost tmp]# cd php-4.4.9
[root@localhost php-4.4.9]# ls
acconfig.h NEWS
acconfig.h.in pear
acinclude.m4 php4.spec.in
aclocal.m4 php.gif
build php.ini-dist
buildconf php.ini-recommended
CODING_STANDARDS README.CVS-RULES
config.guess README.EXTENSIONS
config.sub README.EXT_SKEL
configure README.PARAMETER_PARSING_API
configure.in README.QNX
CREDITS README.SELF-CONTAINED-EXTENSIONS
cvsclean README.STREAMS
ext README.SUBMITTING_PATCH
EXTENSIONS README.TESTING
footer README.UNIX-BUILD-SYSTEM
generated_lists README.Zeus
genfiles regex
header run-tests.php
INSTALL sapi
install-sh scripts
LICENSE server-tests.php
ltmain.sh snapshot
main stamp-h.in
makedist stub.c
Makefile.frag tests
Makefile.global TODO
makerpm TODO_SEGFAULTS
missing TSRM
mkinstalldirs win32
netware Zend
[[email protected]]#./configure --prefix=/usr/local/php --with-mysql --with-apxs2=/usr/local/apache/bin/apxs
等待
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894447Xf9R.jpg"></a>
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894451GC7K.jpg"></a>
[root@localhost php-4.4.9]# make
編譯
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_12568944564qkC.jpg"></a>
編譯安裝
[root@localhost php-4.4.9]# make install
Installing PHP SAPI module: cgi
Installing PHP CGI into: /usr/local/bin/
Installing PEAR environment: /usr/local/lib/php/
[PEAR] Archive_Tar - installed: 1.3.2
[PEAR] Console_Getopt - installed: 1.2.1
[PEAR] HTML_Template_IT- installed: 1.1
[PEAR] Net_UserAgent_Detect- installed: 2.0.1
warning: pear/PEAR requires package "pear/Structures_Graph" (recommended version 1.0.2)
pear/PEAR can optionally use package "pear/XML_RPC" (version &gt;= 1.4.0)
[PEAR] PEAR - installed: 1.5.0
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
[PEAR] Structures_Graph- installed: 1.0.2
Installing build environment: /usr/local/lib/php/build/
Installing header files: /usr/local/include/php/
Installing helper programs: /usr/local/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/man/man1/
page: phpize.1
page: php-config.1
[root@localhost php-4.4.9]#
下一步 複制PHP配置檔案,注意路徑
[root@localhost php-4.4.9]# cp /tmp/php-4.4.9/php.ini-dist /usr/local/lib/php.ini
這裡注意大小寫
修改apache配置檔案 使其能夠識别.PHP結尾的網頁檔案
[root@localhost php-4.4.9]# vi /usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php .php
注意大小寫和空格
[root@localhost php-4.4.9]# vi /usr/local/apache/htdocs/index.php
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894467X7rc.jpg"></a>
回車繼續
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894469rjYA.jpg"></a>
這裡呢是一個很簡單的測設語句 注意是以分号結束的
[root@localhost php-4.4.9]#/usr/local/apache/bin/apachectl stop
[root@localhost php-4.4.9]#/usr/local/apache/bin/apachectl start
重新開機apache服務
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894471PlKG.jpg"></a>
我的ip設定
在浏覽器裡輸入
<a href="http://192.168.1.101/index.php">http://192.168.1.101/index.php</a>
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894476W8DF.jpg"></a>
如果這裡出現nofound的話 參考以下解決方法
我們先用/usr/local/apache/bin/apachectl start啟動apache服務,起不來的話
[root@localhost ~]# /usr/local/apache/bin/apachectl start
(98)Address already in use: make_sock: could not bind to address [::]:80
no listening sockets available, shutting down
Unable to open logs
[root@localhost ~]# killall -9 httpd
[root@localhost ~]#
确信步驟沒有錯誤,配置檔案沒有其他改動的話
建議把程序結束 在啟動一次
killall -9 httpd
/usr/local/apache/bin/apachectl start
下一步
由于之前的介紹mysql的安裝的文章沒有 設定遠端密碼
是以我們現在需要設定一個給予Mysql資料庫遠端通路權限
[root@localhost ~]# /usr/local/mysql/bin/mysqladmin -u root password Ccjsj1200
我的本地計算機的密碼為Ccjsj1200 遠端的同樣是這個
不要把遠端密碼設定成别的,不然本地登入會出問題的,我已經試過了,大家就不用在試了
[root@localhost ~]# /usr/local/mysql/bin/mysql
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
如果我們現在這樣登入的話是會出現錯誤的,是以要這樣登入
[root@localhost ~]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
####注釋一下這裡輸入你的密碼Ccjsj1200
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.0.27-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
這時我們成功登陸資料庫
設定MySQL遠端管理者密碼,在MySQL提示符中輸入
mysql> grant all on *.* to root@'%' identified by 'Ccjsj1200' with grant option;
Query OK, 0 rows affected (0.00 sec)
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894479shgR.jpg"></a>
在MySQL庫中建立phpbb資料庫
mysql> create database phpbb;
####注意以分号結尾
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+----------+
| Database |
| mysql |
| phpbb |
| test |
3 rows in set (0.00 sec)
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894482JDwM.jpg"></a>
把語言包和論壇源代碼拷貝至/tmp目錄下
mysql>quit
Bye
[root@localhost ~]# cd /tmp
[root@localhost tmp]# ls
gconfd-root scim-bridge-0.3.0.lockfile-0@localhost:0.0
httpd-2.0.58 scim-bridge-0.3.0.socket-0@localhost:0.0
httpd-2.0.58.tar.gz scim-helper-manager-socket-root
keyring-hVSZal scim-panel-socket:0-root
lang_chinese_simplified.tar.gz scim-socket-frontend-root
mapping-root sealert.log
mysql-4.0.27 ssh-fRrzDL3480
mysql-4.0.27.tar.gz virtual-root.Xh7y9O
mysql.sock VMwareDnD
orbit-root vmware-root
php-4.4.9 VMwareTools-7.8.4-126130.tar.gz
php-4.4.9.tar.gz vmware-tools-distrib
[root@localhost tmp]# tar zxvf lang_chinese_simplified.tar.gz
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894486znoK.jpg"></a>
[root@localhost tmp]# tar zxvf phpBB-2.0.20.tar.gz
複制語言包内容到phpBB2的language目錄下
[root@localhost tmp]# cp -r /tmp/lang_chinese_simplified /tmp/phpBB2/language/
[root@localhost tmp]#
複制論壇安裝源代碼包内容到apache首頁目錄下
[root@localhost tmp]# cp -r /tmp/phpBB2 /usr/local/apache/htdocs
這裡注意你安裝的目錄即可
開始安裝phpbb,
浏覽器裡輸入
<a href="http://192.168.1.101/phpBB2/install/install.php">http://192.168.1.101/phpBB2/install/install.php</a>
填寫相關資訊
之後選擇開始安裝
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894496rEj6.jpg"></a>
您的系統設定檔無法寫入, 您可以點選下方按鈕下載下傳設定檔案, 再将這個檔案上傳至 phpBB 2 論壇的資料夾. 在完成後您必須使用管理者帳号跟密碼登陸并進入系統管理控制台 (在您登陸後, 下方将出現一個進入"系統管理控制台"的連結) 檢查您的基本配置設定. 最後感謝您選擇使用安裝 phpBB 2 論壇系統.
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894497FCt6.jpg"></a>
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894499AB4L.jpg"></a>
我們打開看一下
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894501f11Q.jpg"></a>
用新下載下傳的config.conf檔案覆寫原有的舊config.conf檔案
[root@localhost ~]# cd /root/Desktop
[root@localhost Desktop]#
[root@localhost Desktop]# cp config.php /usr/local/apache/htdocs/phpBB2
cp:是否覆寫“/usr/local/apache/htdocs/phpBB2/config.php”? y
####是否覆寫這裡選擇y
進入到phpBB2目錄下,删除安裝檔案contrib和install,以便正常通路
[root@localhost Desktop]# cd /usr/local/apache/htdocs/phpBB2
[root@localhost phpBB2]# ll
總計 432
drwxr-xr-x 2 root root 4096 08-23 17:35 admin
drwxr-xr-x 2 root root 4096 08-23 17:35 cache
-rw-r--r-- 1 root root 6660 08-23 17:35 common.php
-rw-r--r-- 1 root root 273 08-23 19:00 config.php
drwxr-xr-x 2 root root 4096 08-23 17:35 contrib
drwxr-xr-x 2 root root 4096 08-23 17:35 db
drwxr-xr-x 2 root root 4096 08-23 17:35 docs
-rw-r--r-- 1 root root 810 08-23 17:35 extension.inc
-rw-r--r-- 1 root root 3643 08-23 17:35 faq.php
-rw-r--r-- 1 root root 45807 08-23 17:35 groupcp.php
drwxr-xr-x 4 root root 4096 08-23 17:35 images
drwxr-xr-x 2 root root 4096 08-23 17:35 includes
-rw-r--r-- 1 root root 14706 08-23 17:35 index.php
drwxr-xr-x 3 root root 4096 08-23 17:35 install
drwxr-xr-x 4 root root 4096 08-23 17:35 language
-rw-r--r-- 1 root root 9492 08-23 17:35 login.php
-rw-r--r-- 1 root root 12208 08-23 17:35 memberlist.php
-rw-r--r-- 1 root root 39011 08-23 17:35 modcp.php
-rw-r--r-- 1 root root 34911 08-23 17:35 posting.php
-rw-r--r-- 1 root root 73811 08-23 17:35 privmsg.php
-rw-r--r-- 1 root root 3428 08-23 17:35 profile.php
-rw-r--r-- 1 root root 43661 08-23 17:35 search.php
drwxr-xr-x 3 root root 4096 08-23 17:35 templates
-rw-r--r-- 1 root root 23154 08-23 17:35 viewforum.php
-rw-r--r-- 1 root root 7233 08-23 17:35 viewonline.php
-rw-r--r-- 1 root root 45235 08-23 17:35 viewtopic.php
[root@localhost phpBB2]#
[root@localhost phpBB2]# rm -rf contrib
[root@localhost phpBB2]# rm -rf install
再次通路改論壇
<a href="http://192.168.1.101/phpBB2/index.php">http://192.168.1.101/phpBB2/index.php</a>
登陸一下
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894505aUzO.jpg"></a>
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894508BgQp.jpg"></a>
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894517gmJs.jpg"></a>
後面的這些建立 就變得很簡單了,就不在此詳細的描述了,截幾個圖大家看看吧
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894521fffQ.jpg"></a>
這是仿照maxpda 做的粗糙的頁面,反正有那麼點意思
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894523urIi.jpg"></a>
這個是注冊使用者的時候的畫面
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894525uN9E.jpg"></a>
這是回複文章的畫面
<a href="http://yuzeying.blog.51cto.com/attachment/200910/30/644976_1256894528ArZf.jpg"></a>
參考兩篇博文
原帖位址
<a href="http://shuangyang.blog.51cto.com/540829/158422">http://shuangyang.blog.51cto.com/540829/158422</a>
雙洋 兄
<a href="http://yangjunfeng.blog.51cto.com/539796/157663">http://yangjunfeng.blog.51cto.com/539796/157663</a>
老楊
本文轉自 yuzeying1 51CTO部落格,原文連結:http://blog.51cto.com/yuzeying/219048