学了FreeBSD有一周了吧,想起了自己用的Jsp,还说什么呢?来装一个环境吧!
1, 下载安装tomcat5.5的ports,如果已经有了可直接跳到第二步
先下载对应的ports,这里我装的是Tomcat5.5,因此我下载的是tomcta55(http://www.freebsd.org/cgi/cvsweb.cgi/ports/www/tomcat55/),放在/usr/ports/www下,然后用 tar zxvf jakarta-tomcat-~~.tar.gz 解压.
2,下载apache-tomcat-5.5.17.tar.gz(http://tomcat.apache.org)在/usr/ports/distfiles下.
3,在/usr/ports/www/tomcat55下执行make -v,提示:
===> Vulnerability check disabled, database not found
===> Extracting for tomcat-5.5.17_1
=> MD5 Checksum OK for apache-tomcat-5.5.17.tar.gz.
=> SHA256 Checksum OK for apache-tomcat-5.5.17.tar.gz.
===> Patching for tomcat-5.5.17_1
Installation settings:
Destination directory: /usr/local/tomcat5.5
Location of JDK: /usr/local/diablo-jdk1.5.0
Location of Java port: java/diablo-jdk15
Running as (user/group): www/www
HTTP port: 8180
Shutdown listener port: 8005
AJP 1.3 connector port: 8009
Logfile stdout: /usr/local/tomcat5.5/logs/stdout.log
Logfile stderr: /usr/local/tomcat5.5/logs/stderr.log
===> Applying FreeBSD patches for tomcat-5.5.17_1
>> Removing unneeded files... [ DONE ]
>> Customizing server.xml... [ DONE ]
===> Configuring for tomcat-5.5.17_1
4,在/usr/ports/www/tomcat55下执行make install,提示:
===> Installing for tomcat-5.5.17_1
===> tomcat-5.5.17_1 depends on file: /usr/local/diablo-jdk1.5.0/bin/java - found
===> Generating temporary packing list
===> Checking if www/tomcat55 already installed
>> Creating destination directory... [ DONE ]
>> Copying files to destination directory...
Installing local configuration file: /usr/local/tomcat5.5/conf/Catalina/localhost/host-manager.xml
Installing local configuration file: /usr/local/tomcat5.5/conf/Catalina/localhost/manager.xml
Installing local configuration file: /usr/local/tomcat5.5/conf/catalina.policy
Installing local configuration file: /usr/local/tomcat5.5/conf/catalina.properties
Installing local configuration file: /usr/local/tomcat5.5/conf/context.xml
Installing local configuration file: /usr/local/tomcat5.5/conf/logging.properties
Installing local configuration file: /usr/local/tomcat5.5/conf/server-minimal.xml
Installing local configuration file: /usr/local/tomcat5.5/conf/server.xml
Installing local configuration file: /usr/local/tomcat5.5/conf/tomcat-users.xml
Installing local configuration file: /usr/local/tomcat5.5/conf/web.xml
[ DONE ]
>> Creating log files... [ DONE ]
>> Creating symlink to tools.jar... [ DONE ]
>> Fixing ownership settings... [ DONE ]
>> Fixing permissions... [ DONE ]
Apache Tomcat 5.5.17 has been installed in /usr/local/tomcat5.5.
===> Installing rc.d startup script(s)
===> Registering installation for tomcat-5.5.17_1
5 执行make clean。
6 配置一些环境变量
对应不同的shell有不同的设法,这里用的是bash:
export JAVA_HOME=/usr/local/jdk1.5.0
export CATALINA_HOME=/usr/local/tomcat5.5
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
7,打开Tomcat服务
至Tomcat所在的目录,这里是/usr/local/tomcat5.5,可能你安装不在这个文件夹中,但应该是类似的,然后cd bin,运行startup.sh,你会看到类似的提示,表示成功:
Using CATALINA_BASE: /usr/local/tomcat5.5/
Using CATALINA_HOME: /usr/local/tomcat5.5/
Using CATALINA_TMPDIR: /usr/local/tomcat5.5//temp
Using JRE_HOME: /usr/local/diablo-jdk1.5.0/
注意要用root来启动此命令!
8 测试Tomcat是否工作正常
我这里用的端口是8180,所以打开网页http://127.0.0.1:8180,如果看到那个大猫了,那么,恭喜!
9 关闭Tomcat服务
同样的tomcat5.5/bin目录下,运行shutdown.sh,你会看到类似的提示,表示成功:
Using CATALINA_BASE: /usr/local/tomcat5.5/
Using CATALINA_HOME: /usr/local/tomcat5.5/
Using CATALINA_TMPDIR: /usr/local/tomcat5.5//temp
Using JRE_HOME: /usr/local/diablo-jdk1.5.0/
注意同样要用root来启动此命令!
至于如何进行自启动及与Apache配合使用,且听下回分解!