Wednesday, August 20, 2014

Installing tomcat7 on ubuntu


Follow the steps to install tomcat7 system  wide but before that install java.
Open a terminal by Ctrl+Alt+T

1.Run the following command to install tomcat7
   sudo apt-get install tomcat7
 
   This command will install tomcat7 with default settings under ROOT. Then open a browser and     go to  http://localhost:8080/ . A defualt page will display "It works..." .

2. Install tomcat documentation by the following command
    sudo apt-get install tomcat7-docs

3. Install web apps to administer tomcat server
    sudo apt-get install tomcat7-admin

4.Now to access manager webapp and the host-manager webapp page (This link will be there at     "It works" page). username and password is required. To set username and password centrally

    sudo su
    sudo gedit /etc/tomcat7/tomcat-users.xml
  
    Above command will open a text editor. Then find the following lines in that editor
            <tomcat-users>
               ..........
            <tomcat-users/ >
           
    Then inside this tag put the following lines:
             <user username="admin" password="admin" roles="admin-gui,manager-gui"/ >
     use your own username and password.
   
     To get the effect now restart the tomcat service by the following command
     sudo service tomcat7 restart
     
     After completing this task use the username and password when authentication pop up comes.
     This will let you administer the tomcat through web interface.

5.  If it is required to change the HTTP connector port which is by default 8080 to avoid conflict
     sudo gedit /etc/tomcat7/server.xml   
     Above command will open a text editor. Now find the following lines and change the port 8080 
     to the desired one.
               <Connector port="8080" protocol="HTTP/1.1"
                    connectionTimeout="20000"
                    URIEncoding="UTF-8"
                    redirectPort="8443"/ >
     
     To get the effect now restart the tomcat service by the following command
     sudo service tomcat7 restart
 
     Now open a web browser and go to http://localhost:yourport/ . "It works".... will be displayed.
      

No comments:

Post a Comment