First configure the JDK:
1. Check the system information to confirm whether it is 32-bit or 64-bit: uname -a
2. Download the jdk compressed package of the corresponding number of digits and transfer it to the Linux system. Here is a 32-bit and 64-bit download link: https://pan.baidu.com/s/1raiJ2ck Password: j4aw
3. Enter the directory where the JDK compressed package is placed, and ls to view the file
4. Unzip to /opt: tar -zxvf archive name -C /opt/
5. Configure environment variables and modify the profile file under etc: vim /etc/profile
Navigate to the end of the document: G
Add the following lines:
JAVA_HOME=/opt/jdk1.8.0_65 (JAVA_HOME is followed by the path of jdk, which is modified according to the path placed by yourself)
JAVA_BIN=$JAVA_HOME/bin
JRE_HOME=$JAVA_HOME/jre
JRE_BIN=$JRE_HOME/bin
PATH=$JAVA_BIN:$JRE_BIN:$PATH
export JAVA_HOME JRE_HOME PATH
esc to exit the modification, :wq to save
Make the configuration file take effect immediately: source /etc/profile
6. Verify that the configuration is successful: java -version
If a message similar to the following appears, it means that the jdk is configured~
Next, deploy Tomcat:
1. Download the Tomcat compressed package to the Linux system: link: http://pan.baidu.com/s/1kVibXf5 Password: t9j7
2. Enter the directory where the Tomcat compressed package is placed, and ls to view the file
3. Unzip to /opt: tar -zxvf archive name -C /opt/
4. Enter the bin directory of Tomcat: cd /opt/tomcat package name/bin
5.ls, you can see that there is a startup.sh script file to start the tomcat service: ./startup.sh
6. Access in the browser: http://ip address: port number (default 8080)
If you want to modify the server port:
1. Modify the server.xml file under conf: vim /opt/tomcat package name/conf/server.xml
2. Search for 8080 :/8080 Enter
3. Modify the port you want to configure
4. esc to exit editing, :wq to save changes
Self-start Tomcat at boot:
You have to start tomcat every time you boot up. I read a lot on the Internet that you use shell scripts to realize tomcat self-starting. Later, I saw a method to directly modify the system files to achieve this. It has been practiced and the method is effective.
1. Modify the script file rc.local: vim /etc/rc.d/rc.local
This script is a user-defined startup program, in which you can add scripts or script execution commands that you want to execute after the system starts.
2. Add the following:
export JAVA_HOME=/opt/jdk1.8.0_65
/opt/tomcat package name/bin/startup.sh start
3. esc to exit editing, :wq to save changes
4. Modify rc.local to be executable
chmod 777 /etc/rc.d/rc.local