CentOS安裝jdk和tomcat

來源:互聯網
上載者:User

標籤:build   move   star   mod   檢查   cat   second   roo   --   

1.查看是否已經安裝
java -version
2.卸載內建的openjdk
dnf remove java-1.7.0-openjdk
3.下載jdk安裝包
wget -c http://111.1.50.14/files/7194000006F691AA/download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.rpm
4.安裝
rpm -ivh jdk-8u181-linux-x64.rpm
5.檢查是否安裝成功
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)
6.下載tomcat
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.91/bin/apache-tomcat-7.0.91.tar.gz
7.解壓
tar zxf apache-tomcat-7.0.91.tar.gz -C /root/xxxx/
8.建立環境變數
vim /root/.bash_profile

添加以下內容:

 export CATALINA_HOME=/root/yuanweipeng/apache-tomcat-7.0.91 export PATH=$CATALINA_HOME/bin:$PATH:$HOME/bin
9.查看是否配置成功
catalina.sh -version

輸出一下:

commands:  debug             Start Catalina in a debugger  debug -security   Debug Catalina with a security manager  jpda start        Start Catalina under JPDA debugger  run               Start Catalina in the current window  run -security     Start in the current window with security manager  start             Start Catalina in a separate window  start -security   Start in a separate window with security manager  stop              Stop Catalina, waiting up to 5 seconds for the process to end  stop n            Stop Catalina, waiting up to n seconds for the process to end  stop -force       Stop Catalina, wait up to 5 seconds and then use kill -KILL if still running  stop n -force     Stop Catalina, wait up to n seconds and then use kill -KILL if still running  configtest        Run a basic syntax check on server.xml - check exit code for result  version           What version of tomcat are you running?    
10.啟動tomcat
catalina.sh start

輸出:

Tomcat started.
11.防火牆添加開放8080連接埠號碼
firewall-cmd --zone=public --add-port=8080/tcp --permanentpermanent參數代表重啟後有效
12.訪問服務
在本機瀏覽器中輸入ip:8080

CentOS安裝jdk和tomcat

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.