[Virtual Machine]CentOS7基本配置--安装Apache Tomcat

1.下载Apache Tomcat

点击打开链接

2.安装

scp /Users/xxx/Downloads/apache-tomcat-8.5.31.tar.gz root@192.168.xx.xxx:/usr/local/src
[root@localhost src]# tar -zxvf apache-tomcat-8.5.31.tar.gz -C /usr/local
[root@localhost apache-tomcat-8.5.31]# /usr/local/apache-tomcat-8.5.31/bin/startup.sh

返回

Using CATALINA_BASE:   /usr/local/apache-tomcat-8.5.31
Using CATALINA_HOME:   /usr/local/apache-tomcat-8.5.31
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.5.31/temp
Using JRE_HOME:        /usr/local/java/jdk-10.0.1
Using CLASSPATH:       /usr/local/apache-tomcat-8.5.31/bin/bootstrap.jar:/usr/local/apache-tomcat-8.5.31/bin/tomcat-juli.jar
Tomcat started.

检查是否启动成功

[root@localhost apache-tomcat-8.5.31]# ps -ef | grep tomcat

开放端口8080

3.配置

vi /etc/profile

添加

#tomcat environment
export CATALINA_HOME=/usr/local/apache-tomcat-8.5.31

export PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib:$CATALINA_HOME/lib

使修改生效

source /etc/profile

使Tomcat成为系统服务

[root@localhost ~]# cp /usr/local/apache-tomcat-8.5.31/bin/catalina.sh /etc/init.d/tomcat
[root@localhost ~]# vi /etc/init.d/tomcat

#!/bin/sh 下添加

# chkconfig: 2345 90 15
# description: Tomcat -en Manager

# ----------------------------------------------------------------------------- 下添加

JAVA_HOME=/usr/local/java/jdk-10.0.1
CATALINA_HOME=/usr/local/apache-tomcat-8.5.31

保存退出

[root@localhost ~]# chkconfig --add tomcat
[root@localhost ~]# service tomcat start
返回
Using CATALINA_BASE:   /usr/local/apache-tomcat-8.5.31
Using CATALINA_HOME:   /usr/local/apache-tomcat-8.5.31
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.5.31/temp
Using JRE_HOME:        /usr/local/java/jdk-10.0.1/
Using CLASSPATH:       /usr/local/apache-tomcat-8.5.31/bin/bootstrap.jar:/usr/local/apache-tomcat-8.5.31/bin/tomcat-juli.jar
Tomcat started.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值