Foreword
oracle official website to download jdk need to log online method has been carrying the cookie is not available, I put myself into the jdk download on your own server, there is a need can be downloaded directly.
Download http://149.129.124.185:8080/download/jdk-8u181-linux-x64.tar.gz
First, install jdk
1. wget command to download jdk
wget http://149.129.124.185:8080/download/jdk-8u181-linux-x64.tar.gz
2.tar command to extract. Novice Note: To store the path jdk
tar -zxf jdk-8u181-linux-x64.tar.gz
3. Go to the jdk bin directory, check availability
cd jdk1.8.0_181/bin
./java -version
4. Configuration jdk environment variable. Novice Note: Be sure to source
cd ../
pwd
Edit the file vim / etc / profile to save the file command: wq!
# 配置java路径
export JAVA_HOME=/root/JAVA/jdk1.8.0_181
export PATH=$JAVA_HOME/bin:$PATH
export JRE_HOME=/root/JAVA/jdk1.8.0_181/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
Be sure to remember the source source / etc / profile
5. In any directory java -version to check whether success
java -version
Second, the installation tomcat8
1. By wget command to download
wget http://149.129.124.185:8080/download/apache-tomcat-8.5.41.tar.gz
2.tar 命令解压,并且重命名一下。新手注意路径
tar -zxf apache-tomcat-8.5.41.tar.gz
重命名:名字可以任意,也可以不重命名
mv apache-tomcat-8.5.41 tomcat8080
3.进入tomcat8080的bin目录下查看是否能开启
cd tomcat8080/bin
./startup.sh
4.配置开机启动。新手注意:配置了环境变量还要再文件中配置一次
在 vim /etc/rc.d/rc.local中加入:
#配置tomcat开机启动
export JAVA_HOME=/root/JAVA/jdk1.8.0_181
/root/JAVA/tomcat8080/bin/startup.sh start
5.访问地址,验证是否开启。新手注意:第一次访问特别慢,只要没报错就等的去。
6.查看 tomcat 日志,tomcat 的 logs 目录下的 catalina.out 存放的是日志
tomcat8 默认开启的是 nio