Reahat5.5 install jdk and tomcat and deploy Java projects. reahat5.5jdk
1. Download and install Redhat5.5 64-bit Enterprise Edition on the jdk virtual machine,
Take jdk-7u75-linux-x64.tar.gz as an example.
Download jdk of this version from the Internet, or click here to download (access password 375a)
Upload the file to linux as a root user and grant it the execution permission.
# mkdir /usr/java# cd /usr/java# tar -xvzf jdk-7u75-linux-x64.tar.gz # mv jdk1.7.0_75/ jdk7# ls -ltotal 139056drwxr-xr-x 8 uucp 143 4096 Dec 19 09:04 jdk7-rw-r--r-- 1 root root 142245547 Feb 9 21:17 jdk-7u75-linux-x64.tar.gz# vi /etc/profileJAVA_HOME=/usr/java/jdk7CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATHPATH=$JAVA_HOME/bin:$PATHexport JAVA_HOME CLASSPATH PATH[root@n40 java]# source /etc/profile[root@n40 java]# echo $JAVA_HOME/usr/java/jdk7# java -versionjava version "1.7.0_75"Java(TM) SE Runtime Environment (build 1.7.0_75-b13)Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
2. Download and install tomcat
Download apache-tomcat-7.0.59.tar.gz from the Internet or click here to download it (access password 285a)
# tar -xzvf apache-tomcat-7.0.59.tar.gz # mv apache-tomcat-7.0.59 /usr/java/tomcat7# cd /usr/java/ls -ltotal 139060drwxr-xr-x 8 uucp 143 4096 Dec 19 09:04 jdk7-rw-r--r-- 1 root root 142245547 Feb 9 21:17 jdk-7u75-linux-x64.tar.gzdrwxr-xr-x 9 root root 4096 Feb 9 22:02 tomcat7# vi /etc/profileTOMCAT_HOME='/usr/java/tomcat7'PATH=$PATH:$TOMCAT_HOME/bin export TOMCAT_HOME PATH# source /etc/profile# echo $TOMCAT_HOME/usr/java/tomcat7
Start
# startup.shUsing CATALINA_BASE: /usr/java/tomcat7Using CATALINA_HOME: /usr/java/tomcat7Using CATALINA_TMPDIR: /usr/java/tomcat7/tempUsing JRE_HOME: /usr/java/jdk7Using CLASSPATH: /usr/java/tomcat7/bin/bootstrap.jar:/usr/java/tomcat7/bin/tomcat-juli.jarTomcat started.
Close
# Shutdown. sh
Access
Http: // localhost: 8080/
Access outside the VM
Http: // 192.168.10.40: 8080/
192.168.10.40 is the ip address of the Virtual Machine linux system.
If it cannot be opened externally, it indicates a network problem. You can check whether the ip address resolution is correct, whether the firewall is disabled, and whether port 8080 is enabled.
3. Deploy a Java Project
Package the Java project into *. war or copy all content of webContent to a directory, such as test. war, and upload it to linux.
# Mv test. war/usr/java/tomcat7/webapps/
Access path
Http: // 192.168.10.40: 8080/test/
4. Summary
The installation of jdk and tomcat on linux copies the installation file to the linux system. The configuration of tomcat environment variables is not necessary, but for ease of use. The deployment of Java projects is no different on linux and windows.