JDK installation and Tomcat configuration for JSP environment setup

Source: Internet
Author: User

Step 1 of JSP environment setup: Install JDK

1) download the installer from the official website: http://java.sun.com/javase/downloads/index.jsp. you only need to download the installer and install it.

2) install the JDK package

 
 
  1. [root@linuxas src]cd /usr/local/src  
  2. [root@linuxas src]# chmod u+x jdk-6u14-linux-i586.bin   
  3. [root@linuxas src]#./jdk-6u14-linux-i586.bin  

Enter yes, and wait until the installation is complete.

 
 
  1. [root@linuxas src]# rm -f jdk-6u14-linux-i586.bin   
  2. [root@linuxas src]# ls  
  3. apache-tomcat-6.0.20.tar.gz jdk1.6.0_14  
  4. [root@linuxas src]# pwd  
  5. /usr/local/src  
  6. [root@linuxas src]# cd jdk1.6.0_14/  
  7. [root@linuxas jdk1.6.0_14]# ls  
  8. bin jre README_ja.html sample  
  9. COPYRIGHT lib README_zh_CN.html src.zip  
  10. db LICENSE register.html THIRDPARTYLICENSEREADME.txt  
  11. demo man register_ja.html  
  12. include README.html register_zh_CN.html  
  13. [root@linuxas jdk1.6.0_14]# pwd  
  14. /usr/local/src/jdk1.6.0_14 

3) set Environment Variables

 
 
  1. [root@linuxas lib]# vi /etc/profile 

Add the following content

 
 
  1. export JAVA_HOME=/usr/local/src/jdk1.6.0_14  
  2. export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin: $PATH  
  3. exportCLASSPATH=.:/usr/local/src/jdk1.6.0_14/lib:/usr/local/src/jdk1.6.0_14/jre/lib:$CLASSPATH 

4) Verify the JAVA installation result

 
 
  1. [root@linuxas ~]# source /etc/profile  
  2. [root@linuxas ~]# java -version  
  3. java version "1.6.0_14"  
  4. Java(TM) SE Runtime Environment (build 1.6.0_14-b08)  
  5. Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing) 

Step 2 of JSP Environment Construction: install tomcat

1) download the installation package from the official website: http://tomcat.apache.org/download-60.cgi. select .tar.gzto download the package.

2) install tomcat

 
 
  1. [root@linuxas ~]#cd /usr/local/src  
  2. [root@linuxas src]# tar -zxvf apache-tomcat-6.0.20.tar.gz  
  3. [root@linuxas src]# ls  
  4. apache-tomcat-6.0.20 apache-tomcat-6.0.20.tar.gz jdk1.6.0_14  
  5. [root@linuxas src]# mv apache-tomcat-6.0.20 /  
  6. [root@linuxas src]# cd /  
  7. [root@linuxas /]# mv apache-tomcat-6.0.20 tomcat  
  8. [root@linuxas /]# ls  
  9. bin dev home lost+found misc net proc sbin srv tmp usr  
  10. boot etc lib media mnt opt root selinux sys tomcat var  

3) set Environment Variables

 
 
  1. [root@linuxas tomcat]# vi /etc/profile 

Add the following statement:

 
 
  1. export CATALINA_BASE=/tomcat  
  2. export CATALINA_HOME=/tomcat 

At the same time, modify the following settings:

 
 
  1. export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin  

Add and become

 
 
  1. export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$CATALINA_HOME=/tomcat/bin  
  2. [root@linuxas tomcat]# source /etc/profile 

4) start the service

 
 
  1. [root@linuxas bin]# ./startup.sh   
  2. Using CATALINA_BASE: /tomcat  
  3. Using CATALINA_HOME: /tomcat  
  4. Using CATALINA_TMPDIR: /tomcat/temp  
  5. Using JRE_HOME: /usr/local/src/jdk1.6.0_14  
  6. [root@linuxas bin]# ps aux | grep tomcat  
  7. root 3468 7.6 10.4 219008 26772 pts/1 Sl 05:57 0:05 /usr/local/src/jdk1.6.0_14/bin/java -Djava.util.logging.config.file=/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/tomcat/endorsed -classpath :/tomcat/bin/bootstrap.jar -Dcatalina.base=/tomcat -Dcatalina.home=/tomcat -Djava.io.tmpdir=/tomcat/temp org.apache.catalina.startup.Bootstrap start  
  8. root 3493 0.0 0.2 5152 696 pts/1 R+ 05:58 0:00 grep tomcat 

5) modify the basic configuration of tomcat

 
 
  1. [root@linuxas tomcat]# cd conf  
  2. [root@linuxas conf]# vi server.xml 

Find

 
 
  1. < Connector port="8080" protocol="HTTP/1.1" 
  2. connectionTimeout="20000" 
  3. redirectPort="8443" /> 

Change the port to 80 and add the following statement URIEncoding = "UTF-8" useBodyEncodingForURI = "true" to support Chinese display.

6) set tomcat to start by default.

 
 
  1. [root@linuxas ~]# vi /etc/rc.d/rc.local 

Add the following content

 
 
  1. export JAVA_HOME=/usr/local/src/jdk1.6.0_14  
  2. /tomcat/bin/startup.sh 

After modifying iptables settings, check the effect as follows:

If it is not started as a root user, perform the following operations:
 
 
  1. # useradd tomcat  
  2. # chown -R tomcat:tomcat /tomcat  
  3. #vi /etc/rc.local 

Modify

 
 
  1. /tomcat/bin/startup.sh  

Is

 
 
  1. su - tomcat -c '/tomcat/bin/startup.sh' 

This article is from the "keyboard is life" blog.

  1. Discussion on how to implement the componentization of JSP image uploading
  2. Introduction to using jspsmart for file upload and download
  3. Use JSP pages to generate PDF reports
  4. Step for customizing JSP labels
  5. Detailed test of JSP containers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.