歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

linux下tomcat安裝配置

一、下載安裝對應的jdk,並配置java環境
官方下載:http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u26-download-400750.html
下載將jdk加壓後放到/usr/local目錄下: [root@master ~]#chmod 755 jdk-6u5-linux-x64.bin[root@master ~]# ./jdk-6u5-linux-x64.bin[root@master ~]#mv jdk1.6.0_05 /usr/local建立/usr/local/下的jdk軟連接方便以後版本升級 : [root@master ~]# ln -s /usr/local/jdk1.6.0_05/ /usr/local/jdk配置環境變量:在 /etc/profile 中加入以下內容:JAVA_HOME=/usr/local/jdk1.6.0_05JAVA_BIN=/usr/local/jdk1.6.0_05/binPATH=$PATH:$JAVA_BINCLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport JAVA_HOME JAVA_BIN PATH CLASSPATH保存退出[root@master ~]source /etc/profile查看java環境變量是否生效[root@master ~]# java -versionjava 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(http://tomcat.apache.org/)[root@master ~]# unzip apache-tomcat-6.0.30.zip[root@master ~]# mv apache-tomcat-6.0.30/ /usr/local/[root@master ~]cd /usr/local/[root@master local]# ln -s /usr/local/apache-tomcat-6.0.30/ /usr/local/tomcat[root@master local]# cd tomcat/bin/[root@master bin]#ls[root@master bin]#vim catalina.sh添加以下內容:CATALINA_HOME=/usr/local/apache-tomcat-6.0.30/[root@master local]#chmod +x *.sh三.啟動tomcat服務器[root@master tomcat]# /usr/local/tomcat /bin/catalina.sh startUsing 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//tempUsing JRE_HOME: /usr/local/jdk1.6.0_05Using CLASSPATH: /usr/local/apache-tomcat-6.0.30//bin/bootstrap.jar[root@master logs]# cd /usr/local/tomcat/logs/[root@master logs]# 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 pauseINFO: Pausing Coyote HTTP/1.1 on http-8080Jul 4, 2011 11:06:58 AM org.apache.catalina.core.StandardService stopINFO: Stopping service CatalinaJul 4, 2011 11:06:58 AM org.apache.coyote.http11.Http11Protocol destroyINFO: Stopping Coyote HTTP/1.1 on http-8080四.在浏覽器中輸入http://localhost:8080/(如果不是本機,則輸入對應的ip地址)測試出現tomcat頁面則測試成功ps:需要說明的是tomcat的默認測試頁面是放在webapps下面,這個其實是在server.xml文件中配置的,如下所示:<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">[root@SOR_SYS apache-tomcat-6.0.30]# ls
LICENSE NOTICE RELEASE-NOTES RUNNING.txt bin conf lib logs temp webapps work

1)webapps文件夾主要用於web應用程序部署,比如你可以把你的應用程序包,如war文件拷到該目錄下,容器會自動部署。
  2)conf文件夾下主要是放置tomcat的服務器的相關配置文件
Copyright © Linux教程網 All Rights Reserved