简体   繁体   English

在ubuntu 14.04上安装tomcat 8.0.24

[英]install tomcat 8.0.24 on ubuntu 14.04

I follow the steps largely from https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-14-04 我主要从https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-14-04开始执行这些步骤

Let me iterate the steps I took: 让我重复我采取的步骤:

  1. i logged in as ubuntu user 我以ubuntu用户身份登录
  2. sudo apt-get install tomcat8
  3. sudo groupadd tomcat
  4. sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
  5. cd ~
  6. wget http://apache.mirrors.ionfish.org/tomcat/tomcat-8/v8.0.24/bin/apache-tomcat-8.0.24.tar.gz
  7. sudo mkdir /opt/tomcat
  8. sudo tar xvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1
  9. cd /opt/tomcat
  10. sudo chgrp -R tomcat conf
  11. sudo chmod g+rwx conf
  12. sudo chmod g+r conf/*
  13. sudo chown -R tomcat work/ temp/ logs/
  14. sudo update-alternatives --config java and selected /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java sudo update-alternatives --config java和selected /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
  15. sudo nano /etc/init/tomcat.conf

and typed 并键入

description "Tomcat Server"

  start on runlevel [2345]
  stop on runlevel [!2345]
  respawn
  respawn limit 10 5

  setuid tomcat
  setgid tomcat

  env JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre
  env CATALINA_HOME=/opt/tomcat

  # Modify these options as needed
  env JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
  env CATALINA_OPTS="-Xms512M -Xmx1024M -server -XX:+UseParallelGC"

  exec $CATALINA_HOME/bin/catalina.sh run

  # cleanup temp directory after stop
  post-stop script
    rm -rf $CATALINA_HOME/temp/*
  end script
  1. sudo initctl reload-configuration
  2. sudo initctl start tomcat

which leads to 这导致

tomcat start/running, process 14674

But when I go to http://[ip-address]:8080 nothing happens. 但是当我去http:// [ip-address]:8080时没有任何反应。

Please advise. 请指教。

UPDATE UPDATE

One comment below asked me to look at server.xml inside tomcat root folder bin. 下面的一条评论让我看看tomcat根文件夹bin里面的server.xml。

I have reproduced the following files: 我复制了以下文件:

在此输入图像描述

Which proves that there is no such file inside /opt/tomcat/bin 这证明/ opt / tomcat / bin中没有这样的文件

I have also appended some statements from server.xml below which is inside /opt/tomcat/conf 我还在server.xml下面添加了一些语句, 这些语句位于/opt/tomcat/conf

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Server port="8005" shutdown="SHUTDOWN">

Just use 只是用

sudo chown -R tomcat:tomcat /opt/tomcat

This worked for me after useing the very same manual. 使用完同一本手册后,这对我有用。

If you want clean Ubuntu style package instead, the following should do it... 如果你想要干净的Ubuntu风格包,下面应该做...

mkdir $HOME/tomcat8 && cd $HOME/tomcat8
wget http://mirrors.kernel.org/ubuntu/pool/main/e/ecj/libecj-java_3.10.1-2_all.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/t/tomcat8/libservlet3.1-java_8.0.28-1_all.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/t/tomcat8/libtomcat8-java_8.0.28-1_all.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/t/tomcat8/tomcat8-common_8.0.28-1_all.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/t/tomcat8/tomcat8_8.0.28-1_all.deb
dpkg -i *.deb

However, you're not on PPA. 但是,你没有参加PPA。 This isn't managed by apt anymore. 这不再由apt管理。 You'll need to upgrade it manually whenever an update is made to the packages. 每当对包进行更新时,您都需要手动升级它。

I had the same problem. 我有同样的问题。 I installed Oracle JDK 7 , HOWEVER, I still used JAVA_HOME in tomcat.conf that was pointing to Open JDK : 我安装了Oracle JDK 7 ,但是,我仍然在tomcat.conf中使用指向Open JDK的 JAVA_HOME

env JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre

Make sure you are using the right version of Java. 确保使用正确版本的Java。 For me, I set it in tomcat.conf as follows: 对我来说,我在tomcat.conf设置如下:

env JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre

Then, do ps -ef | grep tomcat 然后,做ps -ef | grep tomcat ps -ef | grep tomcat after re-starting tomcat and you should get something like this if tomcat is running: 重新启动ps -ef | grep tomcat之后ps -ef | grep tomcat如果tomcat运行你应该得到类似的东西:

tomcat    1580     1  9 14:47 ?        00:00:03 /usr/lib/jvm/java-7-oracle/jre/bin/java -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Dja
ger=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Xms128m -Xmx256m -XX:PermSize=128m -XX:MaxPermSize=2
ParallelGC -Djava.endorsed.dirs=/opt/tomcat/endorsed -classpath /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat -Dcat
t -Djava.io.tmpdir=/opt/tomcat/temp org.apache.catalina.startup.Bootstrap start
ubuntu    1607  1423  0 14:48 pts/0    00:00:00 grep --color=auto tomcat

Also, my environment file has the following: 此外,我的environment文件具有以下内容:

export JAVA_HOME="/usr/lib/jvm/java-7-oracle/jre"
export CATALINA_HOME="/opt/tomcat"

Hope this helps! 希望这可以帮助!

Instead of: http://serverip:8080 I used http://localhost:8080 而不是: http:// serverip:8080我使用了http:// localhost:8080

That replacement worked for me. 这个替代对我有用。

I have simple solution for installing any version of apache tomcat on Ubuntu. 我有简单的解决方案在Ubuntu上安装任何版本的apache tomcat。

Simplest Way of Installing any version Apache Tomcat Installation Steps on Ubuntu. 在Ubuntu上安装任何版本Apache Tomcat安装步骤的最简单方法。

  1. Download any version of tomcat you wish to install from apache tomcat official website.(.tar/.zip) 从apache tomcat官方网站下载任何你想要安装的tomcat版本。(。tar / .zip)

  2. Extract the tomcat tar/zip file to any folder/directory in your linux pc. 提取 tomcat的焦油/ zip文件到任意文件夹/目录在你的Linux PC。

  3. Copy the extracted folder to /opt directory directory looks like /opt/tomcat using cp command. 使用cp命令将解压缩的文件夹复制到/ opt目录目录,如/ opt / tomcat

    for eg sudo cp /Documents/apache-tomcat-8-0-24 /opt 例如sudo cp / Documents / apache-tomcat-8-0-24 / opt

    This will copy my apache-tomcat-8-0-24 folder in Documents folder to /opt directory. 这会将Documents文件夹中的apache-tomcat-8-0-24文件夹复制到/ opt目录。

  4. come back to /opt directory /opt cd /opt 回到/ opt目录/ opt cd / opt

  5. you are at /opt run following command sudo chown -R username:username 你在/ opt运行命令sudo chown -R username:username

    for eg sudo chown -R akashgudadhe apache-tomcat-8-0-24 例如sudo chown -R akashgudadhe apache-tomcat-8-0-24

  6. you are at /opt ls -la verify apache present or not 你在/ opt ls -la验证apache是​​否存在

  7. move to apache-tomcat-8-0-24 folder and bin directory inside it 移动到其中的apache-tomcat-8-0-24文件夹和bin目录

    /opt/apacheTomcatName/bin /选择/ apacheTomcatName /箱

  8. you are now at /opt/apacheTomcatName/bin 你现在在/ opt / apacheTomcatName / bin

    run startup.sh file using following command you will see the message tomcat started. 使用以下命令运行startup.sh文件,您将看到tomcat启动的消息。

    for eg /opt/apacheTomcatName/bin/./startup.sh 例如/opt/apacheTomcatName/bin/./startup.sh

  9. This is optional step tail -f logs/catalina.out 这是可选步骤tail -f logs / catalina.out

  10. Open any web browser and type localhost:8080 or type 127.0.0.1:8080 your tomcat installed successfully if not then mail me @ gooddaysky1@gmail.com 打开任何网络浏览器并输入localhost:8080或输入你的tomcat成功127.0.0.1:8080如果没有,请邮寄给我@ gooddaysky1@gmail.com

It will become great pleasure for me if you send me your feedback about my answer @ gooddaysky1@gmail.com ...!!! 如果您向我发送您的回答@ gooddaysky1@gmail.com,我会很高兴... !!!

打开Server.xml并找到<Connector port="9090" protocol="HTTP/1.1" ,这是您的端口号。

You have to write: 你必须写:
cd /opt/tomcat/bin cd / opt / tomcat / bin

and after: 之后:

sudo bash startup.sh sudo bash startup.sh

and all well!!! 一切都很好!!! http://serverip:8080 HTTP:// SERVERIP:8080

NOTE: If you put the port 9090, then PLACED IN YOUR BROWSER http://serverip:9090 注意:如果您将端口9090,然后放置在您的浏览器http:// serverip:9090

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM