tomcat7 on ubuntu maverick

8
Diego Benna's Blog LUNEDÌ 10 GENNAIO 2011 Install Tomcat 7 on Ubuntu 10.10 and Ubuntu 10.04 Apache has officially launched version 7.0 of the servlet container for Java applications, Tomcat. Major changes in this version, you can highlight support for Servlet 3.0 and JavaServer Pages 2.2. Install JDK See this post: Install JDK 6 update 23 in Ubuntu 10.10 Installation The first thing to do is download the package "apache-tomcat-7.0.6.tar.gz" from the NEXT link http://tomcat.apache.org/download-70.cgi [tar.gz] Now unpack it with the following command: tar xvzf apache-tomcat-7.0.8.tar.gz Then we let in a more appropriate directory, in our case in / usr/share/tomcat7, but can be Cerca powered by CERCA NEL BLOG Install Tomcat 7 on Ubuntu 10.10 and Ubuntu 10.04 Install JDK 6 update 23 in Ubuntu 10.10 Connect Tomcat 7 with Apache2 (mod_jk) and install Virtual Host Install PostgreSQL 8.4 on Ubuntu 10.10 Install PostgreSQL 9.0 on Ubuntu 10.10 Preventing Tomcat java.lang.OutOfMemoryError : PermGen space failure How to increase heap size in Tomcat 6 Install eclipse ide on ubuntu 10.10 POST PIÙ POPOLARI RECENT COMMENTS Berbagi Laporkan Penyalahgunaan Blog Berikut» Buat Blog Masuk

Upload: sofyan

Post on 27-Oct-2014

325 views

Category:

Documents


1 download

DESCRIPTION

konfigurasi tomcat

TRANSCRIPT

Diego Benna's Blog

L U N E D Ì 1 0 G E N N A I O 2 0 1 1

Install Tomcat 7 on Ubuntu 10.10 and Ubuntu 10.04

Apache has officially launched version 7.0 of the servlet container for Java applications,Tomcat. Major changes in this version, you can highlight support for Servlet 3.0 andJavaServer Pages 2.2.

Install JDKSee this post: Install JDK 6 update 23 in Ubuntu 10.10

Installation

The first thing to do is download the package "apache-tomcat-7.0.6.tar.gz" from the NEXTlink

http://tomcat.apache.org/download-70.cgi [tar.gz]

Now unpack it with the following command:

tar xvzf apache-tomcat-7.0.8.tar.gz

Then we let in a more appropriate directory, in our case in / usr/share/tomcat7, but can be

Cerca

powered by

CERCA NEL BLOG

Install Tomcat 7 on Ubuntu10.10 and Ubuntu 10.04

Install JDK 6 update 23 inUbuntu 10.10

Connect Tomcat 7 withApache2 (mod_jk) andinstall Virtual Host

Install PostgreSQL 8.4 onUbuntu 10.10

Install PostgreSQL 9.0 onUbuntu 10.10

Preventing Tomcatjava.lang.OutOfMemoryError: PermGen space failure

How to increase heap sizein Tomcat 6

Install eclipse ide on ubuntu10.10

POST PIÙ POPOLARI

RECENT COMMENTS

Berbagi Laporkan Penyalahgunaan Blog Berikut» Buat Blog Masuk

in any directory. We do this with the command:

sudo mv apache-tomcat-7.0.8/ /usr/share/tomcat7

Now we define the environment variables JAVA_HOME and JRE_HOME. This file is inthe "environment" in / etc. Command to edit the file:

sudo gedit /etc/environment

Here we record the routes where we have installed Java in my case this is as follows:

JAVA_HOME="/usr/local/jdk1.6.0_23"JRE_HOME="/usr/local/jdk1.6.0_23/jre"PATH="...(other path):$JAVA_HOME:$JRE_HOME"

IMPORTANT: Verify the routes where they have installed Java.

I have had some problems in defining these environment variables, as sometimes tomcatdoes not recognize, but a surefire way of recognizing that tomcat is to define the file pathsinside "catalina.sh"located in tomcat7/bin. To modify this file use the command:

sudo gedit /usr/share/tomcat7/bin/catalina.sh

Now just insert the JAVA_HOME and JRE_HOME after the first line, so the file is asfollows:

#!/bin/shJAVA_HOME="/usr/local/jdk1.6.0_23"JRE_HOME="/usr/local/jdk1.6.0_23/jre"# Licensed to the Apache Software Foundation (ASF)...#...#.......

Now let's configure Tomcat users, this is done in the file "tomcat-users.xml"directorytomcat7/conf. Command to edit the file:

sudo gedit /usr/share/tomcat7/conf/tomcat-users.xml

Unlike previous versions where the administrator should own role "manager" now it shouldbe "manager-gui"to operate on the web administration tomcat7. The file would be asfollows:

<?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"/>

key wrote...He did not know about Africa,the other elephants in thejungles and deserts. Sofia onlyknew the...Continue >>

Vipblue wrote...fiction writingsmall houseplansTheir fellow camperswere starting to wake up. Firstto stir were...Continue >>

Vipblue wrote...fiction writingsmall houseplansWater flowing out of theColorado Rocky Mountains is avery...Continue >>

Vipblue wrote...fiction writingsmall houseplansHowever, its looks, speedand sailing qualities wassecondary to...Continue >>

Admin wrote...After a quick tour of the girls’tent, which was slightly smallerthan the boys’, thoughwithout...Continue >>

Diego Benna

Visualizza ilmio profilocompleto

INFORMAZIONI PERSONALI

ISCRIVITI A

Post

Commenti

ubuntu (26) install (17)diego benna (9) java 6 (9)apache tomcat (8) javafx (7)JDK (4) running (4) tomcat 7(4) website (4)

ETICHETTE

</tomcat-users>

Now you should be all ready to try tomcat7.

First we must lift the server with the following command:

sudo /usr/share/tomcat7/bin/startup.sh

With this we get the following output on console:

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

Verify that the JRE_HOME is where we define.

Now open your web browser and type the following url:

http://127.0.0.1:8080/

So we get the following page:

If we enter the administration Tomcat Manager we click on the menu or directly at URL:

http://127.0.0.1:8080/manager/html

Here we ask the user data from previous record in mind tomcat-users.xml.

I recommend testing the sample to make sure everything works ok, they are in the section"Miscellaneous" from the side menu or at the URL:

http://127.0.0.1:8080/examples/

Commands

Start server:

sudo /usr/share/tomcat7/bin/startup.sh

Stop server:

sudo /usr/share/tomcat7/bin/shutdown.sh

▼▼ 2011 (53)

►► ottobre (10)

►► maggio (2)

►► aprile (4)

►► febbraio (22)

▼▼ gennaio (15)

Transfer files through ssh

Make a script on Ubuntu

VirtualBox Shared folderson Ubuntu 10.04 client

How To Install VirtualboxGuest Additions On AUbu...

Firefox 4.0 Beta 9Available forDownload – Get Yo...

Install Tomcat 6 onUbuntu

Polifemo: Working CapitalTour 2010 Padova: inthe...

Polifemo: Prize to the"brains" that do notmigrat...

Preventing Tomcatjava.lang.OutOfMemoryError: Perm...

Connect Tomcat 7 withApache2 (mod_jk) andinstall...

Install Apache2 withPHP5 and MySQLsupport on Ubu...

Install JDK 6 update 23 inUbuntu 10.10

Install PostgreSQL 8.4 onUbuntu 10.10

Install Tomcat 7 onUbuntu 10.10 andUbuntu 10.04

Polifemo

►► 2009 (6)

ARCHIVIO BLOG

LETTORI FISSI

Pubblicato da Diego Benna a 2:25 AM

Reazioni:

Automatic Starting

To make tomcat automatically start when we boot up the computer, you can add a scriptto make it auto-start and shutdown.

sudo gedit /etc/init.d/tomcat7

Now paste in the following:

# Tomcat auto-start

#

# description: Auto-starts tomcat

# processname: tomcat

# pidfile: /var/run/tomcat.pid

case $1 in

start)

sh /usr/share/tomcat7/bin/startup.sh

;;

stop)

sh /usr/share/tomcat7/bin/shutdown.sh

;;

restart)

sh /usr/share/tomcat7/bin/shutdown.sh

sh /usr/share/tomcat7/bin/startup.sh

;;

esac

exit 0

You’ll need to make the script executable by running the chmod command:

sudo chmod 755 /etc/init.d/tomcat7

The last step is actually linking this script to the startup folders with a symbolic link.Execute these two commands and we should be on our way.

sudo ln -s /etc/init.d/tomcat7 /etc/rc1.d/K99tomcat

sudo ln -s /etc/init.d/tomcat7 /etc/rc2.d/S99tomcat

Tomcat should now be fully installed and operational. Enjoy!

sudo /etc/init.d/tomcat7 restart

4 persone hanno fatto +1

29 commenti:

Unisciti a questo sitoUnisciti a questo sitocon Google Friend Connect

Membri (7)

Sei già un membro? Accedi

Anonimo Feb 6, 2011 10:03 PM

Excelente post Diego!!Muy útil!

Rispondi

Anonimo Feb 9, 2011 07:05 AM

the best ! 10x !

Rispondi

Anonimo Mar 16, 2011 04:15 PM

Thanks.Is there an apt-get equivalence?

Rispondi

Diego Benna Mar 19, 2011 02:08 AM

Why? :)

Rispondi

Anonimo Apr 6, 2011 05:15 PM

can you explain difference between /etc/environment here and in install jdk 6blog? Actually i think on this: JAVA_HOME="/usr/local/jdk1.6.0_23". Is it okwithout bin directory.

Sorry, i'm complete noob, so i need explaination.Thanks anyway

Rispondi

Bernardo Apr 8, 2011 06:30 AM

Grazie mille, Diego! Sei stato moltíssimo gentile!

Rispondi

Darrell Apr 17, 2011 12:56 PM

FYI -- I just successfully used this and related posts to upgrade my Ubuntu 10.04java to 1.6.0_24 and to install Tomcat 7.0.12.

Now I'm coding/debugging/testing my new java servlet. All this on a Dell LatitudeD610 with 1 gig of ram. Hums along nicely.

Thank you for these clear instructions.

Rispondi

Anonimo May 3, 2011 01:30 PM

Getting Tomcat going is usually a time consuming frustration. I was fearing it tobe even worse since this is the first time in years I was going to do it on anUbuntu box. The Linux people love to shuffle Java directories around.

Your post was extremely useful and convenient.

Thank you very kindly for posting it.

Steve

Rispondi

Diego Benna May 5, 2011 02:36 AM

XD Thank you! this is tested!!

Rispondi

Anonimo May 15, 2011 05:45 PM

I needed this badly. The explanation is easy to understand. It worked for me.Thank you.

Rispondi

lepew Jun 9, 2011 12:39 PM

thank you for your generous post from quebec canada :) STEF

Rispondi

Anonimo Jun 21, 2011 06:08 AM

wow... very easy! i love you man...you save a lot of time mine

Rispondi

sepehr Jun 30, 2011 01:17 PM

I don't know why but startup part didn't work for me after 1 hour of struggle Iended up running this command:#update-rc.d tomcat7 defaultsthe only different was the name of symbolic links:S20tomcat7 for S99tomcat andK01tomcat7 for K99tomcat.

Rispondi

Erik Jul 19, 2011 06:06 AM

I tried to install tomcat7 but I had some difficulties. Having read your post and thecomments I have found the facts which helped me a lot and I fixed everything.

Rispondi

Tim Aug 2, 2011 01:17 PM

Rispondi

Tim Aug 2, 2011 01:20 PM

"I have had some problems in defining these environment variables, assometimes tomcat does not recognize..."The problem you are facing is that your /etc/sudoers is configured withDefaults env_resetOne has to run your slightly modified command to use system-wide environmentvariables:sudo -E /usr/share/tomcat7/bin/startup.sh

Rispondi

Anonimo Aug 7, 2011 02:41 AM

Excellent tutorial, straight to the point. Good work.

Rispondi

Anonimo Aug 7, 2011 10:59 AM

Good guide!

Rispondi

Anonimo Aug 24, 2011 08:10 PM

Thanks really. I really needed to get this going. Fairly easy to understand.

Rispondi

dimochka1111 Sep 6, 2011 09:06 AM

Great. Now that this path was used /usr/share/, the sysaid installation is notworking. And I can not remove tomcat7 anymore, because ubuntu doesnt find thepackage.

Rispondi

dimochka1111 Sep 6, 2011 09:11 AM

HOW DO I REMOVE IT ??

Rispondi

Roger Sep 18, 2011 07:28 AM

Don't run tomcat as root! That's not very secure. Create a special tomcat user,run tomcat as that, and you'll probably need to change the rights for some foldersto that tomcat user.

Rispondi

Roger Sep 18, 2011 07:31 AM

@dimochkaJust remove the folder /usr/share/tomcat7, and remove the automatic startupscript if you use that. Follow the steps backward, and you should be fine.

However, removing the automatic startup script, and stopping tomcat is probablygood as well. It won't do any harm if you leave it installed.

Rispondi

Anonimo Nov 25, 2011 04:37 AM

Great explanation Diego!!!

One strange thing that it happened to me and I do not know why. I installedTomcat 7.0.22 in an Ubuntu Server 11.04. When I access Tomcat from my clientlaptop, an Ubuntu 10.04, via Chrome the tomcat homepage is in English, butsome other tomcat pages like "List of applications" are in Spanish. I installed bothsystem, Ubuntu server and Ubuntu desktop in English. The only Spanish thinginstalled is the Spanish keyboard in the Ubuntu desktop because sometimes Ineed to write in Spanish, but the laptop is British. So rare, isn't it?

Any idea?

Rispondi

Anonimo Nov 25, 2011 05:31 AM

One more thing, in firefox doesn't happen. Everything is in English, so what'sgoing on in Chorme?

Rispondi

dark-star1 Dec 12, 2011 08:24 AM

Thanks for the follow through I was able to use this with JDK1.7.01 and tc7.

Rispondi

Anonimo Dec 14, 2011 07:48 AM

Possibly dumb question - but why are you writing to rc1.d and rc2.d? Wouldn'tyou only want tomcat to start in runlevels 3 and 5 - with the network? And is therea reason not to use update-rc.d?

Rispondi

Anonimo Jan 11, 2012 11:53 PM

amazing! step by step, congrats!!!

Rispondi

Dp Jan 16, 2012 09:13 PM

Post più recente Post più vecchioHome page

Iscriviti a: Commenti sul post (Atom)

Inserisci il tuo commento...

Commenta come: Seleziona profilo...

Pubblica Anteprima

thx for the post.

Rispondi

Modello Simple. Immagini dei modelli di merrymoonmary. Powered by Blogger.