Js
This paper introduces the establishment of the development environment of the melting JSP, PHP and Java in a stove, in order to suit the needs of the most beginners, many steps are to use more convenient method, and strive to be simple and clear. In general, there is no special requirements of the software, I have to use the RPM way to install. If you have special requirements for optimal configuration, security considerations, please refer to the relevant more information for configuration.
In this article, Apache in the DSO mode installation, PHP implementation of the Java component support, so that we are in large-scale project development, you can choose PHP as a front-end scripting language, invoke Java components to implement the low-level and enterprise-class applications.
I. SYSTEM environment
1. Initial installation
Firewall Open Interface: 21,22,80,2401,8009,10000,eth0
Redhat Linux 9.0
Development Tools
Network Servers
Vsftp
Cvs-1.11.2-10
MySQL 3.23.54
2. Package Installation
JDK 1.4.2_04 Download Address: http://www.netshine.com.cn/linux/j2sdk-1_4_2_04-linux-i586.rpm
Tomcat 5.0.19 Download Address: http://www.netshine.com.cn/linux/jakarta-tomcat-5.0.19.tar.gz
3. Script Installation
Webmin 1.110 Download Address: http://www.netshine.com.cn/linux/webmin-1.110.tar.gz
Zendoptimizer 2.5.1 Download Address: http://www.netshine.com.cn/linux/ZendOptimizer-2.5.1-Linux_glibc21-i386.tar.gz
4. Manual compilation
Apache 2.0.49 Download Address: http://www.netshine.com.cn/linux/httpd-2.0.49.tar.gz
PHP 4.3.5 Download Address: http://www.netshine.com.cn/linux/php-4.3.5.tar.gz
JK 2-2.0.4 Download Address: http://www.netshine.com.cn/linux/jakarta-tomcat-connectors-jk2-src-current.tar.gz
5. Client Environment
Windows XP Professional
Absolute Telnet 3.0
Zend Encoder
Macromedia Dreamweaver MX 2004
Borland JBuilder 9 Enterprise
Wincvs 1.3 Download Address: Http://www.netshine.com.cn/linux/WinCvs13b17.zip
Two. System Installation
Start the Linux installation CD and install the basic system: FTP, development tools, and MySQL3.23.54. If you are compiling the installation of MySQL manually, you should remember to compile PHP and other programs to specify the specific path of MySQL, otherwise the path will not find the resulting compilation error.
Three. Install webmin1.110
With Webmin to configure the system, fool, can save a lot of energy, so I usually install it first. The installation process is simple, follow the prompts step by step after executing the setup.sh script.
Four. Install JDK1.4.2
1. Edit the following three files without specifying the full path in your own home directory.
/etc/profilejava_home=/usr/java/j2sdk1.4.2_04classpath=.: $JAVA _home/lib: $JAVA _home/jre/libcvsroot=/usr/local/ Cvsrootpath=.: $JAVA _home/bin: $JAVA _home/jre/bin: $PATHexport java_home CLASSPATH cvsroot path/etc/ld.so.conf/usr/ Java/j2sdk1.4.2_04/jre/lib/i386/usr/java/j2sdk1.4.2_04/jre/lib/i386/serverhelloworld.javaclass HelloWorld{ public static void Main (string[] args) {//This file tests whether the Java environment was successfully installed. System.out.println ("Hello world!");}
|
2. Execute the following command:
# RPM-IVH j2sdk*.rpm//install JDK package. # Source/etc/profile//Overload profile environment. # Ldconfig//Create dynamic link library cache file. # javac-d. Helloworld.java//Compile test file. # java HelloWorld//Run program test whether the installation was successful.
|
Five. Install Apache
# tar Xvzf httpd*//Extract source pack. # CD httpd*//Enter the installation directory. #./configure--prefix=/usr/local/apache--enable-so--enable-mods-shared=most--enable-rewrite # make;make install// Compile and install.
|
Description
--ENABLE-SO option: Let Apache support DSO mode, note that we are here to use the Apache2.0 syntax. If your Apache is version 1.3, you should change to--enable-module=so.
--enable-mods-shared=most option: Tells the compiler to compile all standard modules into the DSO module. If you use Apache1.3, change to--enable-shared=max.
--enable-rewrite option: Support address rewrite, use 1.3 version of Friends please change it to--enable-module=rewrite.
Six. Compile and install PHP
1. Executive Order:
#tar Xvzf php*//Extract source #cd php*/Enter PHP installation command #./configure--prefix=/usr/local/php--with-mysql--with-apxs2=/usr/local/ Apache/bin/apxs--with-java=/usr/java/j2sdk1.4.2_04#make;make install//Compile and install #cp php.ini-dist/usr/local/php/lib/ php.ini//Copy PHP configuration file #cd/usr/local/php/lib/php/extensions/no-debug-non-zts-20020429//extensions directory #ln-S java.so libphp_java.so//Set up a connection, forget to make mistakes Oh #cd zend*//Enter Zendoptimizer directory #./install//install PHP accelerator
|
Description:
--with-apxs2=/usr/local/apache/bin/apxs is Apache2 syntax, users of version 1.3 are requested to use--with-apxs=/usr/local/ Apache/bin/apxs.
2. Edit the following three files:
/usr/local/apache/conf/httpd.conf LoadModule php4_module modules/libphp4.soaddtype application/x-httpd-php. php AddType application/x-httpd-php-source. Phpsadddefaultcharset gb2312/usr/local/apache/htdocs/test.php// This program tests PHP's Java environment is available, the code is extracted from the http://www.php.net/manual/en/ref.java.php. Get instance of Java Classjava.lang.System in php$system = new Java (' Java.lang.System ');//Demonstrate Property Accesse Cho ' Java version= '. $system->getproperty (' java.version '). ''; Echo ' Java vendor= '. $system->getproperty (' Java.vendor '). ''; Echo ' os= '. $system->getproperty (' Os.name '). ' ' . $system->getproperty (' os.version '). ' On '. $system->getproperty (' Os.arch '). ' '; java.util.Date example $formatter = new Java (' Java.text.SimpleDateFormat ', ' eeee, MMMM dd, yyyy ' at ' h:mm:ss a zzzz ') ; Echo $formatter->format (New Java (' java.util.Date ')); ?>/usr/local/php/lib/php.ini Register_globals=on [java]java.class.path=/usr/local/php/lib/php/php_java.jar:/ Home/jim/myclass java.home=/usr/java/j2sdk1.4.2_04 java.library=/usr/java/j2sdk1.4.2_04/jre/lib/i386/libjava.so java.library.path=/usr/local/php/lib/php/extensions/no-debug-non-zts-20020429 extension_dir=/usr/local/php/lib/ php/extensions/no-debug-non-zts-20020429 extension=libphp_java.so
|
Attention:
(1). If you have just switched from a previous version of PHP to a new version, you may find that many of your PHP programs are useless. But if you open the register_globals, everything will be fine. This is because the old version of PHP, its register_globals default is open, and the new version, but turned it off.
(2)./home/jim/myclass is the path to my Java component, you can modify it according to the actual situation, but for the sake of security, do not put it in the Web directory.
Seven. Install Tomcat
1. Execute the following command
#cd *jk2*/jk/native2//Enter connector compile directory #./buildconf.sh//Run Configuration script #./configure--with-apxs2=/usr/local/apache/bin/apxs- Enable-jni--enable-eapi#make//Compile module #cd ~jim/src/*jk2*/jk/build/jk2/apache2//Enter the directory of the compiled module #cp *.so/usr/local/apache/ modules///copies the module to the Apache directory #cp-r jakarta-tomcat-5.0.19/usr/local/tomcat//Installation tomcat#touch/usr/local/apache/logs/ shm.file//Create shared memory files
|
2. Edit the following file
/usr/local/apache/conf/httpd.conf LoadModule jk2_module modules/mod_jk2.so jkset config.file/usr/local/apache/conf/ Workers2.properties documentroot "/usr/local/tomcat/webapps"/usr/local/tomcat/webapps/jsp-examples/for.jsp/us R/local/tomcat/conf/jk2.propertie Handler.list=request,container,channelsocket channelSocket.port=8009 channelsocket.address=127.0.0.1 channelsocket.maxport=port+10/usr/local/apache/conf/workers2.properties [SHM] File=/usr/local/apache/logs/shm.file size=1048576 [workerenv:] Info=global server Options timing=1 debug=0 [channel. SOCKET:LOCALHOST:8009] port=8009 host=127.0.0.1 [ajp13:localhost:8009] channel=channel.socket:localhost:8009 [uri:/ *.JSP] worker=ajp13:localhost:8009/etc/rc.d/init.d/httpd #!/bin/sh # chkconfig:2345 description:Starting Apache and Tomcat Server ld_library_path=/usr/java/j2sdk1.4.2_04/jre/lib/i386:/usr/java/j2sdk1.4.2_04/jre/lib/i386 /server Export Ld_library_path catalina_base=/usr/lOcal/tomcat Export catalina_base catalina_home=/usr/local/tomcat export Catalina_home Apache_home=/usr/local/apach E export apache_home java_home=/usr/java/j2sdk1.4.2_04 export java_home profiledir=/var/run case "$" in start The IF [-F $PROFILEDIR/tomcat5_apache2];then echo "Running tomcat5_apache2" else if [f $CATALINA _home/bin/startup. SH];then if [f $APACHE _home/bin/apachectl];then "$CATALINA _home/bin/startup.sh" echo "Startting Tomcat5" Sleep 3 echo "Startting Apache2" $APACHE _home/bin/apachectl start echo "." Touch $PROFILEDIR/tomcat5_apache2 Else echo ' Apache file not founds ' fi else echo ' Tomcat file not founds ' fi fi; ; stop) If [f $PROFILEDIR/tomcat5_apache2];then if [f $CATALINA _home/bin/shutdown.sh];then if [-F $APACHE _home/bin /apachectl];then "$CATALINA _home/bin/shutdown.sh" echo "Stopping Tomcat5" Sleep 3 echo "Stopping Apache2" $APACHE _ho Me/bin/apachectl Stop RM $PROFILEDIR/tomcat5_apache2 else echo ApacHe File isn't founds "fi else echo" Tomcat File not founds "fi else echo" not Running Tomcat5_apache2 "fi"; *) echo "Usage; ' BaseName $ ' {start|stop} ' 1>&2 exit 1;; ESAC Exit 0
|
3. Set Auto Start
#chmod u+x/etc/rc.d/init.d/httpd//Modify File Execution Permissions #/sbin/chkconfig--add httpd//will httpd join the system startup list
|
Eight. Install CVS
1. Edit the following file
/etc/xinetd.d/cvspserver service Cvspserver {socket_type=stream wait=no user=root Server=/usr/bin/cvs server_args= -F--allow-root=/usr/local/cvsroot pserver log_on_failure + = USERID}
|
2. Execute the following command
#/usr/sbin/useradd-d/usr/local/cvsroot CVS//create CVS Admin user. Create an Admin user password #passwd cvs//. # chmod 771/usr/local/cvsroot//Modify CVS root permissions. # su CVS//Use the identity of the CVS user. $ cvs-d/usr/local/cvsroot init//Initialize CVS repository. $exit//Quit the CVS user identity. #chmod 644/etc/xinetd.d/cvspserver//Modify the CVS service startup file permissions. #/etc/rc.d/init.d/xinetd restart//reboot xinetd Super server. # Netstat-lnp|grep 2401//to see if the CVS service has started. #/usr/sbin/useradd cvspub//Create CVS equivalent system user cvspub. #/usr/sbin/usermod-g CVS cvspub//will cvspub users into the CVS group. #cd/home/tets1//into the project directory for the test. #cvs Import-m ' This are a test only ' test1 v_0_0_1 start//To import the files for the current project into the CVS repository.
|
Description
CVS password problem, the previous opinions, some program to generate a password, and some use the so-called soil method to copy shadow password. In fact, I can tell beginners one of the simplest and easiest way is to use Webmin to add CVS users, it will help you generate the password.
3. Edit the following file:
/usr/local/cvsroot/cvsroot/passwdtest1:nxwxabrve7z/w:cvspubtest2:fztxeaww.ysia:cvspub
|
Description
Mainly in the end with the user name Cvspub, so that the system users cvspub instead of Test1 and test2 to read and write CVS warehouse.
/usr/local/cvsroot/cvsroot/readerstest1/usr/local/cvsroot/cvsroot/writerscvstest2
|
At this point, the entire system configuration is complete.