一聚教程网:一个值得你收藏的教程网站

热门教程

如何在在LINUX下配置MYSQL、PHP和JSP环境

时间:2022-06-25 14:46:28 编辑:袖梨 来源:一聚教程网

需要下载的资源

1、mysql教程-3.22.32-pc-linux-gnu-i386.tar.gz
2、apache_1.3.12.tar.gz
3、php教程-4.03pl1.tar.gz
4、mod_auth_mysql-2.20.tar.gz
5、phpMyAdmin_2.1.0.tar.gz
6、jdk-1_2_2_006-linux-i386[1].tar.gz
7、jsdk20-solaris2-sparc.tar.Z
8、ApacheJServ-1.1.2.tar.gz
9、gnujsp教程-1.0.1.tar.gz

注:所有的文件是在/tmp目录下解开的。

(一)安装MySQL

#cd /tmp
#tar zvxf mysql-3.22.32-pc-linux-gnu-i386.tar.gz
#mv mysql3.22.32 /usr/local/mysql
#cd /usr/local/mysql
#./configure --prefix=/usr/local/mysql



(二)预安装Apache

#cd /tmp
#tar zvxf apache_1.3.12.tar.gz
#cd apache_1.3.12
#./configure --prefix=/usr/local/apache
#make;make install


(三)安装php4

#tar zvxf php-4.03pl1.tar.gz
#cd php-4.03pl1
#./configure
--with-mysql=/usr/local/mysql
--with-apache=../apache_1.3.12
--enable-track-vars
#make;make install



(四)安装Mod_Auth_Mysql

#cd /tmp
#tar zvxf mod_auth_mysql-2.20.tar.gz
#cd mod_auth_mysql-2.20
#./configure
--with-mysql=/usr/local/mysql
--with-apache=../apache_1.3.12
--enable-track-vars
#make


(五)安装jdk

#cd /tmp
#tar zvxf jdk-1_2_2_006-linux-i386[1].tar.gz
#mv jdk1.2.2 /usr/local/jdk1.2.2
在/etc/profile下把PATH改为:PATH="$PATH:/usr/X11R6/bin:/usr/local/jdk1.2.2/bin"
#cd /tmp
#tar zvxf jsdk20-solaris2-sparc.tar.Z
#cp JSDK2.0/lib/jsdk.jar /usr/local/jdk1.2.2/jre/lib/ext/
只需要jsdk.jar文件,之后就可以删除JSDK2.0目录(rm -rf JSDK2.0)



(六)安装Apache JServ

#cd /tmp
#tar zvxf ApacheJServ-1.1.2.tar.gz
#cd ApacheJServ-1.1.2
#./configure
--prefix=/usr/local/jserv
--with-apache-src=../apache_1.3.12
--with-jdk-home=/usr/local/jdk1.2.2
--with-JSDK=/usr/local/jdk1.2.2/jre/lib/ext/jsdk.jar
--enable-EAPI
--disable-debugging
#make;make install



(七)正式安装Apache (重新编译Apache并激活php4、Mod_Auth_MySQL、JServ模块)

#cd /tmp
#cd apache_1.3.12
#./configure
--prefix=/usr/local/apache
--activate-module=src/modules/php4/libphp4.a
--activate-module=src/module/auth_mysql/libauth_mysql.a
--activate-module=src/modules/jserv/libjserv.a
#make;make install


(八)配置php

#cd /tmp
#cd php-4.30pl1
#cp php.ini-dist /usr/local/lib/php.ini
#cd /usr/local/apache/conf
#vi httpd.conf
找到AddType application/x-httpd-php .php一行,将“#”删掉,并在行尾加上 .php3 .php4。


(九)安装phpMyAdmin

#cd /tmp
#tar -zvxf phpMyAdmin_2.1.0.tar.gz
#mv phpMyAdmin_2.1.0 /usr/local/apache/htdocs/phpMyAdmin
#cd /usr/local/apche/htdocs/phpMyAdmin
#chmod a+r * (置为可读)



(十)启动MySQL数据库教程

#cd /usr/local/mysql
#script/mysql_install_db (可有可无)
#bin/safe_mysqld &
#bin/mysql -u root
#mysql>use mysql;
#mysql>select * from user;
#mysql>UPDATE user SET password=PASSWORD('1234567') WHERE user='root' (给root用户设置口令)
#mysql>exit



(十一)配置phpMyAdmin

#cd /usr/local/apache/htdocs/phpMyAdmin
#vi config.inc.php3
配置下面参数如下:
$CfgServers[1]['adv_auth'] = true
$CfgServers[1]['stduser'] ='root'
$CfgServers[1]['stdpass'] ='1234567'



(十二)配置Apache和MySQL的开机启动
即使您没有安装Linux下的Web Server,在您安装Linux时也会安装Web Server,所以您要把以前的HTTPD服务终止,因此:

#cd /etc/rc.d/init.d
#mv httpd httpd.old
#cd /etc/rc.d
#vi rc.local
在最后加上下面几行:
cd /usr/local/mysql
bin/safe_mysqld &
/usr/local/apache/bin/apachectl start
#reboot



(十三)配置Apache JServ

#cd /usr/local/apache/conf
#vi httpd.conf
在开始增加:
Include /usr/local/jserv/etc/jserv.conf
注:httpd.conf->jserv.conf->jserv.properties->zone.properties



(十四)测试Apache JServ

测试设定档案是否能够启动
#/usr/local/apache/bin/apachectl configtest
重新启动
#/usr/local/apache/bin/apachectl restart
看jserv module是否被连接进去
/usr/local/apache/bin/httpd -l
测试:httpd://servrname/servlets/Hello
注:apache的错误信息写在/usr/local/apache/logs/error_log
jserv的错误信息在/usr/local/jserv/logs/mod_jserv.log



(十五)安装gnujsp

#cd /tmp
#tar zvxf gnujsp-1.0.1.tar.gz
#mv gnujsp-1.0.1 /usr/local/gnujsp

(十六)配置JSP
#cd /usr/local/jserv/etc

#vi jserv.conf
增加下面这些行:
ApJServVMTimeout 30
ApJServMount /alph /alphzone
ApJServAction .jsp /alph/gnujsp

#vi jsev.properties
注释掉下面这行:
wrapper.classpath=/usr/local/jdk1.2.2/jre/lib/ext/jsdk.jar
增加:
wrapper.classpath=/usr/local/jdk1.2.2/lib/tools.jar
wrapper.classpath/usr/local/gnujsp/lib/servlet-2.0-plus.jar
注释掉:
zones=root
增加:
zone=root,alphzone
alphzone.properties=/usr/local/jserv/etc/alphzone.properties

#cp zone.properties.dufault alphzone.properties
#vi alphzone.properties
注释掉:
repositories=/usr/local/jserv/servlets
增加:
repositories=/usr/local/gnujsp/lib/gnujsp10.jar
repositories=/usr/local/gnujsp/lib/sax2.jar
repositories=/usr/local/gnujsp/lib/openxml-1.2-w3c.jar
repositories=/usr/local/gnujsp/lib/aelfred.jar
在最后增加:
servlet.gnujsp.code=org.gjt.jsp.JspServlet
servlet.gnujsp.initArgs=scratchdir=/usr/local/apache/jsp
servlet.gnujsp.initArgs=usepackages=true
servlet.gnujsp.initArgs=checkdependancies=true,checkclass=true
servlet.gnujsp.initArgs=builtin-javac
-classpath %classpath%:%scratchdir%:/usr/local/gnujsp/lib/gnujsp10.jar
-d %scratchdir%
-deprecation %source%

#mkdir /usr/local/apache/jsp
#chown nobody.nobody /usr/local/apache/jsp

注:httpd.conf->jserv.conf->jserv.properties->alphzone.properties

(十七)测试JSP
#cp /usr/local/gnujsp/samples/*.jsp /usr/local/apache/htdocs
测试:httpd://XXX.XXX.XXX.XXX/hello.jsp
测试:httpd://XXX.XXX.XXX.XXX/date.jsp
测试:httpd://XXX.XXX.XXX.XXX/snonp.jsp

如果测试未成功则:
#cd /usr/local/gnujsp/apache
#chmod 755 check-gnujsp-conf
#./check-gnujsp-conf /usr/local/jserv/etc/jserv.conf|more

如果有错误提示,会在第一行

热门栏目