Linux下实战Tomcat安装配置

一.下载安装对应的jdk,并配置Java环境。

官网下载地址:

Oracle.com/technetwork/java/javase/downloads/jdk-6u26-download-400750.html

下载将jdk加压后放到/usr/local目录下:

[root@~]#chmod 755 jdk-6u5-linux-x64.bin

[root@~]# ./jdk-6u5-linux-x64.bin

[root@~]#mv jdk1.6.0_05 /usr/local

建立/usr/local/下的jdk软连接方便以后版本升级 :

[root@~]# ln -s /usr/local/jdk1.6.0_05/ /usr/local/jdk

配置环境变量:

在 /etc/profile 中加入以下内容:

JAVA_HOME=/usr/local/jdk1.6.0_05

JAVA_BIN=/usr/local/jdk1.6.0_05/bin

PATH=$PATH:$JAVA_BIN

CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export JAVA_HOME JAVA_BIN PATH CLASSPATH

保存退出

[root@~]source /etc/profile

查看java环境变量是否生效

[root@~]# java -version

java version "1.6.0_05"

Java(TM) SE Runtime Environment (build 1.6.0_05-b13)

Java HotSpot(TM) 64-Bit Server VM (build 10.0-b19, mixed mode)

测试成功

二.下载安装tomcat()

[root@~]# unzip apache-tomcat-6.0.30.zip

[root@~]# mv apache-tomcat-6.0.30/ /usr/local/

[root@~]cd /usr/local/

[root@]# ln -s /usr/local/apache-tomcat-6.0.30/ /usr/local/tomcat

[root@]# cd tomcat/bin/

[root@]#ls

[root@]#vim catalina.sh

添加以下内容:

CATALINA_HOME=/usr/local/apache-tomcat-6.0.30/

[root@]#chmod +x *.sh

三.启动tomcat服务器

[root@]# /usr/local/tomcat /bin/catalina.sh start

Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.30/

Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.30/

Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.30//temp

Using JRE_HOME:        /usr/local/jdk1.6.0_05

Using CLASSPATH:       /usr/local/apache-tomcat-6.0.30//bin/bootstrap.jar

[root@]# cd /usr/local/tomcat/logs/

[root@]# tail -f catalina.out

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Jul 4, 2011 11:06:57 AM org.apache.coyote.http11.Http11Protocol pause

INFO: Pausing Coyote HTTP/1.1 on http-8080

Jul 4, 2011 11:06:58 AM org.apache.catalina.core.StandardService stop

INFO: Stopping service Catalina

Jul 4, 2011 11:06:58 AM org.apache.coyote.http11.Http11Protocol destroy

INFO: Stopping Coyote HTTP/1.1 on http-8080

四.在浏览器中输入

:8080/(如果不是本机,则输入对应的ip地址)

测试出现tomcat页面则测试成功

五。添加应用,再次进行测试

在webapps目录下放测试包(注意:webaapps目录下面主要是放应用包的.war在tomcat重启访问后会自动解压

[root@]# pwd
/usr/local/tomcat/webapps

[root@]# tar -zxvf moni2.tar.gz

[root@]# ls
docs  examples  host-manager  manager
  moni2  moni2.tar.gz  ROOT

[root@]# /usr/local/tomcat/bin/catalina.sh start(重启tomcat)
Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.30/
Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.30/
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.30//temp
Using JRE_HOME:        /usr/local/jdk1.6.0_05
Using CLASSPATH:       /usr/local/apache-tomcat-6.0.30//bin/bootstrap.jar

在浏览器中输入如下地址:

:8080/moni2/

Linux下实战Tomcat安装配置

 六。修改tomcat的监听端口

[root@~]#  cd  /usr/local/tomcat/conf

[root@~]# ls

[root@~]# vim server.xml

<Server port="8005" shutdown="SHUTDOWN"> 停止tomcat时的端口】

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://127.0.0.1/wyypjd.html