安装JDK
了解当前的java环境:
~]# java -version
OpenJDK:
java-VERSION-openjdk:
The OpenJDK runtime environment.
java-VERSION-openjdk-headless:
The OpenJDK runtime environment without audio and video support.
java-VERSION-openjdk-devel:
The OpenJDK development tools.
CentOS 7:
VERSION:1.6.0, 1.7.0, 1.8.0
注意:多版本并存时,可使用 alternatives命令设定默认使用的版本;
Oracle JDK:
安装相应版本的rpm包;
jdk-VERSION-OS-ARCH.rpm
例如:jdk-1.8.0_25-linux-x64.rpm
注意:安装完成后,要配置JAVA_HOME环境变量,指向java的安装路径;
OpenJDK:
JAVA_HOME=/usr #指明JAVA的安装路径
Oracle JDK:
JAVA_HOME=/usr/java/jdk_VERSION
安装Tomcat:
tomcat已经被收录到Base源中,直接挂在本地的ISO文件;或者连接到epel源这里简单配置下epel源:
执行:
yum install -y epel-release 直接安装epel源省去写文件.
下面是tomcat的主要包:
Base Repo:
yum install -y tomcat tomcat-lib tomcat-admin-webapps tomcat-webapps tomcat-docs-webapp
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程序环境:
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/
examples
manager
host-manager
docs
Unit File:tomcat.service
环境配置文件:/etc/sysconfig/tomcat
原文地址:http://blog.51cto.com/37003839/2088200