Structures under Linux Web Application Environment (original)
JAVA operating environment: j2sdk-1_4_2_05
Database server: MySQL-4.0.20d
Web server: Tomcat5.0.27
JDBC Driver: mysql-connector-java-3.0.14-production-bin.jar
1, the structures of the operating environment JAVA JAVA
(1) to download j2sdk-Sun 1_4_2_05-linux-i586-rpm.bin
(2) documents to executable files:
[Root @ eframe62 tuzq] # chmod + x j2sdk-1_4_2_05-linux-i586-rpm.bin
(3) the implementation of self-extracting files:
[Root @ eframe62 tuzq] # ./j2sdk-1_4_2_05-linux-i586-rpm.bin
(4) decompress files generated rpm j2sdk-1_4_2_05-linux-i586-rpm, installation rpm:
[Root @ eframe62 tuzq] # rpm-ivh j2sdk-1_4_2_05-linux-i586-rpm
(5) files are installed in / usr/java/j2sdk1.4.2_05 directory, in order to facilitate the / usr directory to be a simple connection:
[Root @ eframe62 usr] # ln-s / usr/java/j2sdk1.4.2_05 jdk
(6) by adding environment variables:
[Root @ eframe62 usr] # export JAVA_HOME = / usr / jdk
[Root @ eframe62 usr] # export CLASSPATH = $ JAVA_HOME / lib: $ JAVA_HOME / jre / lib:.
[Root @ eframe62 usr] # export PATH = $ PATH: $ JAVA_HOME / bin: $ JAVA_HOME / jre / bin
(7) Test JAVA operating environment: write a procedure to verify java
[Root @ eframe62 usr] # vi HelloWorld.java
Importation of the following:
Public class HelloWorld (
Public static void main (String args []) (
System.out.println ( "Hello, Wrold");
)
)
Write and withdraw from the Editor:
: Wq
[Root @ eframe62 usr] # javac HelloWorld.java
(No error)
[Root @ eframe62 usr] # java HelloWorld
Hello, World
In this way, JAVA operating environment built well.
2, MySQL database installation
MySQL database server can be downloaded to www.mysql.com. Is a binary version (compiler) mysql-standard-4.0.20-pc-linux-i686.tar.gz, installation is as follows:
(1) increase and called mysql user groups:
[Root @ eFrame62 root] # groupadd mysql
[Root @ eFrame62 root] # useradd-g mysql mysql
(2) to decompress the file / usr / local directory:
[Root @ eFrame62 root] # cd / usr / local
[Root @ eFrame62 local] # gunzip </ home/tuzq/mysql-standard-4.0.20-pc-linux-i686.tar.gz | tar xvf –
(3) the creation of a user-friendly links:
[Root @ eFrame62 local] # ln-s / usr/local/mysql-standard-4.0.20-pc-linux-i686 mysql
(4) The Executive mysql_install_db script, initialize the database (creates system database and table):
[Root @ eFrame62 local] # cd mysql
[Root @ eFrame62 mysql] # scripts / mysql_install_db - user = mysql
Below if a similar mistake, and - force parameters:
Neither host 'eframe62' and 'localhost' could not be looked up with. / Bin / resolveip
(5) amend the owner:
[Root @ eFrame62 mysql] # chown-R root.
[Root @ eFrame62 mysql] # chown-R mysql data
[Root @ eFrame62 mysql] # chgrp-R mysql.
(6) launched the database server:
[Root @ eFrame62 mysql] # bin / mysqld_safe - user = mysql &
RPM is another version, including: MySQL-server-4.0.20-0.i386.rpm (server) and MySQL-client-4.0.20-0.i386.rpm (client). Implementation of the following command to install, will automate the operation, launched good server:
Rpm-ivh MySQL-server-4.0.20-0.i386.rpm
Rpm-ivh MySQL-client-4.0.20-0.i386.rpm
NOTE: RPM version of the MySQL installation directory vary, there are some directory below:
L / usr / bin: Customer procedures and scripts
L / usr / sbin: mysqld service program
L / var / lib / mysql: database and the log file
If we can not start normal service may need to be modified / var / lib / mysql for the owner of mysql:
Chown-R mysql: mysql / var / lib / mysql
MySQL initial root password is empty, needs to be revised. In order to use your tools (such as the Windows graphical tools) remote connectivity, the need to increase access:
[Root @ eFrame62 mysql] # mysql-u root-p
Mysql> use mysql
Mysql> grant all privileges on *.* to root @ "%" identified by'012345 'with grant option;
The above can be ordered from the arbitrary creation of a machine to the Super root login account, password is 012345. In this way, the easy-to-use graphical tool can login and operation, including revising the root password.
3, installation of Tomcat
Www.jakarta.org can download Tomcat, is a binary packages (compiler): jakarta-tomcat-5.0.27.tar.gz.
(1) to extract the files to / usr / local directory
[Root @ eFrame62 local] # gunzip </ home/tuzq/jakarta-tomcat-5.0.27.tar.gz | tar xvf –
(2) create easy-to-use link
[Root @ eFrame62 local] # ln-s / usr/local/jakarta-tomcat-5.0.27.tar.gz tomcat
(3) a path JDK
[Root @ eFrame62 local] # cd tomcat
[Root @ eFrame62 tomcat] # vi bin / catalina.sh
Catalina.sh add in the beginning:
Export JAVA_HOME = / usr / jdk
Export CLASSPATH = $ JAVA_HOME / lib: $ JAVA_HOME / jre / lib:.
Export PATH = $ PATH: $ JAVA_HOME / bin: $ JAVA_HOME / jre / bin
(4) start Tomcat
[Root @ eFrame62 tomcat] # bin / startup.sh
In the browser type http:// machines domain name or IP Address: 8080 /, Tomcat welcome interface will be displayed.
(5) To stop the Tomcat
[Root @ eFrame62 tomcat] # bin / shutdown.sh
(6) in the system start to start automatically when Tomcat, in the / etc / rc.d / rc.local adding:
/ Usr / local / tomcat / bin / startup.sh
(7) Management of Tomcat
Laws / usr / local / tomcat / conf / tomcat-users.xml increase administrator account (need to restart Tomcat):
[Root @ eFrame62 tomcat] # vi conf / tomcat-users.xml
In "tomcat-users> adding his party:
<user Username="admin" password="" roles="admin,manager"/>
In the browser type http:// machines domain name or IP Address: 8080 / admin, an administrator log-in management interface.
(8) Create content Context
Creating standards for Web applications (such as quickstart) include: WEB-INF directory, and there are classes lib directory.
One approach is to copy the whole directory / usr / local / tomcat / webapps / directory to restart Tomcat, will be automatically loaded.
Another method is to copy an entire directory to a directory (eg / home / tuzq / quickstart), in the management interface, the left choose Tomcat Server / Service (Catalina) / Host (localhost), the right of the Host Actions drop-down box Select Create New Context, designated Document Base for the / home / tuzq / quickstart designated Path to / quickstart; In order to use JNDI, Use Naming set to True.
In this way, the machine can http:// domain name or IP Address: 8080 / quickstart visit Web application content.
(9) set JDBC
In order to access the specified database, corresponding to the JDBC driver (here mysql-connector-java-3.0.14-production-bin.jar) copied to the / usr / local / tomcat / common / lib, in the Tomcat will be automatically activated when the load








0 Comments to “Structures under Linux Web Application Environment (original)”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.