This test environment rhel6 is also suitable for rhel5.x and centos5.x.
Of course, the path problems involved in this article should be consistent with your actual situation.
1. Download JDK first. We recommend that you download JDK from the official website. It is not necessarily my download method.
[Root @ rhel6 ~] # Wget http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u22-linux-i586.bin? Bundledlineitemuuid = xryj_hcuhjuaaaese0ckgng2 & orderid = f0mj_hcuadoaaaesbuckgng2 & productid = xuuj_hcwwmcaaermvjuiqy3 & filename =/jdk-6u22-linux-i586.bin <br/>
Wow, the downloaded file name is really long. I want to make it shorter.
[Root @ rhel6 ~] # Music Video jdk-6u22-linux-i586.bin /? Authparam/= workshop/& ticketid/= workshop + bcq/=/& groupname/= CdS/& filepath/= % 2fesd6% 2 fjscdl % 2 fjdk % 2f6u22-b04% workshop/ & file/= jdk-6u22-linux-i586.bin jdk-6u22-linux-i586.bin
2. Now we have downloaded JDK and start to install it.
[Root @ rhel6 ~] # Chmod + x jdk-6u22-linux-i586.bin <br/> [root @ rhel6 ~] #./Jdk-6u22-linux-i586.bin <br/> install as prompted.
During the installation process, I found that it was decompressed to the current directory, and I decided to put it under/usr.
[Root @ rhel6 ~] # Mv./jdk1.6.0 _ 22/usr/
3. Configure the environment variable below. We will append the environment variable to/etc/profile.
[Root @ rhel6 ~] # Vi/etc/profile <br/> append <br/> export java_home =/usr/jdk1.6.0 _ 22 <br/> export Path = $ path: $ java_home/bin <br/> export classpath =.: $ java_home/JRE/lib: $ java_home/lib/tools. jar
Then let the set environment variables take effect and test whether the installation is successful.
[Root @ rhel6 ~] # Source/etc/profile <br/> [root @ rhel6 ~] # Java-version <br/> JAVA version "1.6.0 _ 22" <br/> JAVA (TM) se Runtime Environment (build 1.6.0 _ 22-b04) <br/> JAVA hotspot (TM) Client VM (build 17.1-b03, mixed mode, sharing) <br/> [root @ rhel6 ~] # Cat test. java <br/> public class test {<br/> Public static void main (string [] ARGs) {<br/> system. out. println ("hello"); <br/>}< br/> [root @ rhel6 ~] # Javac test. Java <br/> [root @ rhel6 ~] # Java test <br/> hello
Okay. So far, JDK has been installed and configured. Next we will install Tomcat.
4. install Tomcat (download, decompress, and configure the environment variables similar to the above, not to mention)
[Root @ rhel6 ~] # Http://ftp.jaist.ac.jp/pub/apache//tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.tar.gz wget <br/> [root @ rhel6 ~] # Tar-xzvf apache-tomcat-6.0.29.tar.gz <br/> [root @ rhel6 ~] # Mv APACHE-Tomcat-6.0.29/usr/local/tomcat <br/> [root @ rhel6 ~] # Vi/etc/profile <br/> append <br/> export tomcat_home =/usr/local/tomcat <br/> export catalina_home =/usr/local/tomcat <br/> export classpath = $ classpath: $ catalina_home/common/lib <br/> [root @ rhel6 ~] # Source/etc/profile <br/> [root @ rhel6 ~] #/Usr/local/tomcat/bin/startup. sh <br/> using catalina_base:/usr/local/tomcat <br/> using catalina_home:/usr/local/tomcat <br/> using catalina_tmpdir: /usr/local/tomcat/temp <br/> using jre_home:/usr/jdk1.6.0 _ 22 <br/> using classpath:/usr/local/tomcat/bin/Bootstrap. jar
Enter http: // localhost: 8080 in the browser, and you will be able to see the kitten.
5. The last code in the previous step is to start Tomcat, and we will close it.
[Root @ rhel6 ~] #/Usr/local/tomcat/bin/shutdown. sh <br/> using catalina_base:/usr/local/tomcat <br/> using catalina_home:/usr/local/tomcat <br/> using catalina_tmpdir: /usr/local/tomcat/temp <br/> using jre_home:/usr/jdk1.6.0 _ 22 <br/> using classpath:/usr/local/tomcat/bin/Bootstrap. jar <br/> [root @ rhel6 ~] # Lsof-I: 8080 <br/> [root @ rhel6 ~] #
We can see that after we shut down Tomcat with shutdown. Sh, we checked port 8080 with lsof and didn't listen. This indicates that the shutdown was successful.