Install
Apache Tomcat 7 on Ubuntu
This
about installing Apache Tomcat7 on Ubuntu 12.04, follow the steps
given below.
Note:
Before this installation make sure java is installed in your machine.
Step
2. Go to the location “Downloads” and unpack it.
cd
/home/sanjeeva/Downloads
tar
xvzf apache-tomcat-7.0.42.tar.gz
Step
3. Move to the share file location which is in your
machine by using
sudo
mv apache-tomcat-7.0.42/ /usr/share/tomcat7
Step
4. Check the installed java in your machine
echo
$JAVA_HOME
Step
5. Open startup.sh and paste the JAVA_HOME & JRE_HOME
gedit
/usr/share/tomcat7/bin/startup.sh
paste
the below 2 lines as per your java home:
#!/bin/sh
JAVA_HOME="/usr/lib/jvm/java-1.7.0-openjdk-i386"
JRE_HOME="/usr/lib/jvm/java-1.7.0-openjdk-i386/jre"
Sometime
this is not allow to edit the startup.sh, since it is having only the
root permission. Therefore you have to log as a super user by
entering “su” command and root password.
Once
you logged change the permission on “startup.sh” and exit. Now
you will able to edit that file.
Step
6.
Open tomcat-users.xml and uncomment user and role entries there.
gedit
/usr/share/tomcat7/conf/tomcat-users.xml
Add
a manager-gui role and a user by adding following lines there.
<tomcat-users>
<role
rolename="manager-gui"/>
…..
<user
username="sanjeeva" password="tomcat"
roles="manager-gui"/>
To
start the tomcat
sh
/usr/share/tomcat7/bin/startup.sh
Console
out put wiil be
Using
CATALINA_BASE: /usr/share/tomcat7
Using
CATALINA_HOME: /usr/share/tomcat7
Using
CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using
JRE_HOME: /usr/lib/jvm/java-1.7.0-openjdk-i386
Using
CLASSPATH:
/usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Then
Check the http://127.0.0.1:8080
To
shutdown the tomcat
sh
/usr/share/tomcat7/bin/shutdown.sh