记录服务器部署
以前的服务器过期了,重新买了部署,希望这次少踩点坑
服务器环境:Ubuntu 16.04 64位
服务器配置
重置密码&重启实例
添加安全组规则
https://help.aliyun.com/document_detail/151694.html?spm=a2c4g.11186623.6.582.56d15bbbDfXG8X
顺便把8000~9000都开了
终端访问
ssh连接
1
ssh root@<实例公网IP地址>
✌️
安装jdk和Tomcat
下载jdk-14.0.1_linux-x64_bin.tar.gz和apache-tomcat-9.0.34.tar.gz
https://www.oracle.com/java/technologies/javase-jdk14-downloads.html
(之前装的是jdk12,不知道这样会不会有毛病)
FileZilla连接服务器,上面两个包传到root文件夹下
回到终端,新建javaee文件夹,解压
1
2
3
4~# ls
apache-tomcat-9.0.34.tar.gz jdk-14.0.1_linux-x64_bin.tar.gz
~# mkdir javaee
~# tar zxvf jdk-14.0.1_linux-x64_bin.tar.gz -C javaee配置java环境变量
1
~# vim /etc/profile
最后加上
1
2
3# set java environment
export JAVA_HOME=/root/javaee/jdk-14.0.1
export PATH=$JAVA_HOME/bin:$PATH1
2
3
4
5~# source /etc/profile
~# java -version
java version "14.0.1" 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)✌️
安装tomcat
1
~# tar zxvf apache-tomcat-9.0.34.tar.gz -C javaee
配置catalina.sh
1
~/javaee/apache-tomcat-9.0.34/bin# vim /catalina.sh
加一句
1
export JAVA_HOME=/root/javaee/jdk-14.0.1
测试
1
2
3
4
5
6
7~/javaee/apache-tomcat-9.0.34/bin# ./startup.sh
Using CATALINA_BASE: /root/javaee/apache-tomcat-9.0.34
Using CATALINA_HOME: /root/javaee/apache-tomcat-9.0.34
Using CATALINA_TMPDIR: /root/javaee/apache-tomcat-9.0.34/temp
Using JRE_HOME: /root/javaee/jdk-14.0.1
Using CLASSPATH: /root/javaee/apache-tomcat-9.0.34/bin/bootstrap.jar:/root/javaee/apache-tomcat-9.0.34/bin/tomcat-juli.jar
Tomcat started.1
2
3
4
5
6
7~/javaee/apache-tomcat-9.0.34/bin# ./shutdown.sh
Using CATALINA_BASE: /root/javaee/apache-tomcat-9.0.34
Using CATALINA_HOME: /root/javaee/apache-tomcat-9.0.34
Using CATALINA_TMPDIR: /root/javaee/apache-tomcat-9.0.34/temp
Using JRE_HOME: /root/javaee/jdk-14.0.1
Using CLASSPATH: /root/javaee/apache-tomcat-9.0.34/bin/bootstrap.jar:/root/javaee/apache-tomcat-9.0.34/bin/tomcat-juli.jar
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED✌️
完工!
一遍过太快乐了