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的安裝和部署