【雲服務器】ubuntu18.04系統的TOMCAT項目部署

安裝JAVA JDK1.8

環境信息:
OS:Ubuntu18.04
JDK:1.8

1、查看ubuntu版本

root@VM-0-12-ubuntu:/usr# uname -a
Linux VM-0-12-ubuntu 4.15.0-88-generic #88-Ubuntu SMP Tue Feb 11 20:11:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

2、下載對應的jdk8

https://pan.baidu.com/s/1EphlSzhD9uyq5XmMu34h6A 提取碼: 554m

3、建立一個目錄,把文件傳輸過去,解壓縮

tar -zxvf jdk-8u221-linux-x64.tar.gz

4、移動到/usr/local/jdk1.8目錄

sudo mv jdk1.8.0_221 /usr/local/jdk1.8

5、設置環境變量

nano /etc/profile

6、在文件末尾加入

export JAVA_HOME=/usr/local/jdk1.8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=.:${JAVA_HOME}/bin:$PATH

7、使配置生效

source /etc/profile

8、檢查是否安裝正常

root@VM-0-12-ubuntu:/usr# java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)

9、輸入javac出現有提示

root@VM-0-12-ubuntu:/usr# javac
Usage: javac <options> <source files>
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  -nowarn                    Generate no warnings
  -verbose                   Output messages about what the compiler is doing
  -deprecation               Output source locations where deprecated APIs are used
  -classpath <path>          Specify where to find user class files and annotation processors
  -cp <path>                 Specify where to find user class files and annotation processors
  -sourcepath <path>         Specify where to find input source files
  -bootclasspath <path>      Override location of bootstrap class files
  -extdirs <dirs>            Override location of installed extensions
  -endorseddirs <dirs>       Override location of endorsed standards path
  -proc:{none,only}          Control whether annotation processing and/or compilation is done.
  -processor <class1>[,<class2>,<class3>...] Names of the annotation processors to run; bypasses default discovery process
  -processorpath <path>      Specify where to find annotation processors
  -parameters                Generate metadata for reflection on method parameters
  -d <directory>             Specify where to place generated class files
  -s <directory>             Specify where to place generated source files
  -h <directory>             Specify where to place generated native header files
  -implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files
  -encoding <encoding>       Specify character encoding used by source files
  -source <release>          Provide source compatibility with specified release
  -target <release>          Generate class files for specific VM version
  -profile <profile>         Check that API used is available in the specified profile
  -version                   Version information
  -help                      Print a synopsis of standard options
  -Akey[=value]              Options to pass to annotation processors
  -X                         Print a synopsis of nonstandard options
  -J<flag>                   Pass <flag> directly to the runtime system
  -Werror                    Terminate compilation if warnings occur
  @<filename>                Read options and filenames from file

root@VM-0-12-ubuntu:/usr#

安裝Tomcat

環境信息:
OS:Ubuntu18.04
JDK:1.8
Tomcat: 9.0.35

1、下載Tomcat

根據自己系統,下載相應版本Tomcat,這兒下載tar.gz

https://tomcat.apache.org/download-90.cgi

image-20200522201633494

2、安裝配置

把tomcat傳到服務器上

tar -zxvf apache-tomcat-9.0.35.tar.gz

移動到/usr/local/目錄下

sudo mv apache-tomcat-9.0.35 /usr/local/apache-tomcat-9.0.35

進入apache目錄,修改tomcat服務器的啓動端口,修改爲自己想要的端口,改爲80的話,訪問網頁的時候就不需要加端口號,這兒建議大家使用80端口

root@VM-0-12-ubuntu:/usr/local/apache-tomcat-9.0.35# nano conf/server.xml

image-20200522205522742

3、cat服務器的啓動和關閉

啓動tomcat

進入tomcat服務器目錄,然後執行"./bin/startup.sh"命令啓動Tomcat服務器

關閉tomcat

進入tomcat服務器的bin目錄,然後執行"./bin/shutdown.sh"命令啓動Tomcat服務器

image-20200522211053133

4、華爲雲耀雲服務器配置

配置完畢後,對於華爲雲耀雲,可以通過本地訪問,安裝w3m,使用

w3m http://localhost

但是遠程訪問仍舊無法訪問

此時我們需要更改安全組配置,裝系統時的默認只開放了3389和22端口。

我們在更改安全組裏面,選擇Sys-webserver,即可以通過遠程正常訪問。

image-20200620154845227
通過IP訪問後即能夠正常打開。
在這裏插入圖片描述

安裝w3m

 sudo apt install w3m

打開網頁

w3m www.baidu.com
w3m localhost:80
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章