Apache22 安装问题及解决

–>

前不久把FreeBSD系统从6.2升级到了7.0 ,后来由于忙着准备考试,一直没没空总结,今天终于有空了,把当时遇到的问题在这里总结一下和大家分享。

一、更新系统源码,为升级做准备
lab#cvsup -gL 2 -h cvsup.freebsdchina.org /usr/share/example/cvsup/stable-supfile

二、编译和安装系统与内核

lab# make buildworld
lab# make buildkernel
lab# make installkernel
lab# reboot
lab#mergemaster -p //对新的和旧的配置文件进行修改
lab# make installworld
lab# mergemaster
lab# shutdown -r now

嘿嘿,这次运气比较好,整个过程中没有出现问题,大概花了我一个小时以后就全部编译和安装好了,重启以后查看一下系统的信息:

lab# uname -a
FreeBSD lab.华侨大学.edu.cn 7.0-STABLE FreeBSD 7.0-STABLE #0: Wed Jun 4 15:36:24 CST 2008 kelly@lab.华侨大学.edu.cn (kelly@lab.%E5%8D%8E%E4%BE%A8%E5%A4%A7%E5%AD%A6.edu.cn):/usr/obj/usr/src/sys/GENERIC i386

哈哈,系统升级搞定了。其中 mergemaster 是一个很有用的脚本,它能够新建一个临时的系统环境,然后比较老的的新的配置文件的区别,提示你进行一些相应的操作。

四、安装软件兼容包
系统从6.2升级到7.0后会出现一些库文件的兼容问题,我们需要删除旧版的库文件,安装兼容包和更新软件来解决
lab#pkgdb -F
lab#portupgrade -ai

但是对Java的兼容问题一直解决不了,老是出现如下的错误

lab# java
/libexec/ld-elf.so.1: /lib/libpthread.so.2: version LIBTHREAD_1_0 required by /usr/local/diablo-jdk1.5.0/bin/java not found
lab# 

五、升级web站点软件

由于以前的apache 、mysql、php 等是使用源码编译安装的 ,这样升级很麻烦,而且FreeBSD提供了比较方便的ports机制 ,可以很方便的安装和升级软件(虽然现在还存在很多的问题),所以我决定这次把所有的软件都换到ports下面,首先吧原来安装的软件和配置文件全部删除 掉,这一点很重要,然后在进行下面的步骤:

(1)、升级ports
lab# cvsup -gL 2 -h cvsup.freebsdchina.org /usr/share/example/cvsup/ports-supfile

(2)、升级mysql
lab#cd /usr/ports/databases/mysql51-server
lab#make install clean 
等待十多分钟以后,就是下载、编译和安装好了,然后出现如下的提示:
。。。。。。。。。。。。。。。。
************************************************************************
install-info –quiet /usr/local/info/mysql.info /usr/local/info/dir
===> Installing rc.d startup script(s)
===> Compressing manual pages for mysql-server-5.0.45_1
===> Registering installation for mysql-server-5.0.45_1
===> SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/mysqld

This port has installed the following startup scripts which may cause
these network services to be started at boot time.
/usr/local/etc/rc.d/mysql-server

If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type \’make deinstall\’
to deinstall the port if this is a concern.

For more information, and contact details about the security
status of this software, see the following webpage:
MySQL :: The world\’s most popular open source database (http://www.mysql.com/)

从上面的提示我们可以看到:
masql 的启动脚本目录是:/usr/local/etc/rc.d/mysql-server start | stop
我们查看一下mysql正常工作了没有:

lab#/usr/local/etc/rc.d/mysql-server start
lab# netstat -an | grep 3306
tcp4 0 0 *.3306 *.* LISTEN

嘿嘿,这样就安装好了。

(3)、升级apache
lab#cd /usr/ports/www/apache22
lab#make config //选中对REWRITEHE 和MYSQL的支持,其他的模块根据需要选上。取消LDAP和AUTHNZ_LDAP 这两个模块的支持,要不编译的过程中会出现文件找不到的问题,我不知道那是什么原因,反正也用不到这两个认证模块,干脆把它取消了,呵呵。

配置好以后就开始编译和安装了:

lab#make install

正准备休息一下,没想到却出现了如下的错误:

http://file///C:/DOCUME%7E1/kelly/LOCALS%7E1/Temp/moz-screenshot.jpghttp://file///C:/DOCUME%7E1/kelly/LOCALS%7E1/Temp/moz-screenshot-1.jpghttp://file///C:/DOCUME%7E1/kelly/LOCALS%7E1/Temp/moz-screenshot-2.jpg。。。。。。。。。。。。。。。。。。。
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
===> Building for apache-2.2.8
Making all in srclib
Making all in os
Making all in unix
/usr/local/build-1/libtool –tag=CXX –mode=compile cc -O2-fno-strict-aliasing -pipe -I/usr/local/include/mysql -DHAVE_MYSQL_H-I/usr/include -g -I/usr/local/include -O2 -fno-strict-aliasing -pipe-I/usr/local/include/mysql -DHAVE_MYSQL_H -I/usr/include-I/usr/local/include -I.-I/usr/ports/www/apache22/work/httpd-2.2.8/os/unix-I/usr/ports/www/apache22/work/httpd-2.2.8/server/mpm/prefork-I/usr/ports/www/apache22/work/httpd-2.2.8/modules/http-I/usr/ports/www/apache22/work/httpd-2.2.8/modules/filters-I/usr/ports/www/apache22/work/httpd-2.2.8/modules/proxy-I/usr/ports/www/apache22/work/httpd-2.2.8/include-I/usr/ports/www/apache22/work/httpd-2.2.8/modules/generators-I/usr/ports/www/apache22/work/httpd-2.2.8/modules/mappers-I/usr/ports/www/apache22/work/httpd-2.2.8/modules/database-I/usr/local/include/apr-1 -I/usr/local/include/db42-I/usr/local/include-I/usr/ports/www/apache22/work/httpd-2.2.8/modules/proxy/../generators-I/usr/include -I/usr/ports/www/apache22/work/httpd-2.2.8/modules/ssl-I/usr/ports/www/apache22/work/httpd-2.2.8/modules/dav/main -c unixd.c&& touch unixd.lo
/usr/local/build-1/libtool: not found
*** Error code 127

Stop in /usr/ports/www/apache22/work/httpd-2.2.8/os/unix.
*** Error code 1

Stop in /usr/ports/www/apache22/work/httpd-2.2.8/os/unix.
*** Error code 1

Stop in /usr/ports/www/apache22/work/httpd-2.2.8/os.
*** Error code 1

Stop in /usr/ports/www/apache22/work/httpd-2.2.8.
*** Error code 1

Stop in /usr/ports/www/apache22.
*** Error code 1

Stop in /usr/ports/www/apache22.
lab# 

在google上搜了巨久,始终没找到答案,论坛里面讨论了N年也没得到答案,郁闷啊,仔细思考了一下尝试了一下操作:

lab#whereis libtool
lab#/usr/local/bin/libtool

这就很奇怪了,用于生成动态连接文件的libtool 明明在/usr/local/bin/目录下面,可是安装脚本为什么到/usr/local/build-1/目录下面区搜索呢,修改了一下Makefile文件还是不行。最后我尝试了一下如下的操作:

lab#mkdir /usr/local/build-1/
lab#cp /usr/local/bin/libtool /usr/local/build-1/
lab#make install

没想到这次竟然成功了,真不知道这是什么原因,有高手知道原因或者其他解决方法还希望跟帖赐教啊~~

安装完成以后出现如下的提示:
。。。。。。。。。。。。。。。。。。。。。。。。
ranlib /usr/local/libexec/apache22/mod_actions.a
———————————————————————-
Libraries have been installed in:
/usr/local/libexec/apache22

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR\’
flag during linking and do at least one of the following:
– add LIBDIR to the `LD_LIBRARY_PATH\’ environment variable
during execution
– add LIBDIR to the `LD_RUN_PATH\’ environment variable
during linking
– use the `-Wl,–rpath -Wl,LIBDIR\’ linker flag

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
———————————————————————-
/usr/local/build-1/libtool –tag=CXX –mode=install cp mod_speling.la /usr/local/libexec/apache22/
cp .libs/mod_speling.so /usr/local/libexec/apache22/mod_speling.so
cp .libs/mod_speling.lai /usr/local/libexec/apache22/mod_speling.la
cp .libs/mod_speling.a /usr/local/libexec/apache22/mod_speling.a
chmod 644 /usr/local/libexec/apache22/mod_speling.a
ranlib /usr/local/libexec/apache22/mod_speling.a
———————————————————————-

。。。。。。。。。。。。。。。。。。。。。。。。。。

d/instdso.sh /usr/local/share/apache22/build/instdso.sh
/usr/ports/www/apache22/work/httpd-2.2.8/build/install.sh -c -m 644 build/config_vars.out /usr/local/share/apache22/build/config_vars.mk
Installing man pages and online manual
mkdir /usr/local/share/doc/apache22
To run apache www server from startup, add apache22_enable=”YES”
in your /etc/rc.conf. Extra options can be found in startup script.
===> Installing rc.d startup script(s)
===> Compressing manual pages for apache-2.2.8
===> Registering installation for apache-2.2.8
===> SECURITY REPORT: 
This port has installed the following binaries which execute with
increased privileges.
/usr/local/××××in/suexec

This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/apache22/mod_cgid.so

This port has installed the following startup scripts which may cause
these network services to be started at boot time.
/usr/local/etc/rc.d/apache22
/usr/local/etc/rc.d/htcacheclean

If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type \’make deinstall\’
to deinstall the port if this is a concern.

For more information, and contact details about the security
status of this software, see the following webpage: 
Welcome! – The Apache HTTP Server Project (http://httpd.apache.org/)
lab# make clean
===> Cleaning for apache-2.2.8

然后启动apache服务:
lab# /usr/local/etc/rc.d/apache22 start
lab#netstat -an 
查看端口,却发现80端口并为开启,查看了一下apache的日志发现如下错误:
[Wed Jan 31 04:12:56 2007] [warn] (2)No such file or directory: Failed to enable the \’httpready\’ Accept Filter

在网上查了一下才知道,出现该问题的原因,是因为系统没有加载accf_http.ko和accf_data.ko ,这两个模块的功能是用于检测请求的数据是否完整,否则抛弃,防止客户端恶意请求。解决方法如下:

lab#cd /usr/src/sys/modules/accf_data;make clean;make;make install;make clean;kldload accf_data
lab#cd /usr/src/sys/modules/accf_http;make clean;make;make install;make clean;kldload accf_http
lab#ee /etc/rc.conf

然后加入一下的配置:
accf_data_load=”YES”
accf_http_load=”YES”
apache22_enable=”YES”
apache22_http_accept_enable=”YES”

然后重启apache就搞定了

(3)、升级php和拓展
lab#cd /usr/ports/lang/php5
lab#make config 
然后选择对apache的支持,然后取消补丁SUHOSIN ,它虽然加强了php的安装性,可是好多php代码都通不过的他检测结果运行不起来,大家也可以权衡利弊选择,我是抛弃他了,呵呵。还有要记得取消 Debug的选中,否则后面安装的Zend Optmizer 运行不起来,这一点我也是安装好以后才知道的。。。。
好了,配置好以后我们就开始编译和安装了:
lab#make install

安装以后出现如下提示:
==> Installing for php5-5.2.6
===> php5-5.2.6 depends on file: /usr/local/××××in/apxs – found
===> php5-5.2.6 depends on executable: pkg-config – found
===> php5-5.2.6 depends on shared library: xml2.5 – found
===> Generating temporary packing list
===> Checking if lang/php5 already installed
“Makefile”, line 588: warning: duplicate script for target “main/internal_functions.lo” ignored
Installing PHP SAPI module: apache2handler
/usr/local/share/apache22/build/instdso.sh SH_LIBTOOL=\’/usr/local/build-1/libtool\’ libphp5.la /usr/local/libexec/apache22
/usr/local/build-1/libtool –mode=install cp libphp5.la /usr/local/libexec/apache22/
cp .libs/libphp5.so /usr/local/libexec/apache22/libphp5.so
cp .libs/libphp5.lai /usr/local/libexec/apache22/libphp5.la
libtool: install: warning: remember to run `libtool –finish /usr/ports/lang/php5/work/php-5.2.6/libs\’
chmod 755 /usr/local/libexec/apache22/libphp5.so
[activating module `php5\’ in /usr/local/etc/apache22/httpd.conf]
Installing PHP CLI binary: /usr/local/bin/
Installing PHP CLI man page: /usr/local/man/man1/
Installing PHP CGI binary: /usr/local/bin/
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
***************************************************************

Make sure index.php is part of your DirectoryIndex.

You should add the following to your Apache configuration file:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

***************************************************************
===> Compressing manual pages for php5-5.2.6
===> Registering installation for php5-5.2.6
===> SECURITY REPORT: 
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/apache22/libphp5.so
/usr/local/bin/php
/usr/local/bin/php-cgi

If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type \’make deinstall\’
to deinstall the port if this is a concern.

For more information, and contact details about the security
status of this software, see the following webpage: 
PHP: Hypertext Preprocessor (http://www.php.net/)
lab# make clean

然后根据他的提示配置一下/usr/local/etc/apache22/httpd.conf 在重启一下apache就OK了
最后安装php的拓展

lab#cd /usr/ports/lang/php5-extensions
lab#make config
选中对mysql mysqli等常用模块的支持,然后开始编译和安装:
lab#make install
lab#make clean

之后重启apache却发现apache启动不了了,又是一阵狂搜以后找到了解决方法:
lab#ee /usr/local/etc/php/extensions.ini
然后取消对 recode.so 模块的支持,重启apache就好了。

四、安装ZendOptimizer
首先下载和解压ZendOptimizer-3.3.0a-freebsd6.0-i386.tar.gz
lab#tar -zxvf ZendOptimizer-3.3.0a-freebsd6.0-i386.tar.gz
lab#cd ZendOptimizer-3.3.0a-freebsd6.0-i386
ab# ./install.sh
Please, wait …

Zend Optimizer installation was NOT completed successfully.

File: ./dialog does not exist!

For further assistance, please contact Zend Support at
https://www.zend.com/support/
[To continue, press Enter]

嘿嘿,怎么有出错误啊,郁闷,有查了一下才知道,这是该软件的一个buge ,改用如下安装方法就OK了,
lab# ./install-tty
然后根据提示,一步一步就搞定了。

五、升级discuz和supesite
论坛部分很容易,重新导入数据库文件、删除临时文件和缓存文件以及配置合适的文件权限就搞定了,可是空间部分网页却一直显示不了,网上查了一下,发现好多 同志在Freebsd上从ports安装php以后都遇到了这样的问题,而且官方也没有解决的方法,没办法,只好重新下载php的代码来编译安装。搞定以 后却发现一下两个问题:
(1)、空间成功登陆却无法进入
(2)、空间页面显示出现乱码

重新设置了Cookies域和数据库字符集就搞定了。

参考文章:
FreeBSD Handbook (http://www.freebsd.org/doc/en/books/handbook/)
[url=http://*.chinaunix.net/system/bsd/2005-10-27/3785.shtml]FREEBSD

原文链接:https://www.cnblogs.com/apexchu/archive/2010/10/16/1852905.html
本文来源 互联网收集,文章内容系作者个人观点,不代表 本站 对观点赞同或支持。如需转载,请注明文章来源,如您发现有涉嫌抄袭侵权的内容,请联系本站核实处理。

© 版权声明

相关文章