首页 > 代码库 > tomcat Linux安装

tomcat Linux安装

tomcat依赖jdk软件包,所以先配置jdk.

配置完成后 将下载好的tomcat 解压至/usr/local


tar -xvf apache-tomcat-7.0.70.tar.gz -C /usr/local

配置环境变量

编辑 vim /etc/profile.d/tomcat.sh

添加两行:

export CATALINA_HOME=/usr/local/apache-tomcat-7.0.70
export PATH=$PATH:$CATALINA_HOME/bin

让系统读一下配置文件

source /etc/profile.d/tomcat.sh

之后测试一下是否安装成功:

catalina.sh version

启动命令为:
catalina.sh start

启动后 可以使用
jps

命令来查看


###################################################################################################

要注意的是 /etc/hosts文件中,127.0.0.1 这一行 有没有问题 ,否则 导致启动失败,例如日志中下面的报错

最后 导致 进程关闭
java.net.BindException: Cannot assign requested address
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:383)
at java.net.ServerSocket.bind(ServerSocket.java:328)
at java.net.ServerSocket.<init>(ServerSocket.java:194)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:444)
at org.apache.catalina.startup.Catalina.await(Catalina.java:781)
at org.apache.catalina.startup.Catalina.start(Catalina.java:727)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
Aug 13, 2016 2:43:08 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Aug 13, 2016 2:43:10 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Aug 13, 2016 2:43:12 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Aug 13, 2016 2:43:12 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
Aug 13, 2016 2:43:14 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Aug 13, 2016 2:43:16 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]

tomcat Linux安装