Id like to use
tomcat (user) to startup tomcat server. Not root. Can you help figure out where i am going wrong?
$su -p -s /bin/sh tomcat $CATALINA_HOME/bin/startup.sh
--Detailed question --
I have a question about setting up Tomcat 7 on ubuntu server. In short, I am unable to start tomcat server using my user (user: tomcat; group: tomcat). I am able to get it started and showing the default welcome page using root. I posted similar on unbuntu forum. hope that is ok.
I would like assistance understanding how to get tomcat server running with the correct user.
Here is some basic information.
My capabilities:
I am new to Linux; taken one intro course. I can navigate around ok...I will research commands or switches if I dont understand one you've recommended. I may ask why a specific switch is used in a situation.
My objective:
I want to run
JSP pages on tomcat 7; and learn to secure the web server.
My goal is to convert over to JSP from visual basic. I've been learning
Java, Java
Servlets over the past year and half. I've always used tomcat, glassfish embedded in Eclipse and Netbeans. I would like to completely setup tomcat server so i can replicate on a virtual server provided by a web hosting company.
My computer is running:
Ubuntu Server, with Linux 2.6.38-13-server x86_64
ubuntu 11.04 server
Probably too much information:
- I have installed from CD, no server options selected (ftp, dns, samba, lamp, etc).
- Updated repository: apt-get update
- Upgraded files: apt-get upgrade
- Upgraded Distribution: apt-get dist-upgrade
- Added sysstat, enabled system activity reporting (SAR)
- Added nmap
- Downloaded and installed openjdk-6-jre and openjdk-6-jdk
Tomcat Download:
Retrieved tomcat 7 from apache.hoxt.com
$wget apache.hoxt.com/tomcat/tomcat-7/v7.023/bin/apache-tomcat-7.023.tar.gz
Extracted files and set in permanent location:
$tar xzvf apache-tomcat-7.0.23.tar.gz
$sudo mv apache-tomcat-7.0.23 /var/lib/tomcat
Set environment variables (I chose in /etc/environment):
$sudo vi /etc/environment
CATALINA_HOME="/var/lib/tomcat"
CATALINA_BASE="/var/lib/tomcat"
JAVA_HOME="/usr/lib/jvm/java-1.6.0-openjdk"
Created tomcat group & user and changed ownership of Tomcat directory
$groupadd tomcat
$useradd -g tomcat -s /sbin/nologin -m -d /home/tomcat tomcat
$passwd tomcat
$chown -R tomcat.tomcat /var/lib/tomcat
Changed Permissions of tomcat log directory
$sudo chmod -R 777 /var/lib/tomcat/logs
Changed permissions of server.xml
sudo chmod A=wx /var/lib/tomcat/conf/server.xml
Start up tomcat server. This is where i am stuck...
Following the instructions here, I am trying to start tomcat server using the tomcat user (not root). I am unsuccessful and I am not sure why.
First, I looked at the /Logs/catalina.out log file; which is blank (prior to running the start up script). I attempt to start tomcat server by running the command:
$su -p -s /bin/sh tomcat $CATALINA_HOME/bin/startup.sh
$_
When running this command, there is no output to terminal. I also checked the catalina.out log file and it is still blank. So i do not understand why no response. I thought i would see an error message at terminal output if command or any parameters are wrong.
Now if i run the command below using sudo, it starts up and i see the start up log entries recorded in catalina.out
$sudo sh startup.sh
Using CATALINA_BASE: /var/lib/tomcat
Using CATALINA_HOME: /var/lib/tomcat
Using CATALINA_TMPDIR: /var/lib/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/lib/tomcat/bin/bootstrap.jar:/var/lib/tomcat/bin/tomcat-juli.jar
$ _
And tomcat welcome page is working.
My question again: Do you have advice on how to use tomcat user to start Tomcat 7 server?
Thank you for your assistance! Gregg