Centos5+Apache2tomcat6+jdk1.6整合安装

作者: admin 分类: linux 发布时间: 2010-09-01 14:31 ė 6 没有评论

先编译安装MYSQL
tar xzvf mysql-4.0.24.tar.gz
cd mysql-4.0.24
./configure –prefix=/usr/local/mysql –with-charset=gb2312 –with-xcharset=all –with-charset=gbk –with-extra-charsets=gbk 指定安装目录 这个可以改
如果您要重新做你的configure,那么你可以键入rm config.cache和make clean来清除记录
make
make install   (卸掉包是makeuninstall 剛學的)
cp support-files/my-medium.cnf /etc/my.cnf   将编译好的文件复制到/etc/底下
配置用户和组
useradd -d /usr/local/mysql/lib/mysql mysql 手工添加帐号并指定目录
cd /usr/local/mysql
bin/mysql_install_db –user=mysql 初始化数据库
chown -R root .
chown -R mysql var .
chown -R mysql .
bin/safe_mysql –user=mysql &
bin/mysql -u root 以ROOT身份登陆
编译好后mysql是手动启动这样很麻烦的 可以改为自动启动
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
chkconfig -add mysql
chkconfig –level 345 mysql on 好了编译完了 嘿嘿

 安装步骤:
jdk-6u3-linux-i586.bin

#chmod u+x jdk-6u3-linux-i586.bin
#./jdk-6u3-linux-i586.

ln -s /usr/local/jdk1.6.0_03 /usr/local/jdk
ln -s /usr/local/jdk1.6.0_03 /jre /usr/local/jre
#vi /etc/profile
加入以下几行
export JAVA_HOME=/usr/local/jdk
export CLASSPATH=$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CATALINA_HOME=/usr/local/tomcat
保存退出。
#source /etc/profile
java –version 查看jdk是否安装成功
httpd-2.2.6.tar.gz
#cp httpd-2.2.6.tar.gz /usr/local
#cd /usr/local
#tar zxvf httpd-2.2.6.tar.gz
#cd httpd-2.2.6
#./configure –prefix=/usr/local/apache –enable-module=so
#make
#make install
启动Apache,并测试。
# cd /usr/local/apache/bin
# ./apachectl start
打开浏览器,并在地址栏中输入主机的IP地址
apache-tomcat-6.0.14.tar.gz
#tar zxvf apache-tomcat-6.0.14.tar.gz
#cp –r apache-tomcat-6.0.14 /usr/local/tomcat
#/usr/local/tomcat/bin/startup.sh
打开
http://localhost:8080
验证tomcat可以启动
整和apache和tomcat
tomcat-connectors-1.2.25-src.tar.gz
#tar zxvf tomcat-connectors-1.2.25-src.tar.gz
进行编译配置。大家一定要注意这几个参数中前三个是很重要的,必要时可以去相应的目录看看相关的文件是否存在。
#cd tomcat-connectors-1.2.25-src/native
# ./ buildconf.sh
#./configure –with-apxs=/usr/local/apache/bin/apxs  –with-tomcat=/usr/local/tomcat –with-java-home=/usr/java/jdk –with-jni
# make
# make install
#ll /usr/local/apache/modules/mod_jk.so
-rwxr-xr-x  1 root root 487769  8月 14 20:40 /usr/local/apache/modules/mod_jk.so
mod_jk.so生成成功了。
编辑apache的配置文件:
#vi /usr/local/apache/conf/httpd.conf
在末尾添加以下几行
# Load mod_jk module
  LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
  JkWorkersFile     /usr/local/apache/conf/workers.properties
# Where to put jk logs
  JkLogFile     /usr/local/apache/logs/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel    info

# Select the timestamp log format
JkLogStampFormat “[%a %b %d %H:%M:%S %Y] ”

# JkRequestLogFormat set the request format
JkRequestLogFormat “%w %V %T”

# JkOptions indicate to send SSL KEY SIZE,
JkOptions  +ForwardKeySize +ForwardURICompat -ForwardDirectories

# Send servlet for context /examples to worker named worker1
#JkMount  /examples/*.jsp worker1
  JkMount  /servlet/* worker1

# Send JSPs  for context /examples to worker named worker1
  JkMount  /*.jsp worker1

创建文件workers.proferties
#vi /usr/local/apache/conf/workers.porperties
添加如下内容:
    workers.tomcat_home=/usr/local/tomcat
    workers.java_home=/usr/local/jdk
    ps=/
    worker.list=worker1
    worker.worker1.port=8009
    worker.worker1.host=localhost
    worker.worker1.type=ajp13
    worker.worker1.connection_pool_timeout=600
    worker.worker1.socket_keepalive=1
    worker.worker1.lbfactor=1
    worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
    worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
5)   配置apache和tomcat的虚拟主机
首先APACHE的虚拟主机设置如下:
修改 conf/httpd.conf找到
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
修改为
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
然后编辑
conf/extra/httpd-vhosts.conf
加入下面的代码
    ServerAdmin oasis.yan@intermobiz.com
    DocumentRoot /data/www/test1
    ServerName test1.ydjxc.com
    DirectoryIndex  index.jsp   
    ErrorLog logs/web_error_log
    CustomLog logs/web_access_log common
  Options -Indexes FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all

    ServerAdmin oasis.yan@intermobiz.com
    DocumentRoot /data/www/test2
    ServerName test2.ydjxc.com
    ServerAlias localhost
    DirectoryIndex  index.jsp
    ErrorLog logs/wap_error_log
    CustomLog logs/wap_access_log common
  Options -Indexes FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
备注:test1/index.jsp的内容如下:

同理为test2/index.jsp
注意:丢掉下面这段代码会提示403错误
  Options -Indexes FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all

其次Tomcat设置虚拟主机
编辑tomcat的配置文件server.xml
在后面添加如下代码

备注:其中这是两段虚拟主机的代码,红色部分为虚拟目录的配置,这样就可以访问
http://test1.ydjxc.com:8080/test2
http://test2.ydjxc.com:8080/test1
特别注意的地方:
在配置文件中找到:
讲其改为:
如果不改的话,输入:
http://ip:8080
就可以直接进入tomcat的管理界面了。
最后重新启动tomcat和apache,我们的安装就完成了
#/usr/local/tomcat/bin/shutdown.sh    //关闭tomcat
#/usr/local/tomcat/bin/startup.sh     //启动tomcat

本文出自 小Q,转载时请注明出处及相应链接。

本文永久链接: http://www.linuxqq.com/archives/144.html

0
更多
Ɣ回顶部