編譯安裝 LAMP 部署Discuz!論壇

RH  5.4  安裝Discuz!5.5.0論壇        社區動力步步爲營
 
1、安系統平臺環境
編譯環境:
 yum groupinstall -y "Development Libraries"                 
                    "Development Tools"                    
                    "Legacy Software Development"               
                    "X Software Development"                    //並不必定都須要安裝
 rpm -qa |grep httpd
 rpm -qa |grep mysql
 rpm -e --test --nodeps httpd
 
1.安裝mysql-5.0.87
#groupadd mysql
#useradd -g mysql mysql
#tar zxvf mysql-5.0.87.tar.gz
#cd mysql-5.0.87
#./configure --prefix=/usr/local/mysql --enable-thread-safe-client --enable-local-infile --with-charset=gbk --with-extra-charset=all --with-low-memory
#make
#make install
#cp support-files/my-medium.cnf /etc/my.cnf
#cd /usr/local/mysql
#chown -R mysql .
#chgrp -R mysql .
#bin/mysql_install_db --user=mysql
#chown -R root .
#chown -R mysql var
#bin/mysqld_safe --user=mysql &
#cd /mysql-5.0.87
#cp support-files/mysql.server /etc/rc.d/init.d/mysqld
#chmod 700 /etc/rc.d/init.d/mysqld
#chkconfig --add mysqld
#chkconfig --level 2345 mysqld on
測試
#/usr/local/mysql/bin/mysqladmin ping
#/usr/local/mysql/bin/mysqladmin version
#/usr/local/mysql/bin/mysql
添加root密碼
#/usr/local/mysql/bin/mysqladmin -uroot -p 舊密碼 password 新密碼
 
2.安裝zlib-1.2.5
 
#tar zxvf zlib-1.2.5.tar.gz
#cd zlib-1.2.5
#./configure --prefix=/usr/local/zlib
#make
#make install
 
3.安裝openssl-1.0.0d
#tar zxvf openssl-1.0.0d.tar.gz
#cd openssl-1.0.0d
#./config shared zlib
#make
#make test
#make install
mv /usr/bin/openssl /usr/bin/openssl.OFF
mv /usr/include/openssl /usr/include/openssl.OFF
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
 
配置庫文件搜索路徑
#echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
#ldconfig -vphp

4.安裝httpd-2.2.20
#tar zxvf httpd-2.2.20.tar.gz
#cd httpd-2.2.20
#./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --with-ssl=/usr/local/ssl --enable-track-vars --enable-rewrite --with-z-html

dir=/usr/local/zlib --enable-mods-shared=most 
#make
#make install
 
#echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.local(系統啓動時服務自動啓動)
 
5.安裝libpng-1.2.46
#tar zxvf libpng-1.2.14.tar.gz  
# cd libpng-1.2.46
# cp scripts/makefile.linux makefile
# make (此前要指定zlib的庫文件路徑到/usr/local/zlib/lib和/usr/local/zlib/include,編輯makefile文件實現)node

將如下兩行註釋去掉後改成一下路徑,並查看路徑是否正確
ZLIBLIB=/usr/local/zlib/lib
ZLIBINC=/usr/local/zlib/include
將一下兩行註釋掉
#ZLIBLIB=../zlib
#ZLIBINC=../zlibmysql

# make install
 
6.安裝freetype-2.4.1 
# tar -zvxf freetype-2.4.1 .tar.gz
# cd freetype-2.4.1
# mkdir -pv /usr/local/freetype
# ./configure --prefix=/usr/local/freetype
# make;make install 
 
7.安裝jpegsrc.v7
jpeg默認不會自建目錄,所以需手動創建目錄:
# mkdir -pv /usr/local/jpeg7/{bin,lib,include,man/{,man1},man1}
安裝
# tar zxvf jpegsrc.v7.tar.gz
# cd jpeg-7/   
# ./configure --prefix=/usr/local/jpeg7/ --enable-shared --enable-static
# make
# make install 
# make install-lib
 
8.安裝libxml2-2.7.4
# tar zxvf libxml2-2.7.4.tar.gz
# cd libxml2-2.7.4
# mkdir -pv /usr/local/libxml2
# ./configure --prefix=/usr/local/libxml2
# make; make install
# cp xml2-config /usr/bin
 
9.安裝gd-2.0.33 庫
# tar -zvxf gd-gd-2.0.33.tar.gz
# mkdir -p /usr/local/gd2
# cd gd-2.0.33
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg7 --with-png=/usr/local/lib --with-zlib=/usr/local/zlib --with-freetype=/usr/local/freetype
# make; make install
 
10.安裝php-5.3.8linux

# tar -zvxf php-5.3.8.tar.gz
# mkdir -p /usr/local/php
# cd php-5.3.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 \
  --with-xml=/usr/local/libxml2 \
  --with-png=/usr/local/lib  \
  --with-jpeg-dir=/usr/local/jpeg7 \
  --with-zlib=/usr/local/zlib \
  --with-freetype=/usr/local/freetype \
  --with-gd=/usr/local/gd2  \
  --enable-track-vars  \ 
  --enable-mbstring=allsql

若是發現如下問題,php編譯時檢查mysql時失敗!多是因爲mysql版本;
checking for mysql_close in -lmysqlclient… no
checking for mysql_error in -lmysqlclient… no
configure: error: mysql configure failed. Please check config.log for more information.數據庫

# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini
 
11.編輯apache配置文件httpd.conf
 
  # vi /etc/httpd/httpd.conf
  要改的有以下幾處:(若是編譯失敗,則不會出現php5一行)
  找到LoadModule php5_module modules/libphp5.so
  前面的#號去掉(默認已去掉註釋)
 
  找到#AddType application/x-gzip .gz .tgz,在其下添加以下二行
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps
 
  還有找到DirectoryIndex index.html
  改成DirectoryIndex index.php index.html
 
12.測試PHP
 
# vi /usr/local/apache/htdocs/index.php(其中/usr/local/apache/htdocs爲網頁主目錄)
  添加:
   <?
    phpinfo();
   ?>
 
測試PHP與數據庫的鏈接
   <?php
  $LINK=mysql_connect('127.0.0.1','root','');
 if ($LINK)
      echo "sucess..";
  else
    echo "Failure..";
?>
 apache

從新啓動apache服務器
# /usr/local/apache/bin/apachectl restart
 訪問:  http://你的主機IP地址
 
13.安裝ZendOptimizer-3.0.0-linux-glibc21-i386
 
#tar zxvf ZendOptimizer-3.0.0-linux-glibc21-i386.tar.gz
#cd ZendOptimizer-3.2.6
#./install.sh
接下去按提示輸入php.ini文件的位置等便可
 
2、安裝discuz5.5.0論壇
 
1.得到discuz5.5.0論壇源碼
下載地址爲:
http://www.discuz.net/download/download.html
建議下載使用簡體中文的GBK版本。
若是在安裝完之後,發現discuz爲亂碼或者英語,則在apache服務器,修改httpd.conf
修改 http.conf 中 默認語言爲 AddDefaultCharset   zh-CN瀏覽器

2.按其說明將upload文件夾中的文件上傳至網站根目錄中
此處應爲上文中的/usr/local/apache/htdocs
 
3.修改網站根目錄中相關文件的權限
#cd /usr/local/apache/htdocs
#chmod 777 config.inc.php
#chmod 777 uc_client/data/cache
#chmod 777 templates
#chmod 777 templates/default
#chmod 777 templates/default/*.*
#chmod 777 p_w_uploads
#chmod 777 customavatar (可能沒有這一項)
#chmod 777 forumdata
#chmod 777 forumdata/cache
#chmod 777 forumdata/templates
#chmod 777 forumdata/threadcaches
#chmod 777 forumdata/logs
 
4.修改全局配置文件
#vi config.inc.php
$dbhost = 'localhost';    //數據庫服務器,若是是本機,可不作更改
$dbuser = 'dbuser';       //數據庫用戶名,此處可改成root
$dbpw = 'dbpw';           //數據庫密碼,即以上用戶的密碼
$dbname = 'discuz';       //數據庫名
$adminemail = 'admin@your.com';  //論壇系統 Email
$dbreport = 0;            //是否發送數據庫錯誤報告? 0=否, 1=是
此處可先將其權限更改成666,爲了安全等論壇安裝完畢後再改成原權限
#chmod 666 config.inc.php
 
5.安裝論壇
在你的瀏覽器輸入如下地址便可實現安裝了安全

http://你的linux主機IP/install.php 或者http://你的linux主機IP/upload/install
   若是是採用rpm包安裝在也可採用,通常這須要修改http.conf便可
安裝腳本會檢查您的服務器系統環境、剩餘空間、數據庫環境,並具有必定的糾錯功能。
 
6.其它設置(在論壇管理中,爲了提示刪除install.php)
安全起見,安裝完成後最好刪除install.php文件,並將config.inc.php改成只讀
#rm -f install.php
#chmod 444 config.inc.php

 

-----------------------------------------------------------------------

圖:見附件