java及tomcat环境配置
jdk环境搭建
[root@tyzz ~]# tar -zxvf jdk-8u91-linux-x64.tar.gz
[root@tyzz ~]# mv jdk1.8.0_91/ /usr/local/jdk1.8
[root@tyzz ~]# ln -s /usr/local/jdk1.8/ /usr/local/jdk
[root@tyzz ~]# vim /etc/profile
####################修改环境变量#############
vim /etc/profile.d/java.sh
---------------
JAVA_HOME=/usr/local/jdk1.8
JAVA_BIN=/usr/local/jdk1.8/bin
JRE_HOME=/usr/local/jdk1.8/jre
PATH=$PATH:/usr/local/jdk1.8/bin:/usr/local/jdk1.8/jre/bin
CLASSPATH=/usr/local/jdk1.8/jre/lib:/usr/local/jdk1.8/lib:/usr/local/jdk1.8/jre/lib/charsets.jar
-------------
根据自己的安装路径进行配置
. /etc/profile.d/java.sh 刷新生效
################################################
[root@tyzz local]# java -version #测试是否配置成功
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
tomcat环境配置
[root@tyzz ~]# tar -zxvf apache-tomcat-8.0.38.tar.gz
[root@tyzz ~]# mv apache-tomcat-8.0.38 /usr/local/tomcat-8.0
[root@tyzz ~]# ln -s /usr/local/tomcat-8.0/ /usr/local/tomcat
vim /etc/profile
####增加以下两行##########
export TOMCAT_HOME=/usr/local/tomcat
export CATALINA_HOME=/usr/local/tomcat
##########
[root@tyzz ~]# cd /usr/local/tomcat/bin/
[root@tyzz bin]# source /etc/profile
启动服务
[root@tyzz bin]# ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
查看进程:
[root@tyzz bin]# ps -aux|grep tomcat
root 11644 1.7 8.5 2176464 87076 pts/0 Sl 15:14 0:03 /usr/local/jdk/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start
root 11889 0.0 0.0 9032 672 pts/0 R+ 15:17 0:00 grep --color=auto tomcat
关闭服务
[root@tyzz bin]# ./shutdown.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar