1

i used sudo apt-get install tomcat7 to install tomcat7 on ubuntu 13.04 server, the tomcat installed on my machine but there were few problems :

  1. OpenJDK also installed on my machine and i don't want that (i am using oracke jdk7)
  2. after tomcat installation i couldn't find the webapp folder in which i should deploy my war fies,

so i removed tomcat and downloaded the binary package from apache website . would you please guide me on following matters :

  1. i need to install tomcat as a service for all users (tomcat should be started automatically on system reboot)
  2. all the users should be able to browse the deployed application with their Internet browsers but none of them should be able to delete/modify/create any file in webapp directory without root password

thank you all.

EDIT :

i followed the instruction here http://www.howtogeek.com/howto/linux/installing-tomcat-6-on-ubuntu/ to install tomcat manually as a service

after getting permission errors when trying to start tomcat i used the accepted answer here a lots of (Permission denied) in catalina.out and fixed that. but now for no reason tomcat fails to start and just show me these lines

raysis@raysis-server:~$ sudo /etc/init.d/tomcat start
[sudo] password for raysis: 
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/lib/jvm/jdk1.7.0
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
raysis@raysis-server:~$ 
Community
  • 1
  • 1
MoienGK
  • 4,544
  • 11
  • 58
  • 92

1 Answers1

1

If you want to start tomcat automatically you can add the start script call to /etc/rc.local

If you want to switch the used Java version you can set the JRE_HOME variable inside an own start script or before you call the original start script.

I prefer to write own start scripts. It brings also an alternative to pass other needed environment variables to the process (memory, debug, ...) an you can split separate instances from one installation.

Splitting a separate instance from installation is also the way to get a own webapp directory if you use for instance the standard ubuntu installation

Hope it helps

here is a sample start script ...

#!/bin/bash

# I overwrite the standard ports. you must also modify server.xml in conf to use the variables

HTTP_PORT=8002
SHUTDOWN_PORT=8006
AJP_PORT=8010

export JAVA_OPTS="-Xmx1024m -DmyStuff.http.port=$HTTP_PORT -DmyStuff.shutdown.port=$SHUTDOWN_PORT -DmyStuff.ajp.port=$AJP_PORT -export CATALINA_BASE=/opt/myStuff/tomcat7_inst
# for debugging
export JPDA_TRANSPORT=dt_socket
export JPDA_ADDRESS=9000

# where is my Java VM
export JRE_HOME=/opt/jre1.6.0_37

# call start script from installation
sh /opt/myStuff/tomcat7/bin/catalina.sh jpda start
fedorSmirnov
  • 701
  • 3
  • 9
  • 19
OkieOth
  • 3,604
  • 1
  • 19
  • 29
  • thnx for reply- after downloading tomcat7 should i put it in a specific folder so others will be able to use it? i am very new to ubuntu and linux world can you explain your answer a bit more? – MoienGK May 03 '13 at 09:23
  • I prefer the installation in /opt ... normally this directory is for optional packages. imo if you extract the downloaded package there it's in the spirit of the directory structure – OkieOth May 03 '13 at 10:45
  • @dave ask your questions step by step and I will try to answer – OkieOth May 03 '13 at 10:55
  • the mail question is how to start tomcat globally in ubuntu. i will edit and put more explanation in question – MoienGK May 03 '13 at 11:29
  • @dave I start a chat root where I can describe the installation procedure ... Join 'install tomcat in ubuntu' – OkieOth May 03 '13 at 11:42