今天给客户移植了一套web系统,从原来的linux上移植到sun solaris上,web系统是基于apache+tomcat的。本来以为是很简单的事情,但是中间却遭遇了很多的挫折,看来IT行业没有很简单的事情。
1:登陆系统:
Last login: Fri May 25 10:19:40 2007 from 61.185.28.126
Sun Microsystems Inc. SunOS 5.9 Generic May 2002
$ su -
Password:
Sun Microsystems Inc. SunOS 5.9 Generic May 2002
IXDBA.NET社区论坛
# bash
bash-2.05# gcc
bash: gcc: command not found
经过检查,gcc确实没有安装,看来要先安装gcc编译器了。
2:安装gcc编译器
sun solaris下gcc的安装有两种方式,源码编译安装和sun提供的pkgadd方式。
为了方便期间,采用pkgadd方式安装,从http://www.sunfreeware.com/programlistsparc9.html下载
适合的gcc版本,我下载的是gcc-3.3.2-sol9-sparc-local.gz,安装如下:
bash-2.05#gunzip gcc-3.3.2-sol9-sparc-local.gz
bash-2.05#pkgadd gcc-3.3.2-sol9-sparc-local
在接下来的安装中,会有一个交互性安装过程。分别按照提示输入all,yes等即可。
3:安装apache
apache的安装也有两种方式,分别介绍;
源码安装:
http://www.sunfreeware.com/programlistsparc9.html下载适合的版本,
我下载的是httpd-2.0.59.tar.gz
bash-2.05#gunzip httpd-2.0.59.tar.gz
bash-2.05#tar xvf httpd-2.0.59.tar
bash-2.05#cd httpd-2.0.59
bash-2.05#./configure --prefix=/usr/local/apache2 \
--enable-mods-shared=all \
--enable-ssl=shared \
--enable-ssl --with-ssl=/usr/local/ssl \
--enable-proxy \
--enable-proxy-connect \
--enable-proxy-ftp \
--enable-proxy-http
bash-2.05#make
bash-2.05#make install
这样就完成了安装,
The modules that were compiled with this package can be found in /usr/local/apache2/modules。
pkgadd安装:
从http://www.sunfreeware.com/programlistsparc9.html下载适合的版本,
我下载的是apache-2.0.59-sol9-sparc-local.gz
由于是打包安装,会有很多的管理包必须安装,大概的关联如下;
This apache package was configured with openssl support. Dependencies: expat, libiconv,
gdbm, zlib, db-4.2.52.NC, openssl-0.9.8e, and you may need /usr/local/lib/libgcc_s.so.1
either from the libgcc-3.3 or gcc-3.3.2 or higher packages.
因此必须安装上面的所有关联包,apache才能正常的安装。expat, libiconv, gdbm, zlib, db-4.2.52.NC, openssl-0.9.8e,gcc-3.3.2等这些包可以从从http://www.sunfreeware.com/programlistsparc9.html下载,安装方式和apache安装相同,不再讲述。
下面开始安装apache
bash-2.05#gunzip apache-2.0.59-sol9-sparc-local.gz
bash-2.05#pkgadd -d apache-2.0.59-sol9-sparc-local
接下来,按照提示输入all,y等,完成安装
。
The configuration files in /usr/local/apache2/conf must be edited to fit your site's needs,
including ssl support. The httpd-std.conf there should be copied to httpd.conf and any edits
you must make included. Suggested special edits for httpd.conf include changing the line
4:jk模块安装
jk是连接apache+tomcat的调度器,可以编译产生相应的模块,也可以寻找bin方式的jk模块。
jk二进制版本安装
jk二进制版本下载
http://archive.apache.org/dist/jakarta/tomcat-connectors/jk2/binaries/
然后把jk2模块放入<apache-root-directory>/modules即可。
编译产生jk模块方法如下:
(1);从http://archive.apache.org/dist/jakarta/tomcat-connectors/jk2下载源码的jk
(2). Uncompress it and extract the tar file.
(3). cd to
jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2
(4). chmod u+x configure
(5). Run configure with:
./configure \
--with-apxs2=<apache-root-directory>/bin/apxs \
--with-tomcat41=<tomcat-root-directory> \
--with-java-home=<java-root-directory> \
--with-jni \
--with-pcre
For example:
./configure --with-apxs2=/home/apache/bin/apxs \
--with-tomcat41=/home/tomcat \
--with-java-home=/usr/java \
--with-jni \
--with-pcre
(6). Run make
(7). The two .so files (mod_jk2.so and jkjni.so) will be
in: jakarta-tomcat-connectors-jk2-2.0.2-src/jk/build/jk2/apache2
(8). Copy those to files to
<apache-root-directory>/modules with the proper permissions.
编译jk模块完毕。
编辑httpd.conf,在支持模块加载处添加类似:
LoadModule jk2_module modules/mod_jk2-2.0.43.so
5:启动apache+tomcat
在启动apache后,报出如下错误:
[Fri May 25 09:41:13 2007] [warn] pid file /usr/local/apache2/logs/httpd.pid overwritten --
Unclean shutdown of previous Apache run?
[Fri May 25 09:41:13 2007] [alert] (22)Invalid argument: setgid: unable to set group id to
Group 4294967295
[Fri May 25 09:41:13 2007] [alert] (22)Invalid argument: setgid: unable to set group id to
Group 4294967295
[Fri May 25 09:41:13 2007] [alert] (22)Invalid argument: setgid: unable to set group id to
Group 4294967295
[Fri May 25 09:41:13 2007] [alert] (22)Invalid argument: setgid: unable to set group id to
Group 4294967295
[Fri May 25 09:41:13 2007] [notice] Apache/2.0.59 (Unix) DAV/2 mod_jk2/2.0.2 configured --
resuming normal operations
[Fri May 25 09:41:13 2007] [alert] Child 12795 returned a Fatal error... Apache is exiting!
[Fri May 25 09:41:13 2007] [alert] (22)Invalid argument: setgid: unable to set group id to
Group 4294967295
[Fri May 25 09:46:43 2007] [notice] Digest: generating secret for digest authentication ...
[Fri May 25 09:46:43 2007] [notice] Digest: done
[Fri May 25 09:46:44 2007] [warn] pid file /usr/local/apache2/logs/httpd.pid overwritten --
Unclean shutdown of previous Apache run?
[Fri May 25 09:46:44 2007] [alert] (22)Invalid argument: setgid: unable to set group id to
Group 4294967295
[Fri May 25 09:46:44 2007] [alert] (22)Invalid argument: setgid: unable to set group id to
Group 4294967295
[Fri May 25 09:46:44 2007] [alert] (22)Invalid argument: setgid: unable to set group id to
Group 4294967295
[Fri May 25 09:46:44 2007] [alert] (22)Invalid argument: setgid: unable to set group id to
Group 4294967295
[Fri May 25 09:46:44 2007] [notice] Apache/2.0.59 (Unix) DAV/2 mod_jk2/2.0.2 configured --
resuming normal operations
[Fri May 25 09:46:44 2007] [alert] Child 12805 returned a Fatal error... Apache is exiting!
[Fri May 25 09:46:44 2007] [alert] (22)Invalid argument: setgid: unable to set group id to
Group 4294967295
[Fri May 25 09:50:49 2007] [notice] Digest: generating secret for digest authentication ...
经过检查,在httpd.conf文件中,一定要保证如下信息存在,
user nobody
group nogroup或者是group nobody
而httpd.conf文件在linux下,只存在这样的信息,
user nobody
Group #-1
即没有指定group组的信息,这种方式在linux下是可以的,但是转移到sun系统后,apache配置文件要变化一下。
6;安装mysql
从http://www.sunfreeware.com/programlistsparc9.html下载适当版本的mysql,然后安装方法与apache方法相同,不再说明。
配置系统,成功启动apache+tomcat,jk正常工作,应用启动正常,数据库连接正常,移植完毕。
If you have already been using apache2, MAKE SURE that you backup any files in the conf, htdocs, modules, or other subdirectories of /usr/local/apache2 where you might have changed or added files so that installing the updated apache2 will not cause your configuration or other files to be lost.