Installing Tomcat on Ubuntu

Hi friends,
 If you are done with JDK installation into your system(explained in the previous blog), Now will see how can we install tomcat (the process will be same for any version)

1. Download the package "apache-tomcat-7.0.6.tar.gz" from the below link
                       http://tomcat.apache.org/download-70.cgi [tar.gz]


2. Now we need to unpack it with the following command:
tar xvzf apache-tomcat-7.0.8.tar.gz
3. Then move it an appropriate directory, normally prefer /usr/share/tomcat7, or any directory. Using  the command:
sudo mv apache-tomcat-7.0.8/ /usr/share/tomcat7
4. Now define the environment variables JAVA_HOME and JRE_HOME. This file is in the "environment" in / etc. Command to edit the file:
As i told you in my previous tutorial
5. IMPORTANT: Verify the location where they have installed Java.
sometimes tomcat does not recognize the path of JDK, so define the file paths inside "catalina.sh" located in tomcat7/bin. To modify this file use the below command:
sudo gedit /usr/share/tomcat7/bin/catalina.sh
Now insert the JAVA_HOME and JRE_HOME after the first line (it is kind of key represent its value), as follows:
#!/bin/sh
JAVA_HOME="/usr/local/jdk1.6.0_23"
JRE_HOME="/usr/local/jdk1.6.0_23/jre"
# Licensed to the Apache Software Foundation (ASF)...
#...
#...
....
So then tomcat can identify your JDK path when you start tomcat.
6. Now configure Tomcat users,  in the file "tomcat-users.xml" directory tomcat7/conf.  
    to edit the file:
sudo gedit /usr/share/tomcat7/conf/tomcat-users.xml
7. Unlike previous versions, the administrator should own role "manager" now it should be "manager-gui"to operate on the web administration tomcat7. The file would be as follows:
<?xml version='1.0' encoding='utf-8'?>

<tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="admin"/>

<user username="usuario" password="contrasena" roles="manager-gui,admin-gui,manager,admin,manager-script,admin-script"/>
</tomcat-users>


To start tomcat use this command line:
sudo /usr/share/tomcat7/bin/startup.sh

You will get output on the console once above command triggered:

Using CATALINA_BASE: /usr/share/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using JRE_HOME: /usr/local/jdk1.6.0_20/jre
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar

To Stop server:
sudo /usr/share/tomcat7/bin/shutdown.sh

 Thanx for reading this stuff, let me know if you have any issue with the installation process.

Comments

Popular posts from this blog

Setting up/Install JDK in Ubuntu/Linux

Set JAVA_HOME / PATH variables In Linux OS

SQLite Setup on Windows