博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
tomcat配置安装1
阅读量:5923 次
发布时间:2019-06-19

本文共 4578 字,大约阅读时间需要 15 分钟。

一.安装启动apache

# netstat -tnlp |grep 80      

tcp       0      0 :::80                       :::*                        LISTEN      1960/httpd

二、单独使用Tomcat

]# rpm -qa |grep java

java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

# rpm -e --nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

# java -version

-bash: /usr/bin/java: 没有那个文件或目录

==安装JDK

# rpm -ivh jdk-7u11-linux-i586.rpm   如果装不上就加上--force强行

]# java -version

java version "1.7.0_11"

Java(TM) SE Runtime Environment (build1.7.0_11-b21)

Java HotSpot(TM) Client VM (build 23.6-b04,mixed mode, sharing)

# ls /usr/java/jdk1.7.0_11

# vim /etc/profile                 设置环境变量

JAVA_HOME=/usr/java/jdk1.7.0_11

PATH=$PATH:$JAVA_HOME/bin

export JAVA_HOME PATH

# source /etc/profile

#echo$PATH /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:

/root/bin:/usr/java/jdk1.7.0_11/bin

==Tomcat

# tar xvf apache-tomcat-7.0.34.tar.gz -C/usr/local/

# cd /usr/local/

# ln -sv apache-tomcat-7.0.34 tomcat

创建指向“apache-tomcat-7.0.34”的符号链接“tomcat

# vim /etc/profile   定义Tomcat环境变量

CATALINA_HOME=/usr/local/tomcat

export CATALINA_HOME

# source /etc/profile

# env |grep HOME

CATALINA_HOME=/usr/local/tomcat

JAVA_HOME=/usr/java/jdk1.7.0_11

HOME=/root

# /usr/local/tomcat/bin/catalina.sh start   启动

Using CATALINA_BASE:   /usr/local/tomcat

Using CATALINA_HOME:   /usr/local/tomcat

Using CATALINA_TMPDIR:/usr/local/tomcat/temp

Using JRE_HOME:        /usr/java/jdk1.7.0_11

Using CLASSPATH:      /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar

# netstat -tnlp

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State      

PID/Program name

tcp       0      0::ffff:127.0.0.1:8005       :::*                        LISTEN      2920/java

tcp       0      0 :::8009                     :::*                        LISTEN      2920/java

tcp       0      0 :::8080                     :::*                        LISTEN      2920/java

tcp       0      0 :::80                       :::*                        LISTEN      2135/httpd

System V脚本可选项

# vim /etc/init.d/tomcat

#!/bin/bash

# Init file for Tomcat server daemon

#

# chkconfig: 2345 96 14

# description: Tomcat server daemon

JAVA_OPTS='-Xms64m -Xmx128m'

JAVA_HOME=/usr/java/jdk1.7.0_11

CATALINA_HOME=/usr/local/tomcat

export JAVA_OPTS JAVA_HOME CATALINA_HOME

exec $CATALINA_HOME/bin/catalina.sh $*

# chmod a+x /etc/init.d/tomcat

# chkconfig tomcat --list

tomcat 服务支持 chkconfig,但它在任何级别中都没有被引用(运行“chkconfig--add tomcat)

# chkconfig --add tomcat

# chkconfig tomcat --list

tomcat         0:关闭 1:关闭  2:启用  3:启用 4:启用  5:启用  6:关闭

]# chkconfig tomcat on

# service tomcat stop

Using CATALINA_BASE:   /usr/local/tomcat

Using CATALINA_HOME:   /usr/local/tomcat

Using CATALINA_TMPDIR:/usr/local/tomcat/temp

Using JRE_HOME:        /usr/java/jdk1.7.0_11

Using CLASSPATH:      /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar

# service tomcat start

Using CATALINA_BASE:   /usr/local/tomcat

Using CATALINA_HOME:   /usr/local/tomcat

Using CATALINA_TMPDIR:/usr/local/tomcat/temp

Using JRE_HOME:        /usr/java/jdk1.7.0_11

Using CLASSPATH:      /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar

=================================================

测试:

http://192.168.0.118 /   IP是自己电脑的IP

groupinstall 组安装一组一组的不用写yes

安装tomcat-native

# yum groupinstall -y "Developmenttools" "Development libraries"        

# yum -y install openssl-devel apr-devel

# cd /usr/local/tomcat/bin/

# ls

bootstrap.jar       commons-daemon-native.tar.gz  digest.bat        shutdown.sh           tool-

wrapper.bat

catalina.bat        configtest.bat                digest.sh         startup.bat           tool-

wrapper.sh

catalina.sh         configtest.sh                 setclasspath.bat  startup.sh            

version.bat

catalina-tasks.xml  cpappend.bat                  setclasspath.sh   tomcat-juli.jar      

version.sh

commons-daemon.jar  daemon.sh                     shutdown.bat      tomcat-native.tar.gz

# tar xf tomcat-native.tar.gz    

# cd tomcat-native-1.1.24-src/jni/native/

# ls

build      build-outputs.mk  include          NMAKEmakefile      srclib

buildconf  config.layout    libtcnative.dsp  NMAKEmakefile.inc  tcnative.dsp

build.conf configure        libtcnative.dsw  os                 tcnative.pc.in

BUILDING   configure.in      Makefile.in      src                tcnative.spec

# ./configure --with-apr=/usr/ --with-ssl--with-java-home=/usr/java/jdk1.7.0_11/

# make && make install  这可能会报错  yum –y install java

# echo "/usr/local/apr/lib" >/etc/ld.so.conf.d/apr.conf搜索库文件的路径给他添加库文件路径

# ldconfig  重新加载库文件

为查看Tomcat运行状态添加用户

/usr/local/tomcat/conf/server.xml   Tomcat配置文件

[root@node1 ~]# vim /usr/local/tomcat/conf/tomcat-users.xml

<tomcat-users>

<role rolename="manager-gui"/>

<rolerolename="manager-scripts"/>

<rolerolename="manager-status"/>

<user username="tomcat"password="123456"roles="manager-gui,manager-scripts,manager-status"/>

</tomcat-users>

# service tomcat stop

# service tomcat start

然后就可以在刚才tomcat页面最右面的 Server status 输入帐号tomcat 密码123456  在最下面有后台运行状

 S   sleep状态

=================================================

      本文转自潘阔 51CTO博客,原文链接:http://blog.51cto.com/pankuo/1369774,如需转载请自行联系原作者

你可能感兴趣的文章
计算机图形学当中的光照模型
查看>>
VC 2008 Express下安装OpenCV2.3.1
查看>>
IT面试之全排列
查看>>
js-className
查看>>
Solr5安装配置
查看>>
linux下的i2c与时钟芯片pcf8563通信
查看>>
Spring——jar包详解
查看>>
关于setInterval与setTimeout作用域问题
查看>>
【转】NodeJS之process进程
查看>>
5、外观模式
查看>>
那些证书相关的玩意儿(SSL,X.509,PEM,DER,CRT,CER,KEY,CSR,P12等)
查看>>
详解Android中那些酷炫返回方式的实现
查看>>
微信开发遇到的坑
查看>>
阅读源码的心得
查看>>
Bacula Fileset资源翻译文档
查看>>
回归的线性模型---偏置-方差分解
查看>>
概率与信息论---边缘概率
查看>>
systemd-journald CPU高
查看>>
Java简单权限系统
查看>>
Linux下的jdk1.5+eclipse+mysql开发环境配置的经验总结
查看>>