文章目录
安装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
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
3、cat服务器的启动和关闭
启动tomcat
进入tomcat服务器目录,然后执行"./bin/startup.sh"命令启动Tomcat服务器
关闭tomcat
进入tomcat服务器的bin目录,然后执行"./bin/shutdown.sh"命令启动Tomcat服务器
4、华为云耀云服务器配置
配置完毕后,对于华为云耀云,可以通过本地访问,安装w3m,使用
w3m http://localhost
但是远程访问仍旧无法访问
此时我们需要更改安全组配置,装系统时的默认只开放了3389和22端口。
我们在更改安全组里面,选择Sys-webserver,即可以通过远程正常访问。
通过IP访问后即能够正常打开。
安装w3m
sudo apt install w3m
打开网页
w3m www.baidu.com
w3m localhost:80