这里我安装的jdk版本为1.8版本,tomcat版本为8.5(请上官网下载)
运维开发技术交流群欢迎大家加入一起学习(QQ:722381733)
jdk部署:
1、前往软件所在路径
[root@web1 ~]# cd /package/
[root@web1 package]# ls
jdk-8u131-linux-x64.tar.gz
2、解压压缩包
[root@web1 package]# tar xf jdk-8u131-linux-x64.tar.gz [root@web1 package]# ls jdk1.8.0_131 jdk-8u131-linux-x64.tar.gz [root@web1 package]#
3、将解压后的文件移动到/usr/local/目录并创建软连接
[root@web1 package]# mv /package/jdk1.8.0_131/ /usr/local/ [root@web1 package]# ln -s /usr/local/jdk1.8.0_131/ /usr/local/jdk [root@web1 package]# cd /usr/local/ [root@web1 local]# ls bin etc games include jdk jdk1.8.0_131 lib lib64 libexec sbin share src
4、配置/etc/profile环境及遍历环境
[root@web1 local]# cat >>/etc/profile <<EOF > export JAVA_HOME=/usr/local/jdk1.8.0_131 > export PATH=$JAVA_HOME/bin:$PATH > EOF
[root@web1 local]# source /etc/profile
5、检查是否成功(都有输出表示成功)
[root@web1 local]# java [root@web1 local]# javac [root@web1 local]# java -version java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
tomcat部署:
1、前往软件所在路径
[root@web1 local]# cd /package/ [root@web1 package]# rz -E rz waiting to receive. [root@web1 package]# ls apache-tomcat-8.5.39.tar.gz jdk-8u131-linux-x64.tar.gz [root@web1 package]#
2、解压压缩包
[root@web1 package]# tar xf apache-tomcat-8.5.39.tar.gz [root@web1 package]# ls apache-tomcat-8.5.39 apache-tomcat-8.5.39.tar.gz jdk-8u131-linux-x64.tar.gz [root@web1 package]#
3、将解压后的文件移动到/usr/local/目录并创建软连接
[root@web1 package]# mv /package/apache-tomcat-8.5.39 /usr/local/ [root@web1 package]# ln -s /usr/local/apache-tomcat-8.5.39/ /usr/local/tomcat [root@web1 package]# cd /usr/local/ [root@web1 local]# ls apache-tomcat-8.5.39 bin etc games include jdk jdk1.8.0_131 lib lib64 libexec sbin share src tomcat [root@web1 local]#
4、再遍历环境环境
[root@web1 local]# source /etc/profile
5、启动tomcat
[root@web1 local]# /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.0_131 Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar Tomcat started.
6、检查下端口及进程
[root@web1 local]# lsof -i:8080 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME java 1421 root 49u IPv6 28867 0t0 TCP *:webcache (LISTEN) [root@web1 local]# ps -ef|grep tomcat root 1421 1 2 02:24 pts/0 00:00:02 /usr/local/jdk1.8.0_131/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 1471 1255 0 02:26 pts/0 00:00:00 grep --color=auto tomcat [root@web1 local]# netstat -lnutp|grep tomcat [root@web1 local]# netstat -lnutp|grep 8080 tcp6 0 0 :::8080 :::* LISTEN 1421/java
***在此就部署完成了,如有问题欢迎留言,当然工作环境建议使用普通用户来部署然后搭建sudo权限分配,但很多小中公司是直接使用的root权限的,看需求哈!***