天天看點

Linux下搭建lamp論壇(phpwind+wordpress+discus)

一:lamp簡介:

Linux+Apache+Mysql+Perl/PHP/Python一組常用來搭建動态網站或者伺服器的開源軟體,本身都是各自獨立的程式,但是因為常被放在一起使用,擁有了越來越高的相容度,共同組成了一個強大的Web應用程式平台。該軟體開發的項目在軟體方面的投資成本較低,是以受到整個IT界的關注。從網站的流量上來說,70%以上的通路流量是LAMP來提供的,LAMP是最強大的網站解決方案.

二:phpwind,wordpress,discus,discus簡介:

PHPWind(簡稱:PW)是一個基于PHP和MySQL的論壇程式,是國内最受歡迎的通用型論壇程式之一.

WordPress 是一種使用 PHP語言和 MySQL資料庫開發的開源、免費的 Blog(部落格,網站)引擎,使用者可以在支援 PHP 和 MySQL 資料庫的伺服器上建立自己的blog.

Discuz是北京康盛新創科技有限責任公司推出的一套通用的社群論壇軟體系統,是全球成熟度最高、覆寫率最大的論壇軟體系統之一。

三:搭建lamp

1:[root@lyt ~]# mkdir /mnt/cdrom

[root@lyt ~]# mount /dev/cdrom /mnt/cdrom/

[root@lyt ~]# vim /etc/yum.repos.d/rhel-debuginfo.repo          #編輯本地yum,如圖:

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163754TRSn.png"></a>

2:[root@lyt ~]# yum install httpd            #安裝http伺服器

[root@lyt ~]# yum install mysql mysql-server          #安裝mysql工具包和mysql-server

[root@lyt ~]# yum list all |grep php            #搜尋安裝php需要的包

[root@lyt ~]# yum install php php-mbstring  php-mysql          #安裝這三個軟體包

[root@lyt ~]# service httpd start       #開啟http伺服器

[root@lyt ~]# service mysqld start       #開啟mysql伺服器

[root@lyt ~]# chkconfig httpd on           #開機自動啟動http伺服器

[root@lyt ~]# chkconfig mysqld on         #開機自動啟動mysql伺服器

[root@lyt ~]# cd /var/www/html/

[root@lyt html]# vim index.php            #編輯一個動态的頁面,測試php是否能被apache調用

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163763d0Ck.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_13461637652Cj2.png"></a>

[root@lyt html]# vim index.php         #編輯動态頁面,測試mysql是否能被php調用

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163772VJAz.png"></a>

3:[root@lyt ~]# cd /mnt/cdrom/Server/

[root@lyt Server]# rpm -ivh vsftpd-2.0.5-16.el5.i386.rpm

[root@lyt Server]# vim /etc/vsftpd/vsftpd.conf

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163777RNEu.png"></a>

[root@lyt Server]# cd /var/ftp

[root@lyt ftp]# chmod o+w pub/

[root@lyt ftp]# service vsftpd restart

利用ftp将phpwind,wordpress傳入虛拟機中:

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163779FwIj.png"></a>

[root@lyt var]# cd /var/ftp/pub/

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163783vpeS.png"></a>

四:建立論壇:

phpwind:

4:[root@lyt pub]# mv phpwind_GBK_8.3.zip /root/            #将這些包全部移動到/root中

[root@lyt pub]# mv Stratex.zip  /root/

[root@lyt pub]# mv WireMagazine.zip  /root/

[root@lyt pub]# mv wordpress_v3.0.5-zh_CN.zip  /root/

[root@lyt ~]# unzip phpwind_GBK_8.3.zip           #解壓檔案

[root@lyt ~]# cd phpwind_GBK_8.3

[root@lyt phpwind_GBK_8.3]# mv upload/ /var/www/html/phpwind          #将網頁upload檔案移動到/var/www/html中,并重命名為phpwind

[root@lyt phpwind]# vim /etc/httpd/conf/httpd.conf        #編輯apache配置檔案,更改論壇頁面字型

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163786NBmR.png"></a>

[root@lyt phpwind]# service httpd restart

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_13461637965TtR.png"></a>

[root@lyt phpwind]# chmod -R attachment/           #更改上圖中目錄屬性為777,-R表示遞歸

[root@lyt phpwind]# chmod -R 777 data/             #更改上圖中目錄屬性為777,-R表示遞歸

[root@lyt phpwind]# chmod -R 777 html/             #更改上圖中目錄屬性為777,-R表示遞歸

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163809PjvV.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163813ip0w.png"></a>

[root@lyt html]# mysqladmin -u root -p password '123'        #為資料庫建立使用者名root,密碼“123”

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163815E3XY.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163818F6RH.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163820VKCR.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163825nA4b.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_13461638309GVU.png"></a>

[root@lyt var]# cd /var/www/html/phpwind/

[root@lyt phpwind]# rm install.php

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163833Gg59.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163837MKl6.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_134616383987th.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163841Ks5K.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163843qsom.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163845vXBA.png"></a>

wordpress:

1:[root@lyt ~]# unzip wordpress_v3.0.5-zh_CN.zip       #解壓wordpress

[root@lyt ~]# ll wordpress-3.0.5-zh_CN/

[root@lyt ~]# mv wordpress-3.0.5-zh_CN/wordpress/  /var/www/html/       #将wordpress檔案移動到/var/www/html

[root@lyt html]# cd /var/www/html/wordpress/

[root@lyt wordpress]# cp wp-config-sample.php  wp-config.php       #産生一個wp-config.php檔案

[root@lyt wordpress]# chown apache.apache wp-config.php        #将wp-config.php檔案交給apache程序處理

[root@lyt html]# mysql -u root –p #登入資料庫

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163846sA1D.png"></a>

2:[root@lyt ~]# cd /var/www/html/wordpress/

[root@lyt wordpress]# vim wp-config.php

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163848jsnH.png"></a>

[root@lyt wordpress]# service httpd restart

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163850BCuq.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163855oAH8.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163858Ct3u.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163859tVAN.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163861aStB.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163870GQJQ.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163876MNJz.png"></a>

進入背景管理頁面:

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_13461638782ikG.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_134616388566QU.png"></a>

修改/var/www/html/wordpress/wp-content權限:

[root@lyt pub]# cd /var/www/html/wordpress

[root@lyt wordpress]# chmod o+w wp-content/            #增加寫的權限

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163906sSt5.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163922DkL2.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163925ZMp2.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_13461639330mhv.png"></a>

[root@lyt wp-content]# cd uploads/

[root@lyt uploads]# cp Stratex.zip ../themes/

[root@lyt uploads]# cd ../themes/

[root@lyt themes]# unzip Stratex.zip

[root@lyt themes]# unzip Stratex.zip        #将Stratex.zip解壓縮

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163936GRUK.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163941XxLO.png"></a>

建立基于主機頭的虛拟主機,用不同的主機名登入論壇:

[root@lyt themes]# vim /etc/httpd/conf/httpd.conf

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163945p0zO.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163947Hsbf.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163953cMPS.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163956Zw7I.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163962lGlj.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163969eOml.png"></a>

Discuz:(安裝discus并将discus添加到虛拟主機中)

[root@lyt html]# cd /var/ftp/pub/

[root@lyt pub]# mv Discuz_X2.5_SC_GBK.zip /root/

[root@lyt pub]# cd

[root@lyt ~]# unzip Discuz_X2.5_SC_GBK.zip           #解壓檔案

[root@lyt ~]# mv  upload/  /var/www/html/

[root@lyt html]# mkdidr discus       #建立目錄

[root@lyt html]# cp -r readme/ ./discus/      #将readme目錄移動到discus中

[root@lyt html]# cp -r upload/ ./discus/

[root@lyt html]# cp -r utility/ ./discus/  

[root@lyt html]# vim /etc/httpd/conf/httpd.conf

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163977o87S.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163979KhwR.png"></a>

[root@lyt html]# service httpd restart                             

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_13461639844gKt.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163987lZ7Z.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163989L3M8.png"></a>

[root@lyt html]# cd discus/

[root@lyt discus]# chmod -R o+w  config/

[root@lyt discus]# chmod -R o+w  data/

[root@lyt discus]# chmod -R o+w  uc_client/

[root@lyt discus]# chmod -R o+w  uc_server/

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_13461639910G41.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163993htaW.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_13461639947yhq.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346163999nV5y.png"></a>

[root@lyt discus]# mysql -u root –p       #登入資料庫mysql

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346164001Dt1G.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346164003J85m.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_13461640057u3X.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346164007RVGB.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/28/5493845_1346164009XBFQ.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/29/5493845_1346202973eEKN.png"></a>

<a href="http://5493845.blog.51cto.com/attachment/201208/29/5493845_1346202986dHra.png"></a>

本文轉自 liuyatao666 51CTO部落格,原文連結:http://blog.51cto.com/5503845/975622,如需轉載請自行聯系原作者