|
Mysql+Tomcat+Apache+jsp整合 安装平台 RedHat7.3、7.2 安装软件 JDK、Tomcat4.1.10、Apache1.3.26、Mysql3.23.52
1) 安装RedHat7.3 安装RedHat72时一定要安装开发工具、FTP和Telnet,不要安装数据库和WWW服务器 创建一个/usr分区,至少要有1G空间,建议分3G,因为本系统所有的然间都安装在该分区 2) 安装JDK 以root用户登录到系统,把下载的jdk ,tomacat,apache,mysql拷到/tmp下
qu1010#cp /tmp/jdk.tar /usr/local/ qu1010# cd /usr/local qu1010#tar xvf jdk.tar j2sdk会解压到该目录。 qu1010#cd /usr/local/jdk/bin/ qu1010#./java 如果出现下面提示,则表示安装成功。 Usage: java [-options] class [args...] (to execute a class) or java -jar [-options] jarfile [args...] (to execute a jar file)
where options include: -client to select the "client" VM -hotspot is a synonym for the "hotspot" VM [deprecated] -server to select the "server" VM -classic to select the "classic" VM If present, the option to select the VM must be first. The default VM is -client.
-cp -classpath <directories and zip/jar files separated by :> set search path for application classes and resources -D<name>=<value> set a system property -verbose[:class|gc|jni] enable verbose output -version print product version and exit -showversion print product version and continue -? -help print this help message -X print help on non-standard options
注意:如果安装的是j2sdk-1_3_1_04,则需要在/usr/lib下面运行如下一条命令 ln –s libstdc++-3-libc6.2-2-2.10.0.so libstdc++-libc6.1-1.so.2
3) 安装Tomcat qu1010#cp /tmp/tomcat.tar /usr/local/ qu1010#cd /usr/local/ qu1010#tar –xvf tomcat.tar qu1010#cd /opt/tomcat/bin 把Tomcat添加在自启动服务中 qu1010# cp /opt/tomcat/bin/catalina.sh /etc/rc.d/init.d/tomcat qu1010#cd /etc/rc.d/init.d/ qu1010#chkconfig --add tomcat
4) 安装Apache qu1010#cd /tmp qu1010#tar –xzvf apache_1.3.26.tar.gz qu1010#cd apache_1.3.26 qu1010#./configure --prefix=/usr/local/apache --enable-module=so qu1010#make qu1010#make install qu1010#cd /usr/local/apache/bin qu1010#./apachectl start 启动Apache 在浏览器地址栏中输入http://IP,如果能看到Apache的欢迎界面,则表示安装成功。 把Apache添加到自启动服务中 qu1010#cp apachectl /etc/rc.d/init.d/ qu1010#cd /etc/rc.d/init.d qu1010#vi apachectl 在该文件的第二行添加如下2行内容 # chkconfig: 2345 90 90 # description: Apache Web Server 把Apache添加到服务中 qu1010#chkconfig –add apachectl
5) 安装Mysql #groupadd mysql (以ROOT身份建立一个mysql组和用户) #useradd mysql –d /usr/local/mysql -g mysql 然后用mysql用户登录 $tar –xzvf mysql-3.23.52.tar.gz $cd mysql-3.23.52 $cd sql 编辑mysqld.cc,在2919行,把Max_connections的值由100改为2000 $./configure --prefix=/usr/local/mysql $make $make install $cd /usr/local/mysql/bin $./mysql_install_db $chmod –R mysql.mysql mysql $/etc/rc.d/init.d/mysql.server start $./ mysqladmin -u root password 'new-password' $./mysqladmin -u root -h hostname(主机名) password 'new-password' $./mysql –u root –p mysql> grant all on *.* to user@host identified by "password" ;(赋给user@host访问数据库的权限 examples mysql>grant all on *.* to root@127.0.0.1 by “111111” $cd mysql-3.23.52/support-files $chmod +x mysql.server $su root #cp mysql.server /etc/rc.d/init.d/ #chkconfig –-add mysql.server 接下来就可以创建数据库了
6) Tomcat连接Apache Tomcat可以和Apache搭配起来为用户提供web服务,因为Apache服务器不能解释jsp程序Tomcat可以解释jsp程序,但是Tomcat做Web服务器效果不好,所以通过Tocmat提供的一些插件(mod_jk或者modweb_app)可以和apache连接起来提供web服务。下面一mod_jk.so为例
配置Apache(把压缩包里的httpd.conf文件拷贝到/usr/local/apache/conf下面即可) 把压缩包的mod_jk.so和mod_jk.c拷贝到/usr/local/apache/libexec/目录下面,修改/usr/local/apache/conf/httpd.conf文件,在该文件的最后部分添加如下内容 # Tomcat Settings LoadModule jk_module libexec/mod_jk.so AddModule mod_jk.c JkWorkersFile "/usr/local/tomcat/conf/workers.properties" JkLogFile logs/mod_jk.log JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " JkMount /*.jsp ajp13 JkMount /servlet/* ajp13
7) 在/usr/local/下建一个目录 (我这里是IBS) 修改系统环境变量 ibs#vi /etc/profile增加如下内容: HOME=/usr/local/ibs if ! echo $PATH | /bin/grep -q "/usr/local/jdk/bin" ; then PATH="/usr/local/jdk/bin:$PATH" Fi
拷一个index.jsp文件到/usr/local/ibs/play/下 重新启动Mysql、Tomcat、Apache,然后在浏览器地址栏中输入http://ip,则可打开index.jsp页面。
qq396125273 发表于 2006-3-9 9:44:01 |
|
|