Discuz!X2.5和UCenter_1.6.0
操作系统: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