Because uploading files from the local network is slow, the corresponding software is downloaded to the Alibaba Cloud machine through wget.
1. Download JDK
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie""http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"
This is to accept the certificate download through verification, otherwise it cannot be decompressed normally.
2. Enter the home directory
mkdir jdk
tar -xvzf jdk-8u141-linux-x64.tar.gz -C /home/jdk
3. Configure JDK environment variables
#set java environment
export JAVA_HOME=/home/jdk/jdk1.8.0_141
export JRE_HOME=/home/jdk/jdk1.8.0_141/jre
export CLASS_PATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$JAVA_HOME:$PATH
Note that there can be no spaces before and after the equal sign
4. Make the configuration take effect
source /etc/profile
5. Test whether java is installed, java -version
View environment variables
whereis java
which java (java execution path)
echo $JAVA_HOME
echo $PATH
6. Download tomcat
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.86/bin/apache-tomcat-7.0.86.tar.gz
7. Unzip tomcat
tar -xvzf apache-tomcat-7.0.86.tar.gz
8. Enter the bin directory of tomcat and run ./startup.sh. The stop command is ./shutdown.sh
9. Access the host in the browser: 8080 to access tomcat
10. ps -ef | grep tomcat to see if tomcat has been started