[配置]apache+php+jdk+mysql+tomcat+bbs+blog
xxd1019
|
1#
xxd1019 发表于 2007-01-31 16:25
[配置]apache+php+jdk+mysql+tomcat+bbs+blog
参照杨文军老大的贴经过一些改动发给菜鸟兄弟们,配置如下
所需软件 Sun的JDK:jdk-1-5.0_09-linux-i586.bin www.sun.com apache:httpd2.2.4.gz www.apache.org apr-1.2.8.tar.gz apr-util-1.2.8.tar.gz MySQL:mysql-standard-4.1.14-pc-linux-gnu-i686.tar.gz www.mysql.com Php:php-4.4.2.tar.gz www.php.net Tomcat:jakarta-tomcat-5.0.28.tar.gz www.apache/org jakarta-tomcat-connectors-jk2: tomcat-connectors-1.2.20-src.tar.gz libxml-2-2.6.22.roig.tar.gz www.xmlsoft.com PHPwind_gbk-5.0.1.zip BBS www.phpwind.com PWBLOG-GBK-5.1.ZIP blog www.phpwind.com 本文中所有软件安装在/usr/local目录中。 将以上所需要的所有软件上传到/usr/local/src下。 首先可以看看里面的安装说明INSTALL和README。 在安装apache之前先安装apr-util-1.2.7.tar.gz和apr-1.2.7.tar.gz 首先安装apr. cd /usr/local/src tar -xvfz apr-1.2.7.tar.gz cd apr-1.2.7 ./configure --prefix=/usr/local/apr-httpd make make install 再安装apr-util-1.2.7.tar.gz cd /usr/local/src tar -xvfz apr-util-1.2.7.tar.gz cd apr-util-1.2.7 ./configure --prefix=/usr/local/apr-util-httpd --with-apr=/usr/local/apr-httpd make make install 安装apache tar xvfz httpd-2.2.2.tar.gz cd httpd-2.2.2 ./configure --prefix=/usr/local/apache --enable-mods-shared=all --enable-module=most --with-apr=/usr/local/apr-httpd --with-apr-util=/usr/local/apr-util-httpd --enable-so --enable-rewrite make make install 如果没有报错,apache基本安装完毕。 创建一个httpd启动脚本,内容如下: cd /etc/rc.d/init.d touch httpd vi httpd #!/bin/bash # Startup script for the Apache Web Server # 包含函数库 . /etc/rc.d/init.d/functions # 获取网络配置 . /etc/sysconfig/network # 检测 NETWORKING 是否为 "yes" [ "${NETWORKING}" = "no" ] && exit 0 # apache安装目录 APACHE=/home/www/apache # 启动服务函数 start() { echo $"Starting httpd service: " $APACHE/bin/apachectl start RETVAL=$? echo } # 关闭服务函数 stop() { echo $"Stopping httpd service: " $APACHE/bin/apachectl stop RETVAL=$? echo } # 根据参数选择调用 case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo $"Usage: $0 start|stop|restart" exit 1 esac exit 0 保存退出vi chmod 755 httpd chkconfig --level 345 httpd on service httpd restart 安装JDK cd /usr/local/src ./jdk-1_5_0_07-linux-i586.bin ln –s jdk1.5.0_07 /usr/local/jdk 设置JDK环境变量 vi /etc/profile JAVA_HOME=/usr/local/jdk JRE_HOME=$JAVA_HOME/jre LC_ALL=zh_CN.GBK PATH=$JAVA_HOME/binJRE/binPATH CLASSPATH=JAVA_HOME/bin/tools.jarJAVA_HOME/lib/at.jar export JAVA_HOME JRE LC_ALL CLASSPATH PATH source /etc/profile 安装MYSQL 进入mysql目录查看INSTALL-BINARY目录有详细的安装过程 tar xvfz mysql-5.2.22.tar.gz cd mysql-5.2.22 more INSTALL-BINARY groupadd mysql useradd -g mysql mysql cd /usr/local/src ln -s mysql-5.2.22 /usr/local/mysql cd /usr/local/mysql scripts/mysql_install_db --user=mysql chown -R root . (注意.) chown -R mysql data chgrp -R mysql . bin/mysqld_safe --user=mysql & bin/mysqladmin -u root password 123456789 vi /etc/profile MYSQL_HOME=/usr/local/mysql source /etc/profile (击活变量) cp support-files/mysql.server /etc/init.d/mysql vi /etc/init.d/mysql 修改如下为: basedir=/usr/local/mysql datadir=/usr/local/mysql/data chkconfig --level 345 mysql on ntsysv 或 service mysql start 安装php (PHP依赖libxml包) tar xvfz libxml2_2.6.22.orig.tar.gz cd libxml2-2.6.22 ./configure -prefix=/usr/local/libxml make && make install tar -xvfz php-5.1.4.tar.gz cd php-5.1.4 ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --with-libxml-dir=/usr/local/libxml make && make install cp php.ini-dist /usr/local/php/lib/php.ini vi /usr/local/apache2/conf/httpd.conf 系统自动添加了这一行LoadModule php4_module modules/libphp4.so 如果没有就手动添加 必须填入这一行 AddType application/x-httpd-php .php 编辑一个PHP的测试页 touch 1.php vi 1.php<?php phpinfo( ); ?> 重新启动apache /usr/local/apache/bin/apachectl stop /usr/local/apache/bin/apachect1 start 安装tomcat tar xvfz apache-tomcat-5.5.15.tar.gz mv apache-tomcat-5.5.15 /usr/local/tomcat 已编译好的不用make解压开了直接用 安装完后启动测试 http://192.168.10.146:8080 找一个.JSP的测试页放到/usr/local/apache/htdocs下 安装Apache和Tomcat连接 (用的是connectors-jk2版本) tar zxvf jakarta-tomcat-connectors-jk2 cd jakarta-tomcat-connectors-jk2/native/ ./configure --with-apxs=/usr/local/apache/bin/apxs make && make install cd jk/build/jk2/apache2 cp mod_jk2.so /usr/local/apache/modules 设置环境变量 vi /etc/profile HTTP_PATH=/usr/local/apache MYSQL_PATH=/usr/local/mysql TOMCAT_PATH=/usr/local/tomcat JAVA_HOME=/usr/local/jdk JRE_HOME=$JAVA_HOME/jre LC_ALL=zh_CN.GBK CLASSPATH=$JAVA_HOME/bin/tools.jarJAVA_HOME/lib/at.jar PATH=$JAVA_HOME/binHTTP_PATH/binMYSQL_PATH/binTOMCAT_PATH/binPATH export HTTP_PATH MYSQL_PATH JRE_HOME TOMCAT_PATH JAVA_HOME LC_ALL CLASSPATH source /etc/profile (击活变量) Tomcat与Apache的整合 cd /usr/local/apache/conf/ vi httpd.conf 编辑配置文件在其中加入这个模块,保存退出 LoadModule jk2_module modules/mod_jk2.so 然后在这个目录新建一文件workers2.properties vi workers2.properties 添加以下内容 [channel.socket:192.168.10.100:8009] port=8009 host=202.114.33.249 [ajp13:192.168.10.100:8009] channel=channel.socket:202.114.33.249:8009 [uri:/*.jsp] worker=ajp13:192.168.10.100:8009 [uri:/examples/*.jsp] worker=ajp13:192.168.10.100:8009 接下来进入tomcat下的conf目录,在</Host>上加入以下内容 <Context path="" docBase="/usr/local/apache/htdocs" debug="0" reloadable="true" crossContext="true"/> 安装Apache和Tomcat连接(用tomcat-connectors-1.2.20-src.tar.gz版本) 解压 tar -zxvf tomcat-connectors-1.2.20-src.tar.gz cd tomcat-connectors-1.2.20 cd conf/native ./buildconf.sh ./configure --with-apxs=/usr/local/apache/bin/apxs make make install cd apache-2.0/mod_jk.so /usr/local/apache/modules 改httpd.conf文件 cd /usr/local/apache/conf vi httpd.conf LoadModule jk_module modules/mod_jk.so JkWorkersFile "/usr/local/apache/conf/workers2.properties" JkLogFile "/var/log/mod_jk2.log" JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" JkRequestLogFormat "%w %V %T" JkLogLevel debug JkMount /*.jsp worker1 JkMount /helloapp/* worker1 保存退出 touch workers2.properties #注意和上面的路径一致 vi workers2.properties worker.list=worker1 worker.worker1.port=8009 worker.worker1.host=192.168.10.100(本机IP) worker.worker1.type=ajp13 worker.worker1.lbfactor=50 worker.worker1.cachesize=10 worker.worker1.cache_timeout=1800 worker.worker1.socket_keepalive=1 worker.worker1.socket_timeout=300 架设BBS 解压包 unzip PHPwind_gbk-5.0.1.zip 解开后在/usr/local/apache/htdocs下新建目录 bbs 将解压开的UPLOAD下的东西全部拷贝到bbs里 在IE地址栏里输入http://ip/bbs/install.php 按照说明进行安装 设置相应的权限 cd /usr/local/apache/conf vi httpd.conf 找到 添入DirectoryIndex index.html index.htm default.htm default.html index.php index.php3 index.jsp 架设BLOG方法同BBS相同 |