1.yum安裝:java
環境:
[root@Centos6 ~ 53]#uname -a
Linux Centos6.9.kiss 2.6.32-696.el6.x86_64 #1 SMP Tue Mar 21 19:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linuxweb
主要程序包:apache
JDK:vim
yum install
java-1.7.0-openjdk.x86_64
java-1.7.0-openjdk-devel.x86_64 tomcat
tomcat:app
yum install
tomcat
tomcat-lib
tomcat-admin-webapps
tomcat-docs-webapp
tomcat-webappswebapp
注意:tomcat的包裝不全,主頁是打不開的;安裝完成後,要配置JAVA_HOME環境變量,指向java的安裝路徑;ide
OpenJDK:
JAVA_HOME=/usr #指明JAVA的安裝路徑
Oracle JDK:
JAVA_HOME=/usr/java/jdk_VERSIONdebug
yum安裝的方式比較"傻瓜"等待安裝完畢啓動服務便可.日誌
固然安裝以前先安裝openjdk下面是官方下載的tomcat的二進制源包;
Tomcat binary release:
tar xf apache-tomcat-VERSION.tar.gz -C /usr/local/
cd /usr/local
ln -sv apache-tomcat-VERSION tomcat //此步強烈建議建立連接訪問方便並且升級的時候也很方便
導出環境變量:
vim /etc/profile.d/tomcat.sh
export CATALINA_BASE=/usr/local/tomcat
export PATH=$CATALINA_BASE/bin:$PATH
建立用戶
爲tomcat建立一個系統用戶
useradd -r tomcat -s /sbin/nologin
tomcat程序環境:
tomcat的目錄結構
bin:腳本,及啓動時用到的類;
conf:配置文件目錄;
lib:庫文件,Java類庫,jar;
logs:日誌文件目錄;
temp:臨時文件目錄;
webapps:webapp的默認目錄;
work:工做目錄,存放編譯後的字節碼文件;
幫助:
catalina.sh --help
debug Start Catalina in a debugger
debug -security Debug Catalina with a security manager
jpda start Start Catalina under JPDA debugger
run Start Catalina in the current window
run -security Start in the current window with security manager
start Start Catalina in a separate window
start -security Start in a separate window with security manager
stop Stop Catalina, waiting up to 5 seconds for the process to end
stop n Stop Catalina, waiting up to n seconds for the process to end
stop -force Stop Catalina, wait up to 5 seconds and then use kill -KILL if still running
stop n -force Stop Catalina, wait up to n seconds and then use kill -KILL if still running
configtest Run a basic syntax check on server.xml - check exit code for result
version What version of tomcat are you running?
rpm包安裝的程序環境:
配置文件目錄:/etc/tomcat主配置文件:server.xml webapps存放位置:/var/lib/tomcat/webapps/examplesmanagerhost-managerdocsUnit File:tomcat.service環境配置文件:/etc/sysconfig/tomcat