重置服务器N次后,放弃官网教程
尝试安装JDK+Tomcat
服务器环境 Ubuntu 16.04 64位
- FileZilla连接服务器
官网下载安装FileZilla_3.43.0
填写公网IP、用户名、密码、端口
连接成功
- 上传文件
官网下载并上传:
jdk-12.0.1_linux-x64_bin.tar.gz
apache-tomcat-9.0.21-src.tar.gz
顺利上传
- 安装jdk
ssh连接到服务器
配置java环境变量
vi /etc/profile
![](https://i-blog.csdnimg.cn/blog_migrate/eb5e90f59664bfb5a8693aee9ed0d8b3.png)
# java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-5-jre-headless
* openjdk-8-jre-headless
* gcj-4.8-jre-headless
* gcj-4.9-jre-headless
* openjdk-9-jre-headless
Try: apt install <selected package>
没装上???
修改profile
# java -version
java version "12.0.1" 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)
成功
- 安装tomcat
解压到javaee
~/javaee/apache-tomcat-9.0.21-src/bin# vi catalina.sh
![](https://i-blog.csdnimg.cn/blog_migrate/eefc953a20688346a21fcf2e8ac7f3f9.png)
~/javaee/apache-tomcat-9.0.21-src/bin# ./startup.sh
Cannot find ./catalina.sh
The file is absent or does not have execute permission
This file is needed to run this program
这又是为什么???
改一下权限试试
~/javaee/apache-tomcat-9.0.21-src/bin# chmod 777 catalina.sh
:~/javaee/apache-tomcat-9.0.21-src/bin# ./startup.sh
Using CATALINA_BASE: /root/javaee/apache-tomcat-9.0.21-src
Using CATALINA_HOME: /root/javaee/apache-tomcat-9.0.21-src
Using CATALINA_TMPDIR: /root/javaee/apache-tomcat-9.0.21-src/temp
Using JRE_HOME: /root/javaee/jdk-12.0.1/jre
Using CLASSPATH: /root/javaee/apache-tomcat-9.0.21-src/bin/bootstrap.jar:/root/javaee/apache-tomcat-9.0.21-src/bin/tomcat-juli.jar
touch: cannot touch '/root/javaee/apache-tomcat-9.0.21-src/logs/catalina.out': No such file or directory
./catalina.sh: 467: ./catalina.sh: cannot create /root/javaee/apache-tomcat-9.0.21-src/logs/catalina.out: Directory nonexistent
手动touch一下
~/javaee/apache-tomcat-9.0.21-src# mkdir logs
~/javaee/apache-tomcat-9.0.21-src# touch /root/javaee/apache-tomcat-9.0.21-src/logs/catalina.out
再来
~/javaee/apache-tomcat-9.0.21-src/bin# ./startup.sh
Using CATALINA_BASE: /root/javaee/apache-tomcat-9.0.21-src
Using CATALINA_HOME: /root/javaee/apache-tomcat-9.0.21-src
Using CATALINA_TMPDIR: /root/javaee/apache-tomcat