标签:环境变量配置文件 变量 记录 net hotspot com tab profile 路径
tomcat介绍https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
[root@aaa src]# tar zxf jdk-8u181-linux-x64.tar.gz -C .
[root@aaa src]# mv jdk1.8.0_181/ /usr/local/jdk1.8
在/etc/profile系统环境变量文件最末尾中加入jdk的运行环境变量,使jdk安装路径和命令加载至系统内存中,这样就可以使用jdk的安装命令了,声明路径上需要对应自己解压保存jdk的目录进行配置
[root@aaa src]# vim /etc/profile
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
生效系统环境变量配置文件,并使用java -version命令查看java版本
[root@aaa src]# source /etc/profile
[root@aaa src]# java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
至此jdk的部分安装完成
安装tomcat
首先在官网下载相应的tomcat包http://tomcat.apache.org/
下载的tomcat包解压并移动到/usr/local/目录下,重命名为tomcat,完成这个步骤就可以启动tomcat服务啦!安装上是比较简单的
[root@aaa src]# tar zxf apache-tomcat-8.5.33.tar.gz -C .
[root@aaa src]# mv apache-tomcat-8.5.33 /usr/local/tomcat
启动tomcat服务并查看其运行的进程有无报错
[root@aaa src]# /usr/local/tomcat/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/jdk1.8
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@aaa src]# ps -aux |grep tomcat
root 19001 10.7 6.8 2268504 70024 pts/2 Sl 04:27 0:01 /usr/local/jdk1.8/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 -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -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 19018 0.0 0.0 112724 976 pts/2 S+ 04:28 0:00 grep --color=auto tomcat
tomcat服务会启动三个端口,其中8080为web端口可修改,8005为管理端口,8009为第三方服务调用端口,如httpd和tomcat结合使用时会用到
[root@aaa src]# netstat -ntlp |grep java
tcp6 0 0 :::8080 :::* LISTEN 19001/java ? ? ? ? ?
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 19001/java ? ? ? ? ?
tcp6 0 0 :::8009 :::* LISTEN 19001/java
查看tomcat是否能够正常访问,启动tomcat测试时注意关闭配置的iptables规则和selinux,以免访问不到而并非服务的原因
[root@aaa src]# curl -I 127.0.0.1:8080
HTTP/1.1 200
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Sat, 18 Aug 2018 20:35:45 GMT
至此tomcat也安装完毕,配置阶段之后会有记录
标签:环境变量配置文件 变量 记录 net hotspot com tab profile 路径
原文地址:http://blog.51cto.com/8844414/2166153