Tomcat的安装和部署



tomcat的安装和部署



1.安装java
# yum –y install java-1.8.0-openjdk //安装JDK
# yum -y install java-1.8.0-openjdk-headless //安装JDK
# java -version //查看JAVA版本


2.安装tomcat
首先下载软件包:apache-tomcat-8.0.30.tar.gz

解压:# tar -xf apache-tomcat-8.0.30.tar.gz
# mv apache-tomcat-8.0.30 /usr/local/tomcat 移动目录到指定路径【移动到哪旧安装在哪】
# ls /usr/local/tomcat
bin/ //主程序目录
lib/ //库文件目录
logs/ //日志目录
temp/ //临时目录
work/ //自动编译目录jsp代码转换servlet
conf/ //配置文件目录
webapps/ //页面目录


3.启动服务
# /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
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started. 【不需看提示判断是否启用服务】


4.查看服务启用情况:
# firewall-cmd --set-default-zone=trusted 【首先打开防火墙和selinux】
# setenforce 0

# ss -ntulp | grep java
tcp LISTEN 0 100 :::8080 :::* users:(("java",pid=1435,fd=46))
tcp LISTEN 0 1 ::ffff:127.0.0.1:8005 :::* users:(("java",pid=1435,fd=67))
tcp LISTEN 0 100 :::8009 :::* users:(("java",pid=1435,fd=51))


5.访问测试:
firefox http://192.168.2.100:8080 【出现猫的页面就代表服务启用成功】

若无法连接,可关闭后再次启动服务:
# /usr/local/tomcat/bin/shutdown.sh

# /usr/local/tomcat/bin/startup.sh


你可能感兴趣的:(Tomcat的安装和部署)