apt-get でパッケージをインストール。


# apt-get install tomcat4
(中略)
Installing /var/lib/tomcat4/webapps/ROOT/WEB-INF/web.xml.
Installing /var/lib/tomcat4/conf/tomcat-users.xml.
Installing /var/lib/tomcat4/conf/jk2.properties
Could not start Tomcat 4.1 servlet engine because no Java Development Kit
(JDK) was found. Please download and install JDK 1.3 or higher and set
JAVA_HOME in /etc/default/tomcat4 to the JDK's installation directory.

JDK が見つからないから Tomcat を起動できないと言われる。Java 1.5 SDK が入っているはずなのだが……

とりあえず tomcat4-webapps も入れておく。


# apt-get install tomcat4-webapps
(中略)
Unpacking tomcat4-webapps (from .../tomcat4-webapps_4.1.31-3_all.deb) ...
Setting up tomcat4-webapps (4.1.31-3) ...

# dpkg -l | grep tomcat
ii  libtomcat4-jav 4.1.31-3       Java Servlet engine -- core libraries
ii  tomcat4        4.1.31-3       Java Servlet 2.3 engine with JSP 1.2 support
ii  tomcat4-webapp 4.1.31-3       Java Servlet engine -- documentation and exa

JDK1.5のインストール場所を探す。


$ dpkg -L sun-j2sdk1.5 | head
/.
/usr
/usr/lib
/usr/lib/j2sdk1.5-sun
/usr/lib/j2sdk1.5-sun/jre
/usr/lib/j2sdk1.5-sun/jre/bin
/usr/lib/j2sdk1.5-sun/jre/bin/java
/usr/lib/j2sdk1.5-sun/jre/bin/keytool
/usr/lib/j2sdk1.5-sun/jre/bin/policytool
/usr/lib/j2sdk1.5-sun/jre/bin/kinit

$ dpkg -L sun-j2sdk1.5 | grep javac
/usr/lib/j2sdk1.5-sun/bin/javac
/usr/lib/j2sdk1.5-sun/man/man1/javac.1.gz
/usr/lib/j2sdk1.5-sun/man/ja_JP.eucJP/man1/javac.1.gz

設定ファイル /etc/default/tomcat4 を修正。


# cat /etc/default/tomcat4
# Run Tomcat 4 as this user ID (default: tomcat4). Set this to an empty string
# to prevent Tomcat from starting.
#TOMCAT4_USER=tomcat4
 
# The home directory of the Java development kit (JDK). You need at least
# JDK version 1.2, just the Java runtime environment (JRE) will not work
# because a Java compiler is needed to translate JavaServer Pages (JSP).
# If JAVA_HOME is not set, some common directories for the Sun, IBM and
# Blackdown packages prepared by the java-package utility and the Debian
# packages from Blackdown for j2sdk1.4 and j2sdk1.3 are tried. You can
# also set JSSE_HOME here to enable SSL support (this is automatically
# done for JDK 1.4+).
#JAVA_HOME=/usr/local/j2sdk1.4-sun
JAVA_HOME=/usr/lib/j2sdk1.5-sun
#JSSE_HOME=/usr/local/jsse
 
# Directory for per-instance configuration files and webapps. It contain the
# directories conf, logs, webapps, work and temp. See RUNNING.txt for details.
# Default: /var/lib/tomcat4
#CATALINA_BASE=/var/lib/tomcat4
 
# Arguments to pass to the Java virtual machine (JVM)
# "-Djava.awt.headless=true -Xmx128M" is automatically set if CATALINA_OPTS
# is left empty here
#CATALINA_OPTS="-Djava.awt.headless=true -Xmx128M -server"
CATALINA_OPTS="-Djava.awt.headless=true -Xmx256M -server"
 
# Java compiler to use for translating JavaServer Pages (JSPs). You can use all
# compilers that are accepted by Ant's build.compiler property.
#JSP_COMPILER=jikes
 
# Use the Java security manager? (yes/no, default: yes)
#TOMCAT4_SECURITY=yes
 
# Timeout in seconds for the shutdown procedure (default: 30). The Java
# processes will be killed if tomcat4 has not stopped until then.
#TOMCAT4_SHUTDOWN=30
 
# Number of days to keep old log files in /var/log/tomcat4 (default: 14)
#LOGFILE_DAYS=30

Tomcat を起動。


# /etc/init.d/tomcat4 start
Starting Tomcat 4.1 servlet engine using Java from /usr/lib/j2sdk1.5-sun: tomcat4.

ちなみに、Debian の Tomcat4 は、/etc/tomcat4/policy.d/ 以下にセキュリティ関係の設定ファイル ポリシファイル がある。

/etc/tomcat4/policy.d/01system.policy
/etc/tomcat4/policy.d/02debian.policy
/etc/tomcat4/policy.d/03catalina.policy
/etc/tomcat4/policy.d/04webapps.policy
/etc/tomcat4/policy.d/99examples.policy

/var/lib/tomcat4/conf/catalina.policy にもあるけど。

tags: zlashdot Linux Debian Tomcat

Posted by NI-Lab. (@nilab)