Linux下jdk,tomcat,apache,mysql的安装配置

操作系统:centos 5.8

1、常用命令:tar -xzvf,yum install xxx,make,make install,./configure --prefix=path

2、配置网络 ,直接找到网络相关文件配置。

3、安装jdk.bin文件

安装完成后,配置JAVA_HOME,PATH,CLASS_PATH等参数,编写简单 java文件测试是否安装成功 ,简单写个测试类测试即可。

4、JDK安装完成后,安装apache-tomcat,直接解压即可,启动,测试tomcat是否安装成功。

5、安装apache,处理静态请求。

到apache官网get到http server ,找一个稳定版本下载。

  发现依赖apr-1.4.6.tar.gz,apr-util-1.5.2.tar.gz, pcre-8.10.zip

 先解掉依赖后,再安装吧。安装apr过程异常,如下:

[root@localhost apr-1.4.6]# ./configure 

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking target system type... i686-pc-linux-gnu

Configuring APR library

Platform: i686-pc-linux-gnu

checking for working mkdir -p... yes

APR Version: 1.4.6

checking for chosen layout... apr

checking for gcc... no

checking for cc... no

checking for cl.exe... no

configure: error: in `/usr/apache/apr-1.4.6':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details

————是没有安装gcc编译组件造成的。

下载安装gcc组件。centos中安装如下:

1、在centos 用yum install gcc 也很方便

2、不过先要用yum install yum-fastestmirror更新下源,不然太慢了

A、开始安装apr,apr-util,pcre。

B、安装pcre过程中,异常如下:configure: error: You need a C++ compiler for C++ support,没有c++的支持,

下一步安装c++,执行yum install -y gcc gcc-c++命令。

C、以上所有安装完成后,执行安装apache命令,到 apache目录下执行:

./configure --prefix=/usr/apache/apache --enable-so --with-apr=/usr/apache/apr --with-apr-util=/usr/apache/apr-util --with-pcre=/usr/apache/pcre

make

make install,即可完成安装,打开localhost能否看到it works?

6、连接Apache、Tomcat,安装mod_jk.so

1、下载tomcat-connectors-1.2.37-src.tar.gz

2、解压tomcat-connectors-1.2.37-src.tar.gz,进入native文件夹,提示:

[root@sony619 native]# chmod 755 buildconf.sh

[root@sony619 native]#./buildconf.sh

buildconf: checking installation...

buildconf: autoconf not found.

  You need autoconf version 2.59 or newer installed

  to build mod_jk from SVN.

[root@sony619 native]# yum install autoconf

执行[root@sony619 native]#./buildconf.sh 再次提示:

buildconf: libtool not found.

  You need libtool version 1.4 or newer installed

  to build mod_jk from SVN.

解决:

[root@sony619 native]#./yum install libtool。

结束后,到apache-2.0下面找mod_jk.so文件,同时到apache的modules下面找应该会有的,如果没有直接复制过去。

7、mod_jk安装完成后,apache-mod_jk-tomcat三个连接起来。

apache版本是 httpd-2.4.4.tar.gz,相应的jk选择的是tomcat-connectors-1.2.37-src,两者是最新的包,应该可以搭配到一起,至少网上说的版本要对应,没有深入研究过。

下面把mod_jk配置进去。

1.在/etc/httpd/httpd.conf文件中添加,其中mod_jk.so要对应appache的版本.appache2.2.6对应mod_jk-1.2.27-httpd-2.2.6.so,见附件:

LoadModule jk_module modules/mod_jk.so

<IfModule mod_jk.c>

 JkWorkersFile "/etc/httpd/workers.properties"

 JkLogFile "/usr/local/apache/logs/mod_jk.log"

</IfModule>

2.把mod_jk.so添加到apache/modules文件夹中

3.在/etc/httpd文件中添加workers.properties文件,内容如下:

ps=/

worker.list=tomcat

worker.tomcat.port=8888

worker.tomcat.host=localhost

worker.tomcat.type=ajp13

4.配置tomcat中的server.xml文件,如下:

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

5.在/etc/httpd/extra/httpd-vhosts.conf中添加虚拟主机:

<VirtualHost *:80>

    DocumentRoot "/usr/tomcat6/webapps/exhibition"

    ServerName   www.myexhibition.com

    JkMount  /*  tomcat

</VirtualHost>

DocumentRoot中标定server.xml中的webBase保持一致。

6.在/etc/httpd/httpd.conf中引入httpd-vhosts.conf文件,去掉httpd.conf中的httpd-vhosts.conf 前面的#注释即可:

Include /etc/httpd/extra/httpd-vhosts.conf 

手机扫一扫,欢迎关注公众号

关注程序员成长

猜你喜欢

转载自bakcom.iteye.com/blog/1879933