1. Create a software folder in the usr directory, and use the xftp tool to upload the jdk installation package and tomcat installation package to usr/software.
mkdir /usr/software
2. Unzip the jdk to the specified directory, and modify the name to facilitate our management. I am here /usr/local, the modified file name is jdk7
tar -zxvf /usr/software/jdk-7u79-linux-x64.tar.gz -C /usr/local
mv /usr/local/jdk1.7.0_79/ /usr/local/jdk7
3. Next, you need to configure environment variables. First execute the following code to open /etc/profile
vim /etc/profile
Add at the bottom of the opened file
export JAVA_HOME=/usr/local/jdk7
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=.:$JAVA_HOME/bin:$PATH
Press Esc to exit the editor, and type :wq! to return to the command line terminal. At this point we check the jdk version
4. At this point, you need to use source to update the profile file
source /etc/profile
5. View the results
java –version
6. Next we start to install tomcat, extract tomcat to the specified directory /usr/local, and change the file name to tomcat7 for easy management
tar -zxvf /usr/software/apache-tomcat-7.0.64.tar.gz -C /usr/local
mv /usr/local/apache-tomcat-7.0.64/ /usr/local/tomcat7
7. Configure environment variables, first open /etc/profile, and add the following two lines of code
vim /etc/profile
export CATALINA_HOME=/usr/local/tomcat7
export CATALINA_BASE=/usr/local/tomcat7
When finished, press Esc to exit the editor, and enter :wq! to return to the command line terminal.
8. Immediately effective profile file
source /etc/profile
9. Start tomcat
cd /usr/local/tomcat7/bin
./startup.sh
10. Check whether the startup is successful
tail -f /usr/local/tomcat7/logs/catalina.out