文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>slackware10.2+apache+tomcat+jk2

slackware10.2+apache+tomcat+jk2

时间:2006-07-31  来源:jiahaolin

今天在朋友的电脑上配置了APACHE+TOMCAT的环境,现在把基本的步骤公开一下.很多地方考虑得还不是很周全,不过是可以实现正常运行的.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

1.首先,安装SLACKWARE10.2,仅安装基本LINUX环境和开发工具,对于其他的服务均不安装.
2.下载Apache HTTP Server2.2.3,httpd-2.2.3.tar.gz
  Apache HTTP Server2.2.3的安装配置过程

  参考Apache安装文档:Compiling and Installing(http://httpd.apache.org/docs/2.2/install.html)
  安装过程基本概览

Download      $ lynx http://httpd.apache.org/download.cgi
Extract     $ gzip -d httpd-NN.tar.gz
$ tar xvf httpd-NN.tar
$ cd httpd-NN
Configure     $ ./configure --prefix=PREFIX
Compile     $ make
Install     $ make install
Customize     $ vi PREFIX/conf/httpd.conf
Test     $ PREFIX/bin/apachectl -k start

在这里,要指定prefix的路径.如果不指定,则默认是/user/local/apache2
解压tar.gz也可以使用tar -xvzf 命令.
对于tar.bz2可以使用tar -xvjf命令

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++在这里,主要是tar进行打包,然后调用gzip或bzip2来进行压缩或解压++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

对文件进行解压后,就要进行./configure操作了.

这里有几个参数:
--enable-module=shared:表示运行时动态挂载相应模块
--enable-rewrite=shared
--enable-speling=shared
因此,可以使用./configure --enable-so\
             --enable-module=shared \
             --enable-rewrite=shared \
             --enable-speling=shared
然后就可以make,然后 make install就可以完成基本的apache的配置了.

对于vi /user/local/apache2/conf/httpd.conf的相关操作,请阅读与APACHE的配置有关的文档.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Configuring the source tree

The next step is to configure the Apache HTTPd source tree for your particular platform and personal requirements. This is done using the script configure included in the root directory of the distribution. (Developers downloading an unreleased version of the Apache HTTPd source tree will need to have autoconf and libtool installed and will need to run buildconf before proceeding with the next steps. This is not necessary for official releases.)

To configure the source tree using all the default options, simply type ./configure. To change the default options, configure accepts a variety of variables and command line options.

The most important option is the location --prefix where the Apache HTTP Server is to be installed later, because Apache HTTPd has to be configured for this location to work correctly. More fine-tuned control of the location of files is possible with additional configure options.

Also at this point, you can specify which features you want included in Apache HTTPd by enabling and disabling modules. The Apache HTTP Server comes with a Base set of modules included by default. Other modules are enabled using the --enable-module option, where module is the name of the module with the mod_ string removed and with any underscore converted to a dash. You can also choose to compile modules as shared objects (DSOs) -- which can be loaded or unloaded at runtime -- by using the option --enable-module=shared. Similarly, you can disable Base modules with the --disable-module option. Be careful when using these options, since configure cannot warn you if the module you specify does not exist; it will simply ignore the option.

In addition, it is sometimes necessary to provide the configure script with extra information about the location of your compiler, libraries, or header files. This is done by passing either environment variables or command line options to configure. For more information, see the configure manual page.

For a short impression of what possibilities you have, here is a typical example which compiles Apache for the installation tree /sw/pkg/apache with a particular compiler and flags plus the two additional modules mod_rewrite and mod_speling for later loading through the DSO mechanism:

$ CC="pgcc" CFLAGS="-O2" \
./configure --prefix=/sw/pkg/apache \
--enable-rewrite=shared \
--enable-speling=shared

When configure is run it will take several minutes to test for the availability of features on your system and build Makefiles which will later be used to compile the server.

Details on all the different configure options are available on the configure manual page.
top
以上是关于安装的英文文档(原件)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
在这里,启动apache的操作是:$ PREFIX/bin/apachectl -k start
       停止apache的操作是:$ PREFIX/bin/apachectl -k stop
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
关于apache升级的操作
以下是英文原文文档
Upgrading

The first step in upgrading is to read the release announcement and the file CHANGES in the source distribution to find any changes that may affect your site. When changing between major releases (for example, from 1.3 to 2.0 or from 2.0 to 2.2), there will likely be major differences in the compile-time and run-time configuration that will require manual adjustments. All modules will also need to be upgraded to accomodate changes in the module API.

Upgrading from one minor version to the next (for example, from 2.2.55 to 2.2.57) is easier. The make install process will not overwrite any of your existing documents, log files, or configuration files. In addition, the developers make every effort to avoid incompatible changes in the configure options, run-time configuration, or the module API between minor versions. In most cases you should be able to use an identical configure command line, an identical configuration file, and all of your modules should continue to work.

To upgrade across minor versions, start by finding the file config.nice in the build directory of your installed server or at the root of the source tree for your old install. This will contain the exact configure command line that you used to configure the source tree. Then to upgrade from one version to the next, you need only copy the config.nice file to the source tree of the new version, edit it to make any desired changes, and then run:

$ ./config.nice
$ make
$ make install
$ PREFIX/bin/apachectl -k graceful-stop
$ PREFIX/bin/apachectl -k start
You should always test any new version in your environment before putting it into production. For example, you can install and run the new version along side the old one by using a different --prefix and a different port (by adjusting the Listen directive) to test for any incompatibilities before doing the final upgrade.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3.准备安装tomcat
    在这时,想安装tomcat,就要先安装jdk,我们选用稳定的j2sdk1.5.0_05版本,先下载相应JDK
    安装在目录/usr/local/jdk1.5.0_05下.
    然后vi /etc/profile
    添加
    #java
export JAVA_HOME=/usr/local/jdk1.5.0_0
#export CATALINA_BASE=/home/jiahaolin/jakarta-tomcat-5.0.28
#export CATALINA_HOME=/home/jiahaolin/jakarta-tomcat-5.0.28
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/jre:
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:/usr/local/share/texmf/bin:$PATH

#end java

比如,我的配置为:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# /etc/profile: This file contains system-wide defaults used by
# all Bourne (and related) shells.

# Set the values for some environment variables:
export MINICOM="-c on"
export MANPATH=/usr/local/man:/usr/man:/usr/X11R6/man
export HOSTNAME="`cat /etc/HOSTNAME`"
export LESSOPEN="|lesspipe.sh %s"
export LESS="-M"
export JAVA_HOME=/usr/local/jdk1.5.0_05
# If the user doesn't have a .inputrc, use the one in /etc.
if [ ! -r "$HOME/.inputrc" ]; then
  export INPUTRC=/etc/inputrc
fi

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games"

# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH.  Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
  echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
  if [ ! $? = 0 ]; then
    PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:/usr/local/share/texmf/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH
  fi
fi

# I had problems using 'eval tset' instead of 'TERM=', but you might want to
# try it anyway. I think with the right /etc/termcap it would work great.
# eval `tset -sQ "$TERM"`
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
 TERM=linux
fi

# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
  VISUAL=emacs
#  VISUAL=gmacs
#  VISUAL=vi
fi

# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
if [ "$SHELL" = "/bin/pdksh" ]; then
 PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
 PS1='! ${PWD/#$HOME/~}$ '
elif [ "$SHELL" = "/bin/zsh" ]; then
 PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
 PS1='$ '
else
 PS1='\u@\h:\w\$ '
fi
PS2='> '
export PATH DISPLAY LESS TERM PS1 PS2

# Default umask.  A umask of 022 prevents new files from being created group
# and world writable.
umask 022

# Set up the LS_COLORS and LS_OPTIONS environment variables for color ls:
if [ "$SHELL" = "/bin/zsh" ]; then
 eval `dircolors -z`
elif [ "$SHELL" = "/bin/ash" ]; then
 eval `dircolors -s`
else
 eval `dircolors -b`
fi

# Notify user of incoming mail.  This can be overridden in the user's
# local startup file (~/.bash.login or whatever, depending on the shell)
if [ -x /usr/bin/biff ]; then
 biff y
fi

# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
  if [ -x $profile_script ]; then
    . $profile_script
  fi
done
unset profile_script

# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
 PATH="$PATH:."
fi

#java

#export JAVA_HOME=/usr/local/jdk1.5.0_0
#export CATALINA_BASE=/home/jiahaolin/jakarta-tomcat-5.0.28
#export CATALINA_HOME=/home/jiahaolin/jakarta-tomcat-5.0.28
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/jre:
#export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:/usr/local/share/texmf/bin:$PATH

#end java

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
这时使用java和javac命令,如果一切正常,说明JAVA环境就可以使用了.
java -version
不过,要注意设置过环境变量后,LINUX主机要重启.

下面是安装tomcat.直接解压后设置环境变量就可以使用了.
我的安装路径为/var/apache-tomcat-5.5.17
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
slackware中的vim不好用的解决办法:
把/usr/bin/vim link到/usr/bin/vi。
然后再cp一个example_vimrc到~/.vimrc.然后就可以了.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

5.整合apache2.2.3与tomcat5.5.17

用连接器jakarta-tomcat-connectors-jk2-src-current.tar.gz(就是jk2),可到http://jakarta.apache.org/site/sourceindex.cgi下载
另外一个下载地址:http://www.apache.org/dist/tomcat/tomcat-connectors/jk2/

gunzip jakarta-tomcat-connectors-jk2-src-current.tar.gz
tar xvf jakarta-tomcat-connectors-jk2-src-current.tar
cd jakarta-tomcat-connectors-jk2-src-current/jk/native2
./configure --with-apxs2=/usr/local/apache2/bin/apxs (注意改为你的apache安装目录)
make
cd ../build/jk2/apache2
/usr/local/apache2/bin/apxs -n jk2 -i mod_jk2.so
现在大家可以看到mod_jk2.so文件已经在你的apache/modules/ 中了

编辑apache/conf/httpd.conf
LoadModule jk2_module modules/mod_jk2.so 保存

在apache/conf/中新建文件workers2.properties,内容为下(其中目录要改为你的目录)

[shm]
file=/usr/local/apache2/logs/shm.file
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Uri mapping
[uri:/*]
worker=ajp13:localhost:8009

保存后,就快大功告成啦.

cd apache2/bin
./apachectl start
相关阅读 更多 +
排行榜 更多 +
宝宝爱吃饭宝宝巴士

宝宝爱吃饭宝宝巴士

休闲益智 下载
空战风云汉化版

空战风云汉化版

飞行射击 下载
水晶糖果游戏下载

水晶糖果游戏下载

模拟经营 下载