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
- [root@linuxas src]cd /usr/local/src
- [root@linuxas src]# chmod u+x jdk-6u14-linux-i586.bin
- [root@linuxas src]#./jdk-6u14-linux-i586.bin
Enter yes, and wait until the installation is complete.
- [root@linuxas src]# rm -f jdk-6u14-linux-i586.bin
- [root@linuxas src]# ls
- apache-tomcat-6.0.20.tar.gz jdk1.6.0_14
- [root@linuxas src]# pwd
- /usr/local/src
- [root@linuxas src]# cd jdk1.6.0_14/
- [root@linuxas jdk1.6.0_14]# ls
- bin jre README_ja.html sample
- COPYRIGHT lib README_zh_CN.html src.zip
- db LICENSE register.html THIRDPARTYLICENSEREADME.txt
- demo man register_ja.html
- include README.html register_zh_CN.html
- [root@linuxas jdk1.6.0_14]# pwd
- /usr/local/src/jdk1.6.0_14
3) set Environment Variables
- [root@linuxas lib]# vi /etc/profile
Add the following content
- export JAVA_HOME=/usr/local/src/jdk1.6.0_14
- export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin: $PATH
- 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
- [root@linuxas ~]# source /etc/profile
- [root@linuxas ~]# java -version
- java version "1.6.0_14"
- Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
- 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
- [root@linuxas ~]#cd /usr/local/src
- [root@linuxas src]# tar -zxvf apache-tomcat-6.0.20.tar.gz
- [root@linuxas src]# ls
- apache-tomcat-6.0.20 apache-tomcat-6.0.20.tar.gz jdk1.6.0_14
- [root@linuxas src]# mv apache-tomcat-6.0.20 /
- [root@linuxas src]# cd /
- [root@linuxas /]# mv apache-tomcat-6.0.20 tomcat
- [root@linuxas /]# ls
- bin dev home lost+found misc net proc sbin srv tmp usr
- boot etc lib media mnt opt root selinux sys tomcat var
3) set Environment Variables
- [root@linuxas tomcat]# vi /etc/profile
Add the following statement:
- export CATALINA_BASE=/tomcat
- export CATALINA_HOME=/tomcat
At the same time, modify the following settings:
- export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
Add and become
- export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$CATALINA_HOME=/tomcat/bin
- [root@linuxas tomcat]# source /etc/profile
4) start the service
- [root@linuxas bin]# ./startup.sh
- Using CATALINA_BASE: /tomcat
- Using CATALINA_HOME: /tomcat
- Using CATALINA_TMPDIR: /tomcat/temp
- Using JRE_HOME: /usr/local/src/jdk1.6.0_14
- [root@linuxas bin]# ps aux | grep tomcat
- 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
- root 3493 0.0 0.2 5152 696 pts/1 R+ 05:58 0:00 grep tomcat
5) modify the basic configuration of tomcat
- [root@linuxas tomcat]# cd conf
- [root@linuxas conf]# vi server.xml
Find
- < Connector port="8080" protocol="HTTP/1.1"
- connectionTimeout="20000"
- 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.
- [root@linuxas ~]# vi /etc/rc.d/rc.local
Add the following content
- export JAVA_HOME=/usr/local/src/jdk1.6.0_14
- /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:
- # useradd tomcat
- # chown -R tomcat:tomcat /tomcat
- #vi /etc/rc.local
Modify
- /tomcat/bin/startup.sh
Is
- su - tomcat -c '/tomcat/bin/startup.sh'
This article is from the "keyboard is life" blog.
- Discussion on how to implement the componentization of JSP image uploading
- Introduction to using jspsmart for file upload and download
- Use JSP pages to generate PDF reports
- Step for customizing JSP labels
- Detailed test of JSP containers