操作系統:CentOS5.5_x64
一、依賴包的安裝
yum -y install gcc gcc-c++ mysql mysql-devel autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel
二、安裝PHP-5.3.17
版本:5.3.17
下載:http://cn2.php.net/get/php-5.3.17.tar.gz/from/a/mirror
1、編譯安裝PHP所需要的支持庫:
- tar zxvf libiconv-1.13.1.tar.gz
- cd libiconv-1.13.1/
- ./configure --prefix=/usr/local
- make
- make install
- cd ../
- tar zxvf libmcrypt-2.5.8.tar.gz
- cd libmcrypt-2.5.8/
- ./configure
- make
- make install
- /sbin/ldconfig
- cd libltdl/
- ./configure --enable-ltdl-install
- make
- make install
- cd ../../
- tar zxvf mhash-0.9.9.9.tar.gz
- cd mhash-0.9.9.9/
- ./configure
- make
- make install
- cd ../
- ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
- ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
- ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
- ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
- ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
- ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
- ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
- ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
- ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
- ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
- tar zxvf mcrypt-2.6.8.tar.gz
- cd mcrypt-2.6.8/
- /sbin/ldconfig
- ./configure
- make
- make install
- cd ../
2、編譯安裝PHP
- tar zxvf php-5.3.17tar.gz
- cd php-5.3.17/
- ./configure --prefix=/app/php –with-mysql --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-pdo-mysql
- make ZEND_EXTRA_LIBS='-liconv'
- make install
- cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
- chmod o+x /etc/init.d/php-fpm
- chkconfig --add php-fpm
- cp /app/php/etc/php-fpm.conf.default /app/php/etc/php-fpm.conf
- cp php.ini-development /app/php/etc/php.ini
- cd ../
錯誤分析1:在configure的時候會報錯“configure: error: Cannot find ldap libraries in /usr/lib” 解決方法:cp -frp /usr/lib64/libldap* /usr/lib/
錯誤分析2:在configure是也可能出現這樣的錯誤“configure: error: mysql configure failed. Please check config.log for more information” 解決方法:這個libmysqlclient.a library實在/usr/lib64/mysql,不是在/usr/lib/mysql,所以可以這樣做 # export LDFLAGS=-L/usr/lib64/mysql
錯誤分析3:在make的時候會報錯“/app/mysql/include/mysql/my_sys.h:964:27: error: mysql/psi/psi.h: No such file or directory”解決方法:查詢/app/mysql/include/mysql下的文件,找到psi.h文件,我的psi.h文件就在mysql下面,然后vi /app /mysql/include/mysql/my_sys.h 找到“#include ” 把路徑改正確,由于我的psi.h就在mysql下面,所以前面的mysql/psi不需要加入
3、編譯安裝php擴展模塊
- tar zxvf memcache-2.2.5.tgz
- cd memcache-2.2.5/
- /app/php/bin/phpize
- ./configure --with-php-config=/app/php/bin/php-config
- make
- make install
- cd ../
- tar jxvf eaccelerator-0.9.6.1.tar.bz2
- cd eaccelerator-0.9.6.1/
- /app/php/bin/phpize
- ./configure --enable-eaccelerator=shared --with-php-config=/app/php/bin/php-config
- make
- make install
- cd ../
- tar zxvf PDO_MYSQL-1.0.2.tgz
- cd PDO_MYSQL-1.0.2/
- /app/php/bin/phpize
- ./configure --with-php-config=/app/php/bin/php-config --with-pdo-mysql=/app/mysql
- make
- make install
- cd ../
- tar zxvf ImageMagick.tar.gz
- cd ImageMagick-6.5.1-2/
- ./configure
- make
- make install
- cd ../
- tar zxvf imagick-2.3.0.tgz
- cd imagick-2.3.0/
- /app/php/bin/phpize
- ./configure --with-php-config=/app/php/bin/php-config
- make
- make install
- cd ../
4、修改php.ini文件
查找/app/php/etc/php.ini中的extension_dir = "./"修改為extension_dir = "/app/php/lib/php/extensions/no-debug-non-zts-20060613/",并在此行后增加以下幾行,然后保存:
extension = "memcache.so"
extension = "pdo_mysql.so"
extension = "imagick.so"
再查找output_buffering = Off,修改為output_buffering = On,再查找; cgi.fix_pathinfo=1,修改為cgi.fix_pathinfo=0,防止Nginx文件類型錯誤解析漏洞。
5、配置eAccelerator加速PHP:
mkdir -p /app/eaccelerator_cache
vi /app/php/etc/php.ini
按shift+g鍵跳到配置文件的最末尾,加上以下配置信息:
- 引用
- [eaccelerator]
- zend_extension="/app/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
- eaccelerator.shm_size="64"
- eaccelerator.cache_dir="/app/eaccelerator_cache"
- eaccelerator.enable="1"
- eaccelerator.optimizer="1"
- eaccelerator.check_mtime="1"
- eaccelerator.debug="0"
- eaccelerator.filter=""
- eaccelerator.shm_max="0"
- eaccelerator.shm_ttl="3600"
- eaccelerator.shm_prune_period="3600"
- eaccelerator.shm_only="0"
- eaccelerator.compress="1"
- eaccelerator.compress_level="9"
6、php啟動
/etc/init.d/php-fpm start
三、Nginx-1.2.4的安裝
版本:nginx-1.2.4
下載:http://nginx.org/en/download.html
- #tar –zxvf nginx-1.2.4.tar.gz
- #./configure --prefix=/app/nginx --with-pcre
- #make
- #make install
- #vi /app/nginx/conf/nginx.conf
- location / {
- root /app/forum/;
- index index.php;
- }
- location ~ /.php$ {
- root /app/forum;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
- include fastcgi.conf;
- }
- #/app/nginx/sbin/nginx 啟動NGINX
四、論壇的安裝
本論壇采用最新的Discuz!X2.5和UCenter_1.6.0版本,建立用于bbs論壇的數據庫及用戶:
- mysql –u root –p
- create database bbsdb;
- grant all on bbsdb.* to runbbs@localhost identified by ‘mypassword’;
- quit;
解壓兩個安裝包:unzip Discuz_X2.5_SC_UTF8.zip –d discuz
- cd discus
- mv upload /app/forum/bbs
- unzip UCenter_1.6.0_SC_UTF8.zip –d ucenter
- cd ucenter
- mv upload /app/forum/ucenter
修改權限和所屬組:cd /app/forum/
- chown –R nobody:nobody ./ucenter/
- chown –R nobody:nobody ./bbs/
- chmod –R 700 ./ucenter/
- chmod –R 700 ./bbs/
1、ucenter的安裝
進入ucenter的安裝界面:輸入 http://本機IP/ucenter/install/index.php 進入編輯界面,點擊我同意,進入下一步,這一步是對于環境、目錄文件的權限以及函數依賴性檢查,下一步,數據庫密碼為password,及grant all on bbsdb.* to runbbs@localhost identified by ‘mypassword’中單引號引起來的內容,下一步:安裝用戶中心成功,點擊進入下一步,如果驗證碼不清楚,請多刷新幾次,登錄
2、Discuz的安裝
輸入http://本地IP/bbs/install/index.php 進入discuz的安裝界面
目錄文件權限的檢查結果,必須每個都可以寫,下一步
如果你沒有安裝過discuz,選擇全新安裝,如果僅bbs升級,要保存原有的ucenter庫,手工指定UCenter Server的路徑
輸入相應的信息進入下一步
安裝過程,直接進入下一面一步
登錄界面,輸入用戶名:admin 密碼時你剛設置的密碼進入管理中心
點擊首頁,出現Please delete install/index.php via FTP,意思是讓刪除install/index.php這個安裝文件 #rm –rf /app/forum/bbs/install/index.php /app/nginx/sbin/nginx –s reload
論壇首頁 http://本地IP/bbs/forum.php
新聞熱點
疑難解答