当前位置: > Linux服务器 > Tomcat >

tomcat安装与安装过程发生的问题

时间:2016-05-30 17:38来源:linux.it.net.cn 作者:IT

tomact安装

首先安装jdk


[root@aca400fd ~]# tar -zxvf jdk-7u1-linux-i586.tar.gz

[root@aca400fd ~]# mv jdk1.7.0_01/ /usr/local/

[root@aca400fd ~]# vim /etc/profile

JAVA_HOME=/usr/local/jdk1.7.0_01
export JAVA_HOME
CLASSPATH=:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export CLASSPATH
PATH=$JAVA_HOME/bin:$PATH
export PATH

[root@aca400fd ~]# source /etc/profile
[root@aca400fd ~]# echo $JAVA_HOME
/usr/local/jdk1.7.0_01

安装tomact


[root@aca400fd ~]# tar -zxvf apache-tomcat-7.0.23-src.tar.gz

[root@aca400fd ~]# mv apache-tomcat-7.0.23-src/ /usr/local/tomcat7

[root@aca400fd ~]# cd /usr/local/tomcat7/

[root@aca400fd bin]# sh startup.sh 
Using CATALINA_BASE:   /usr/local/tomcat7
Using CATALINA_HOME:   /usr/local/tomcat7
Using CATALINA_TMPDIR: /usr/local/tomcat7/temp
Using JRE_HOME:        /usr/local/jdk1.7.0_01
Using CLASSPATH:       /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
[root@aca400fd bin]# ps -ef |grep tomcat
root      3194     1  9 03:20 pts/1    00:00:01 /usr/local/jdk1.7.0_01/bin/java -Djava.util.logging.config.file=/usr/local/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat7/endorsed -classpath /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat7 -Dcatalina.home=/usr/local/tomcat7 -Djava.io.tmpdir=/usr/local/tomcat7/temp org.apache.catalina.startup.Bootstrap start
root      3212  3062  0 03:20 pts/1    00:00:00 grep tomcat


然后就可以 http://192.168.0.100:8080

在安装过程中遇到了 以下一些问题:


问题(一)
开启tomcat时
[root@aca400fd bin]# sh startup.sh

报以下错误
The file is absent or does not have execute permission
This file is needed to run this program
解决方法:
在tomcat的bin目录下 执行这条命令
chmod +x *.sh  
再次执行 sh catalina.sh通过,然后用sh startup.sh成功启动

问题(二)
root@aca400fd bin]# sh startup.sh 
Using CATALINA_BASE:   /usr/local/tomcat7
Using CATALINA_HOME:   /usr/local/tomcat7
Using CATALINA_TMPDIR: /usr/local/tomcat7/temp
Using JRE_HOME:        /usr/local/jdk1.7.0_01
Using CLASSPATH:       /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar

发现没有启动 ,然后关闭 提示以下错误:

[root@aca400fd bin]# sh shutdown.sh 
Using CATALINA_BASE:   /usr/local/tomcat7
Using CATALINA_HOME:   /usr/local/tomcat7
Using CATALINA_TMPDIR: /usr/local/tomcat7/temp
Using JRE_HOME:        /usr/local/jdk1.7.0_01
Using CLASSPATH:       /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
Error: dl failure on line 875
Error: failed /usr/local/jdk1.7.0_01/jre/lib/i386/client/libjvm.so, because /usr/local/jdk1.7.0_01/jre/lib/i386/client/libjvm.so: cannot restore segment prot after reloc: Permission denied

解决方法:
原因是selinux的问题,selinux的设置太过严格导致的。解决的办法是在root用户下,修改/etc/selinux/config 文件

root@aca400fd client]# vi /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

将selinux关闭。就OK了。

问题(三)

开启的时候提示这:
root@aca400fd bin]# sh startup.sh 
Could not find or load main class org.apache.catalina.startup.Bootstrap
版本冲突 ,换了一个就OK了。




(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容