$ Ln-sjdk1.6.0.0_01jdkII. install the server platform software Tomcat5.5.20:
Method 1:
1. download the installation package: execute the command
$ Sudowgetwgethttp: // response
2. decompress and install:
$Tar-zxvfapache-tomcat-5.5.20.tar.gz <-- IWMS_AD_BEGIN -->
<-- IWMS_AD_END -->
Sudomvapache-tomcat-5.5.20/opt/3. configure environment variables
After adding the following content at the end of/etc/profile, run it in the system (restart the host)
- PATH=$PATH:/home/jinye/jdk/bin:/home/jinye/jdk/jre/bin
- JAVA_HOME=/home/jinye/jdk
- ExportJAVA_HOME
- CLASSPATH="./:/home/jinye/jdk/lib:/home/jinye/jdk/jre/lib"
- ExportCLASSPATH
- CATALINA_HOME=/home/jinye/tomcat
- ExportCATALINA_HOME
4. start Tomcat:
$ Cd/opt/apache-tomcat-5.5.20/bin
$ Sudo./starup. sh // The closing script is shutdown. sh.
Generally, the following information is correct:
UsingCATALINA_BASE:/opt/apache-tomcat-5.5.20
UsingCATALINA_HOME:/opt/apache-tomcat-5.5.20
UsingCATALINA_TMPDIR:/opt/apache-tomcat-5.5.20/temp
UsingJRE_HOME:/usr/lib/jvm/java-6-sun-1.6.0.00
5. test:
Enter http: // localhost: 8080/in the browser/
6. install Tomcat administration
Tomcat5.5 tomcadminiadminiis not installed by default. you must download and install tomcatadminiagain.
A. download the software package:
$ Wgethttp: // response
B. install the software package
Unzip tar-zxvfapache-tomcat-5.5.20-admin.tar.gz # By default, the extracted folder is apache-tomcat-5.5.20, which can be overwritten by the Tcomcat installation directory.
Or simply create a linked ln-sapache-tomcat-5.5.20tomcat.
Sudomvapache-tomcat-5.5.20/opt/
C. add the administrator account and password
Modify apache-tomcat-5.5.20/conf/tomcat-users.xml
Join
Save and exit. restart tomcat.
D. log on to the administrator account
Enter http: // localhost: 8080/in the address bar of Firefox, click the tomcatadminilink on the left to go to the admin logon page, and enter the user name and password admin
F. if the following prompt appears when you click atatadmini:
Tomcatsadministrationwebapplicationisnolongerinstalledbydefault. Downloadandinstallthe "admin" packagetouseit.
It indicates that Tomcat administration has not been started yet. Click Status in the upper-left corner of the page to enter severstatus. click ListApplications in the upper-left corner to view/admin in the list. Its running item is false. click start in the Commands item.
Now you can use it.
III. install MySQL
- Sudoapt-getinstallmysql-server
- Start mysql as root:/etc/init. d/mysqlstart
- Stop mysql as root:/etc/init. d/mysqlstop
- Start mysql: mysql-uroot-p
- Password
<-- IWMS_AD_BEGIN -->
<-- IWMS_AD_END -->4. install Apache
1. install
- sudoapt-getinstallapache2
2. Integration of Apache2 and tomcat6
Sudoapt-getinstalllibapache2-mod-jk
Check whether jk. load exists in the startup module of apache2.
- sudols/etc/apache2/mods-enabled/
- cgi.loadmod-security.confphp5.confproxy.confrewrite.loaduserdir.load
- jk.loadmod-security.loadphp5.loadproxy.loaduserdir.conf
Modify the tomcat_home and java_home addresses in the workers. properties file to the addresses where jdk and tomcat are installed.
- sudogedit/etc/libapache2-mod-jk/workers.properties
- workers.tomcat_home=/home/jinye/tomcat
- workers.java_home=/home/jinye/jdk
Configure/etc/apache2/apache2.conf
Add the content in # sudogedit/usr/share/doc/libapache2-mod-jk/httpd_example_apache2.conf
Copy to the end of apache2.conf
- sudo/etc/init.d/apache2restart
- sudo/usr/share/tomcat6/bin/./shutdown.sh
- sudo/usr/share/tomcat6/bin/./startup.sh
- sudogedit/etc/rc.local
Modify the JDK_HOME and JAVA_HOME addresses
- exportJDK_HOME=/home/jinye/jdk
- exportJAVA_HOME=/home/jinye/jdk
- sudogedit/etc/apache2/httpd.conf
Open the httpd. conf file and add the following code to the file:
- LoadModulejk_module/usr/lib/apache2/modules/mod_jk.so
- JkWorkersFile"/etc/libapache2-mod-jk/workers.properties"
- JkLogFile"/var/log/apache2/mod_jk.log"
- JkLogLevelinfo
- JkLogStampFormat"[%a%b%d%H:%M:%S%Y]"
- JkMount/*.jspajp13_worker
- JkMount/*/servlet/ajp13_worker
View http: // localhost/index. jsp results
5. use JDBC in JSP to connect to MySQL database
1. download the JDBC driver connector
Download the .tar.gz file
2.expand the file (mysql-connector-java-5.0.6.tar.gz) <-- IWMS_AD_BEGIN -->
<-- IWMS_AD_END -->
Tarzxvfmysql-connector-java-5.0.6.tar.gz3. configure the connection file
Copy the mysql-connector-java-5.0.6 file from the expanded mysql-connector-java-5.0.6-bin.jar to the lib folder under jdk and tomcat installed above
- cdmysql-connector-java-5.0.6
- cp./mysql-connector-java-5.0.6-bin.jar~/jdk/lib
- cp./mysql-connector-java-5.0.6-bin.jar~/tomcat/lib
4. the following format can be used to connect to the database during jsp writing:
- Class. forName ("com. mysql. jdbc. Driver"). newInstance ();
- Connectionconn = DriverManager. getConnection ("jdbc: mysql: // localhost/database name", "user name", "password ");
- Statementstmt = conn. createStatement (ResultSet. TYPE_SCROLL_SENSITIVE, ResultSet. CONCUR_UPDATABLE );
- Stringsql = "select * from database name ";
- Resultsetrs1_stmt.exe cuteQuery (SQL );
VI. test
- sudo-sh <