<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>:: syscallme :: &#187; Java</title>
	<atom:link href="http://syscallme.2bopen.org/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://syscallme.2bopen.org</link>
	<description>segfault of my memory leak</description>
	<lastBuildDate>Mon, 26 Jul 2010 10:18:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>VNC via HTTP con Guacamole: vediamolo su Ubuntu!</title>
		<link>http://syscallme.2bopen.org/2010/07/26/vnc-via-http-con-guacamole-vediamolo-su-ubuntu/</link>
		<comments>http://syscallme.2bopen.org/2010/07/26/vnc-via-http-con-guacamole-vediamolo-su-ubuntu/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 10:16:56 +0000</pubDate>
		<dc:creator>daniele</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Medium]]></category>
		<category><![CDATA[Review]]></category>
		<category><![CDATA[guacamole]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://syscallme.2bopen.org/?p=170</guid>
		<description><![CDATA[Come promesso scrivo qualche riga su un&#8217;applicazione che ho provato qualche mese fa e mi ha stupito veramente veramente tanto: Guacamole. No ragazzi, non parlo della (buonissima peraltro) salsa messicana! Guacamole è un viewer  VNC scritto in HTML5 e Javascript, che fa uso di piccolo proxy, server side scritto in Java. Per questo avrete necessità [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="lightbox" href="http://syscallme.2bopen.org/wp-content/uploads/2010/07/guacamole.png"><img class="alignleft size-medium wp-image-174" title="guacamole" src="http://syscallme.2bopen.org/wp-content/uploads/2010/07/guacamole-300x172.png" alt="" width="300" height="172" /></a>Come promesso scrivo qualche riga su un&#8217;applicazione che ho provato qualche mese fa e mi ha stupito veramente veramente tanto: <a href="http://guacamole.sourceforge.net/" target="_blank"><strong>Guacamole</strong></a>. No ragazzi, non parlo della (buonissima peraltro) salsa messicana!</p>
<p>Guacamole è un viewer  VNC scritto in HTML5 e Javascript, che fa uso di piccolo proxy, <em>server side</em> scritto in Java. Per questo avrete necessità di deployarla all&#8217;interno di un qualsiasi <em>servlet container</em>. Io ho sempre utilizzato <a href="http://tomcat.apache.org/">Apache Tomcat</a>.</p>
<p>Utilizzandola avrete la possibilità di accedere al server sul quale è installata da un comunissimo browser compliant con gli standard HTML5; da lì, avrete il &#8220;possesso&#8221; completo della vostra macchina, come se foste in console e&#8230;beh,  al diavolo il proxy HTTP che vi blocca le connessioni SSH (tanto per fare un piccolo riferimento al mio <a href="http://syscallme.2bopen.org/2010/07/21/corkscrew-tunneling-ssh-attraverso-un-proxy-http-https/" target="_blank">post precedente</a>)!</p>
<p>Cmq, mi sembra superfluo continuare le spiegazioni (anche perchè non c&#8217;è molto altro da dire). Io proporrei di vederlo all&#8217;opera&#8230;voi che dite?</p>
<p><span id="more-170"></span></p>
<h3>Il contesto</h3>
<p>Due righe per spiegare dove e come proveremo Guacamole. Anzitutto l&#8217;OS: trattasi di una fantastica <a href="http://www.ubuntu.com" target="_blank">GNU/Linux Ubuntu Lucid Lynx 10.04 LTS</a>; direi il capolavoro di <a href="http://www.canonical.com/" target="_blank">Canonical</a>. Quindi il servlet container scelto che, come detto, è Apache Tomcat in versione 6.0.24. In ultimo la versione della jdk: una 1.60_20 per piattaforma 64bit. Ok ora sappiamo tutto. Andiamo a provare Guacamole!</p>
<h3>Installare Guacamole su Ubuntu 10.04</h3>
<p>Anzitutto ci occorrerà installare un VNC server. Guacamole, come detto, utilizza un proxettino che si metterà in contatto con il questo VNC server e otterrà la view della vostra console che poi verrà ri-renderizzata in HTML5 e Javascript.</p>
<p>Io come VNC server ho utilizzato <a href="http://www.karlrunge.com/x11vnc/" target="_blank">X11VNC</a>. Perchè è semplice da installare (basta un <em>apt-get install</em>); perchè il deamon lo gestisci via xinetd (che comunque installeremo) e a me questa cosa piace; ma soprattutto perchè è consigliato dagli stessi creatori di Guacamole! Vediamo come installarlo:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #666666; font-style: italic;"># apt-get install x11vnc xinetd</span></div></div>
<p>e configuriamo xinetd per gestire X11VNC: creiamo il file /etc/xinetd.d/x11vnc che contenga:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">service x11vnc<br />
<span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
port        = <span style="color: #000000;">5900</span><br />
only_from   = localhost<br />
<span style="color: #7a0874; font-weight: bold;">type</span>        = UNLISTED<br />
socket_type = stream<br />
protocol    = tcp<br />
<span style="color: #7a0874; font-weight: bold;">wait</span>        = no<br />
user        = root<br />
server      = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>x11vnc<br />
server_args = <span style="color: #660033;">-inetd</span> <span style="color: #660033;">-display</span> :<span style="color: #000000;">0</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>x11vnc.log <span style="color: #660033;">-24to32</span> <span style="color: #660033;">-scr</span> always <span style="color: #660033;">-xkb</span><br />
disable     = no<br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span></div></div>
<p>Delle stringhe inserite qua sopra, la più rilevante è quella relativa ai server_args. Su Ubuntu questa è la configurazione ottimale, tuttavia ho già verificato che su altre distro c&#8217;è qualcosa da modificare (tipo Debian Lenny&#8230;). Ovviamente le modifiche dipendono direttamente da come viene configurato e gestito l&#8217;X server dalle varie distro. Diciamo che anche nella situazione peggiore, una googlata e un po&#8217; di dimestichezza con l&#8217;X server dovrebbe risolvervi il problema.</p>
<p>Notate inoltre che il server VNC sarà in listening solo su localhost (istruzione &#8220;only_from&#8221;). Ovviamente, dato che il traffico VNC serve solo a guacamole che, nel nostro caso perlomeno, risiederà sulla stessa macchina server, non occorre esporre troppo il servizio.</p>
<p>Diciamo che le altre voci dovrebbero essere semplici da capire. Come semplice da capire è che il server VNC andrà in listening sulla porta 5900 e utilizzeremo il display :0.</p>
<p>In ogni modo ora X11VNC e xinetd sono installati e configurati. Un piccolo restart</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #666666; font-style: italic;"># /etc/init.d/xinetd restart</span></div></div>
<p>e siamo apposto. Ora occupiamoci di Guacamole.</p>
<p>Chi non è nuovo di questo blog, sa che quando voglio installare un&#8217;applicativo che andrà in run da utente non privilegiato, io anzitutto creo un utente apposito e sfrutto la sua $HOME per installare l&#8217;applicazione che dovrà gestire. Apache Tomcat è un classico software che gira da utente non privilegiato. Di conseguenza creo l&#8217;utente &#8220;tomcat&#8221; che lo gestirà</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #666666; font-style: italic;"># groupadd tomcat</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #666666; font-style: italic;"># useradd -g tomcat -d /home/tomcat -m -s /bin/bash tomcat</span></div></div>
<p>e divento utente tomcat.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #666666; font-style: italic;"># su - tomcat</span><br />
tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$</div></div>
<p>Tutto quello che accadrà da ora in poi sarà completamente &#8220;responsabilità&#8221; del nuovo utente <img src='http://syscallme.2bopen.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Siamo pronti per procurarci (prima di tutto) il software che ci serve. Quindi, prima di continuare la vostra lettura, assicurative di scaricare:</p>
<ul>
<li>la JDK a questo indirizzo: http://java.sun.com/javase/downloads/widget/jdk6.jsp</li>
<li>Apache Tomcat a questo: http://tomcat.apache.org/download-60.cgi</li>
<li>Guacamole sulla sua pagina Sourceforge: http://sourceforge.net/projects/guacamole/</li>
</ul>
<p>Mettiamo tutto in una directory di proprietà dell&#8217;utente &#8220;tomcat&#8221; che chiameremo &#8220;pkg&#8221; e diamo i giusti permessi.</p>
<p>Come prima cosa installiamo la JDK e mettiamola nel $PATH dell&#8217;utente tomcat. Anzitutto diamo al .bin appena scaricato i permessi di eseguibilità</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> u+x jdk-6u20-linux-x64.bin</div></div>
<p>e quindi runniamo l&#8217;eseguibile</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>pkg $ .<span style="color: #000000; font-weight: bold;">/</span>jdk-6u20-linux-x64.bin</div></div>
<p>Creiamo un link simbolico per la dir della jdk. Questo ci darà due vantaggi:</p>
<ul>
<li>semplificare la path</li>
<li>effettuare tutti i settings relativi alla messa in PATH della JavaVM utilizzando un percorso che <strong>non cambierà mai</strong> a prescindere le versioni della JDK che cambierete nel tempo.</li>
</ul>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> .<span style="color: #000000; font-weight: bold;">/</span>jdk1.6.0_22 java</div></div>
<p>Quindi modifichiamo il .bashrc dell&#8217;utente inserendo queste due righe:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">JAVA_HOME</span>=<span style="color: #ff0000;">&quot;/home/tomcat/java&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$JAVA_HOME</span>/bin:<span style="color: #007800;">$PATH</span>&quot;</span></div></div>
<p>e ricarichiamo le impostazioni utente</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ . .bashrc</div></div>
<p>Se ora diamo un colpetto di <em>which</em> dovremo vedere che java viene correttamente identificato</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ <span style="color: #c20cb9; font-weight: bold;">which</span> java<br />
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>tomcat<span style="color: #000000; font-weight: bold;">/</span>java<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java</div></div>
<p>A questo punto passiamo a Tomcat. Spacchettiamo il .tar.gz che abbiamo scaricato (ricordo che stiamo provando con la versione 6.0.24) e spostiamolo nella home dell&#8217;utente.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>pkg $ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf apache-tomcat-6.0.24.tar.gz<br />
tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>pkg $ <span style="color: #c20cb9; font-weight: bold;">mv</span> apache-tomcat6.0.24 ..</div></div>
<p>Ora, sempre nella dir ~/pkg spacchettiamo anche Guacamole:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>pkg $ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf guacamole-<span style="color: #000000;">0.26</span>.tar.gz</div></div>
<p>All&#8217;interno della directory spacchettata troverete i seguenti files:</p>
<ul>
<li><strong>guacamole.war</strong>: è il compilato dell&#8217;applicazione che deployeremo più tardi all&#8217;interno di Tomcat</li>
<li><strong>guacamole.xml</strong>: l&#8217;xml del contesto. Poche modifiche ed è già bello e pronto</li>
<li><strong>guacamole-users.xml</strong>: è il file xml che definisce l&#8217;autenticazione HTTP per accedere a guacamole. Anche questo provvederemo a modificarlo</li>
<li><strong>guacamole-src.tar</strong>: per chiunque ne senta il bisogno&#8230;ecco il sorgente!</li>
<li><strong>LICENSE.txt</strong>: la tua copia della licenza con cui è rilasciato Guacamole. Che è la GPL3.</li>
</ul>
<p>Cominciamo l&#8217;installazione. Anzitutto copiamo il file guacamole.war all&#8217;interno della folder &#8220;webapps&#8221; del vostro tomcat.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>pkg<span style="color: #000000; font-weight: bold;">/</span>guacamole-<span style="color: #000000;">0.26</span> $ <span style="color: #c20cb9; font-weight: bold;">cp</span> guacamole.war <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>tomcat<span style="color: #000000; font-weight: bold;">/</span>apache-tomcat6.0.24<span style="color: #000000; font-weight: bold;">/</span>webapps</div></div>
<p>Quindi copiamo il file guacamole-users.xml nella folder di conf di tomcat. Se aprite questo file, inoltre, vi accorgerete che la password è settata a &#8220;changeme&#8221;. Beh lo dice la parola stessa&#8230;modificatela!</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>pkg<span style="color: #000000; font-weight: bold;">/</span>guacamole-<span style="color: #000000;">0.26</span> $ <span style="color: #c20cb9; font-weight: bold;">cp</span> guacamole-users.xml <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>tomcat<span style="color: #000000; font-weight: bold;">/</span>apache-tomcat6.0.24<span style="color: #000000; font-weight: bold;">/</span>conf</div></div>
<p>Ora tocca al file di contesto. Apriamolo e modifichiamo la docBase del Context, specificando la path assoluta di dove si trova il nostro file .war. In poche parole sostituiamo questa riga qui:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&amp;</span>lt;Context <span style="color: #007800;">antiJARLocking</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #007800;">path</span>=<span style="color: #ff0000;">&quot;/guacamole&quot;</span> <span style="color: #007800;">docBase</span>=<span style="color: #ff0000;">&quot;/var/lib/guacamole/guacamole.war&quot;</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;</div></div>
<p>con questa qui</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&amp;</span>lt;Context <span style="color: #007800;">antiJARLocking</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #007800;">path</span>=<span style="color: #ff0000;">&quot;/guacamole&quot;</span> <span style="color: #007800;">docBase</span>=<span style="color: #ff0000;">&quot;/home/tomcat/apache-tomcat6.0.24/webapps/guacamole.war&quot;</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;</div></div>
<p>Richiudetelo e spostatelo nella folder Catalina/localhost da creare all&#8217;interno della directory &#8220;conf&#8221;. Così</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> apache-tomcat6.0.24<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>Catalina<span style="color: #000000; font-weight: bold;">/</span>localhost<br />
tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ <span style="color: #c20cb9; font-weight: bold;">cp</span> pkg<span style="color: #000000; font-weight: bold;">/</span>guacamole.xml apache-tomcat6.0.24<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>Catalina<span style="color: #000000; font-weight: bold;">/</span>localhost</div></div>
<p>Ok signori. Abbiamo finito. Startiamo tomcat</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~$ <span style="color: #7a0874; font-weight: bold;">cd</span> apache-tomcat6.0.24<span style="color: #000000; font-weight: bold;">/</span>bin<br />
tomcat<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>apache-tomcat6.0.24<span style="color: #000000; font-weight: bold;">/</span>bin $ .<span style="color: #000000; font-weight: bold;">/</span>catalina.sh start</div></div>
<p>e visitiamo la paginetta http://localhost:8080/guacamole. Inseriamo user e password specificati nel file guacamole-users.xml e&#8230; UALA&#8217;! Il VNC via HTTP è servito!</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F&amp;title=VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F&amp;title=VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F&amp;title=VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F&amp;T=VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F&amp;title=VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21+@+http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2010%2F07%2F26%2Fvnc-via-http-con-guacamole-vediamolo-su-ubuntu%2F&amp;t=VNC+via+HTTP+con+Guacamole%3A+vediamolo+su+Ubuntu%21" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://syscallme.2bopen.org/2010/07/26/vnc-via-http-con-guacamole-vediamolo-su-ubuntu/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Installare Glassfish su Ubuntu Server 8.10</title>
		<link>http://syscallme.2bopen.org/2009/07/07/installare-glassfish-su-ubuntu-server-810/</link>
		<comments>http://syscallme.2bopen.org/2009/07/07/installare-glassfish-su-ubuntu-server-810/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 10:25:28 +0000</pubDate>
		<dc:creator>daniele</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Simple]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://syscallme.2bopen.org/?p=54</guid>
		<description><![CDATA[Tanto peregrinare e torno qua, su queste pagine, dopo 7 mesi che sembrano anni per le cose che cambiano e sono cambiate. Oggi parliamo di come installare Glassfish su Ubuntu. Glassfish è l&#8217;Application Server OpenSource di Sun (da poco acquisita Oracle&#8230;con tutto quello che si potrebbe dire al riguardo e che non dirò), un prodotto [...]]]></description>
			<content:encoded><![CDATA[<p>Tanto peregrinare e torno qua, su queste pagine, dopo 7 mesi che sembrano anni per le cose che cambiano e sono cambiate. Oggi parliamo di come installare <a href="https://glassfish.dev.java.net/" target="_blank"><strong>Glassfish</strong></a> su Ubuntu.</p>
<p><strong>Glassfish </strong>è l&#8217;Application Server OpenSource di Sun (da poco acquisita Oracle&#8230;con tutto quello che si potrebbe dire al riguardo e che non dirò), un prodotto che esiste ormai da più di due anni e ha raggiunto un discreto grado di maturazione, pur mancando ancora di quella &#8220;integrazione&#8221;, di quell&#8217;essere &#8220;suite&#8221; che ormai (sotto il controllo-spinta di RedHat) JBoss riesce maggiormente ad assicurare. Non è certamente questa la sede per avere maggiori indicazioni tecniche al riguardo, per questo potete chiedere a Google.</p>
<p>Noi cerchiamo solo di capire come effettuare una installazione del prodotto su un sistema operativo Ubuntu (per il test è stata utilizzata la versione server 8.10) pulita e con un sistema di start/stop automatico al boot.</p>
<p><span id="more-54"></span></p>
<h4>Java</h4>
<p>Prima di tutto sarà necessario installare la JDK Sun sulla nostra macchina. Per farlo, su un sistema debian-based come Ubuntu, è possibile aggiungere o semplicemente abilitare (solitamente già sono presenti, vanno solo decommentate) queste sorgenti al file sources.list che gestisce l&#8217;apt.</p>
<div class="codecolorer-container apt_sources blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="apt_sources codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00007f;">deb</span> <span style="color: #009900;">http://us.archive.ubuntu.com/ubuntu/</span> <span style="color: #b1b100;">intrepid</span> <span style="color: #b16000;">universe</span> <span style="color: #b16000;">multiverse</span><br />
<span style="color: #00007f;">deb-src</span> <span style="color: #009900;">http://us.archive.ubuntu.com/ubuntu/</span> <span style="color: #b1b100;">intrepid</span> <span style="color: #b16000;">universe</span> <span style="color: #b16000;">multiverse</span></div></div>
<p>La nostra scelta cade sul pacchetto <strong>sun-java6-jdk</strong> contenente la versione 1.6.x del prodotto. A secondo del livello di upgrade di Intrepid, cambierà la minor release della JDK. Al momento in cui scrivo, l&#8217;ultima disponibile è la 1.6.0_10.</p>
<p>Tornando a noi: una volta abilitati i repositories, con un colpetto di apt (magie di debian), scarichiamo, installiamo e abilitiamo la JDK. Ovviamente da utente root.</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># apt-get install sun-java6-jdk</span></div></div>
<p>Accettiamo tutte le dipendenze e lasciamo fare lo sporco lavoro al nostro sistema operativo. Alla fine basterà dare un colpetto di <strong>java -version</strong> da command line per avere qualcosa tipo:</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">java version <span style="color: #ff0000;">&quot;1.6.0_10&quot;</span><br />
Java<span style="color: #7a0874; font-weight: bold;">&#40;</span>TM<span style="color: #7a0874; font-weight: bold;">&#41;</span> SE Runtime Environment <span style="color: #7a0874; font-weight: bold;">&#40;</span>build 1.6.0_10-b33<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
Java HotSpot<span style="color: #7a0874; font-weight: bold;">&#40;</span>TM<span style="color: #7a0874; font-weight: bold;">&#41;</span> Client VM <span style="color: #7a0874; font-weight: bold;">&#40;</span>build <span style="color: #000000;">11.0</span>-b15, mixed mode, sharing<span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>
<p>Frasi che ci informano che tutto è andato a buon fine.</p>
<h4>GlassFish</h4>
<p>Ok, ora concentriamoci sull&#8217;installazione dell&#8217;AS vero e proprio. Scarichiamone il jar dell&#8217;ultima versione stable dal <a href="https://glassfish.dev.java.net/">sito ufficiale</a>.  Al momento è la 2.1 b60e. Diciamo che un wget dovrebbe fare sufficientemente al caso nostro:</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># wget http://java.net/download/javaee5/v2.1_branch/promoted/Linux/glassfish-installer-v2.1-b60e-linux.jar</span></div></div>
<p>e ora scompattiamola in questo modo</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># java -jar -mx256M glassfish-installer-v2.1-b60e-linux.jar</span></div></div>
<p>Una volta accettata la licenza e scompattati i files, nella directory dove stiamo lavorando avremo una dir chiamata glassfish contenente tutti i files che ci occorrono per continuare.</p>
<p>E&#8217; importante, a questo punto, individuare una directory dove far lavorare glassfish. Io tendenzialmente sono uso non utilizzare /opt per installare software di terze parti, ma preferisco sempre ragionare utilizzando l&#8217;associazione mentale &#8220;1 software &gt;&gt; 1 utente/gruppo &gt;&gt; 1 home directory&#8221;.<br />
Volendo utilizzare questa strada procediamo con la creazione del gruppo e dell&#8217;utenza, copiamo la dir di glassfish all&#8217;interno della home directory del nuovo utente e cominciamo a lavorare direttamente da lì, dimenticandoci (il più possibile) l&#8217;utenza di root.</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># groupadd glassfish</span><br />
<span style="color: #666666; font-style: italic;"># useradd -g glassfish -d /home/glassfish -m -s /bin/bash glassfish</span><br />
<span style="color: #666666; font-style: italic;"># mv glassfish /home/glassfish</span><br />
<span style="color: #666666; font-style: italic;"># chown -R glassfish:glassfish /home/glassfish/glassfish</span><br />
<span style="color: #666666; font-style: italic;"># su - glassfish</span></div></div>
<p>Credo sia praticamente inutile (e quindi utilissimo&#8230;) che io aggiunga che questa fase può essere tranquillamente saltata, tralasciando quella che è solo una mia abitudine. Ognuno ha i suoi standard. Ciò che, però è più importante, è evitare che l&#8217;application server &#8220;salga&#8221; da utente root. Ecco questo io lo eviterei come la peste.</p>
<p>A questo punto (con l&#8217;ultimo comando dato nel precedente blocco di codice) siamo utente &#8220;glassfish&#8221; e come tale operiamo all&#8217;interno della nostra home directory come preferiamo. Sfruttiamo <a href="http://ant.apache.org/">ant</a> contenuto in bundle a glassfish per lanciare il setup, ma prima di farlo ricordiamoci di dare all&#8217;eseguibile di ant i permessi di eseguibilità di cui è sprovvisto in default.</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">cd</span> glassfish<br />
$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> u+x <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ant<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ant<br />
$ <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ant<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ant <span style="color: #660033;">-f</span> setup.xml</div></div>
<p>Il build durerà qualche secondo, e alla fine si completerà con successo (se così non fosse ricontrollate i passi precedenti perchè c&#8217;è qualcosa che non va&#8230;).</p>
<p>Ora facciamo una finezza con un po&#8217; di forza bruta: per permetterci di aggiornare l&#8217;AS <strong>senza</strong> toccare ciò che deployeremo all&#8217;interno del <strong>default domain</strong> di glassfish, mi esternalizzo la directory relativa e con un symlink la lego comunque all&#8217;AS.</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>doman1 <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<br />
$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>domain1 <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>domains<span style="color: #000000; font-weight: bold;">/</span>doman1</div></div>
<p>In questo modo ogni qualvolta voglio procedere ad un upgrade, non vado a toccare il contenuto del domain1 e con un nuovo symlink post-upgrade non perdo l&#8217;applicazione.</p>
<p>Ok ora possiamo startare l&#8217;AS:</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>asadmin start-domain</div></div>
<p>Al termine dell&#8217;esecuzione aprite il browser e digitate http://indirizzo_server:8080. Vedrete la pagina di default di glassfish.</p>
<p style="text-align: center;"><a href="http://syscallme.bonsaimeme.net/wp-content/uploads/2009/07/picture-8.png" rel="lightbox"><img class="aligncenter size-medium wp-image-115" title="GlassFish on 8080 port" src="http://syscallme.bonsaimeme.net/wp-content/uploads/2009/07/picture-8-300x200.png" alt="GlassFish on 8080 port" width="300" height="200" /></a></p>
<p>Il prossimo passo è modificare la password di amministrazione per accedere al pannello di controllo il porta 4848; ricordiamoci che la password deve avere perlomeno 8 caratteri di lunghezza. Anche in questa occasione usiamo il potentissimo binario asadmin.</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>asadmin change-admin-password <span style="color: #660033;">--user</span> admin<br />
Please enter the old admin password<span style="color: #000000; font-weight: bold;">&amp;</span>gt; adminadmin<br />
Please enter the new admin password<span style="color: #000000; font-weight: bold;">&amp;</span>gt; newpassword<br />
Please enter the new admin password again<span style="color: #000000; font-weight: bold;">&amp;</span>gt; newpassword<br />
Updated .asadminpass <span style="color: #c20cb9; font-weight: bold;">file</span> with new password.<br />
Command change-admin-password executed successfully.</div></div>
<p>Considerate che nel &#8220;code&#8221; qui sopra ho scritto in chiaro le password (sia quella vecchia che quella nuova): nella realtà esse sono nascoste, come se cambiaste password ad un qualsiasi utente unix.</p>
<p>Ok, anche questa è fatta: andiamo su http://indirizzo_server:4848 e proviamo a loggarci con le nuove credenziali admin/newpassword. Avremo così accesso al pannello di controllo di glassfish.</p>
<p style="text-align: center;"><a href="http://syscallme.bonsaimeme.net/wp-content/uploads/2009/07/picture-10.png" rel="lightbox"><img class="aligncenter size-medium wp-image-116" title="GlassFish Administration (port 4848)" src="http://syscallme.bonsaimeme.net/wp-content/uploads/2009/07/picture-10-300x259.png" alt="GlassFish Administration (port 4848)" width="300" height="259" /></a></p>
<p>Fatto ciò il nostro esperimento potrebbe definirsi concluso. Ma c&#8217;è una cosa che ancora possiamo fare per completare meglio la nostra installazione: creare un init-script per fare in modo che l&#8217;AS parta al boot.</p>
<h4>Init Script</h4>
<p>L&#8217;init script che segue è relativo all&#8217;installazione che io ho fatto nella guida. Ovviamente è ampiamente suscettibile di customizzazione e soprattutto miglioramenti. Ma funziona e non è poco <img src='http://syscallme.2bopen.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Ringrazio Cay Horstmann (http://weblogs.java.net/blog/cayhorstmann/archive/2006/07/installing_glas.html) per il template dello script e per la guida ufficiale in lingua inglese alla quale mi sono &#8220;liberamente ispirato&#8221; per scrivere la mia.</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#! /bin/bash</span><br />
<span style="color: #666666; font-style: italic;">### BEGIN INIT INFO</span><br />
<span style="color: #666666; font-style: italic;"># Provides: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;glassfish</span><br />
<span style="color: #666666; font-style: italic;"># Required-Start: &nbsp; &nbsp;$local_fs $remote_fs</span><br />
<span style="color: #666666; font-style: italic;"># Required-Stop: &nbsp; &nbsp; $local_fs $remote_fs</span><br />
<span style="color: #666666; font-style: italic;"># Default-Start: &nbsp; &nbsp; 2 3 4 5</span><br />
<span style="color: #666666; font-style: italic;"># Default-Stop: &nbsp; &nbsp; &nbsp;S 0 1 6</span><br />
<span style="color: #666666; font-style: italic;"># Short-Description: glassfish initscript</span><br />
<span style="color: #666666; font-style: italic;"># Description: &nbsp; &nbsp; &nbsp; A simple initscript for the glassfish app server</span><br />
<span style="color: #666666; font-style: italic;">### END INIT INFO</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;"># Author: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Cay S. Horstmann (http://horstmann.com)</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<br />
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-e</span><br />
<br />
<span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>glassfish<span style="color: #000000; font-weight: bold;">/</span>bin<br />
<span style="color: #007800;">DESC</span>=<span style="color: #ff0000;">&quot;Java EE5 App Server&quot;</span><br />
<span style="color: #007800;">NAME</span>=glassfish<br />
<span style="color: #007800;">ASADMIN</span>=asadmin<br />
<span style="color: #007800;">PIDFILE</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$NAME</span>.pid<br />
<span style="color: #007800;">SCRIPTNAME</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$NAME</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Gracefully exit if the package has been removed.</span><br />
<span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #660033;">-x</span> <span style="color: #007800;">$DAEMON</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Read config file if it is present.</span><br />
<span style="color: #666666; font-style: italic;">#if [ -r /etc/default/$NAME ]</span><br />
<span style="color: #666666; font-style: italic;">#then</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp; &nbsp; &nbsp; . /etc/default/$NAME</span><br />
<span style="color: #666666; font-style: italic;">#fi</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Function that starts the daemon/service.</span><br />
d_start<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
<span style="color: #007800;">$ASADMIN</span> start-domain \<br />
<span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot; already running&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Function that stops the daemon/service.</span><br />
d_stop<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
<span style="color: #007800;">$ASADMIN</span> stop-domain \<br />
<span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot; not running&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span><br />
start<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Starting <span style="color: #007800;">$DESC</span>: <span style="color: #007800;">$NAME</span>&quot;</span><br />
d_start<br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;.&quot;</span><br />
<span style="color: #000000; font-weight: bold;">;;</span><br />
stop<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Stopping <span style="color: #007800;">$DESC</span>: <span style="color: #007800;">$NAME</span>&quot;</span><br />
d_stop<br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;.&quot;</span><br />
<span style="color: #000000; font-weight: bold;">;;</span><br />
reload<span style="color: #000000; font-weight: bold;">|</span>restart<span style="color: #000000; font-weight: bold;">|</span>force-reload<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Restarting <span style="color: #007800;">$DESC</span>: <span style="color: #007800;">$NAME</span>&quot;</span><br />
d_stop<br />
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">10</span><br />
d_start<br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;.&quot;</span><br />
<span style="color: #000000; font-weight: bold;">;;</span><br />
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: <span style="color: #007800;">$SCRIPTNAME</span> {start|stop|restart|force-reload}&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">3</span><br />
<span style="color: #000000; font-weight: bold;">;;</span><br />
<span style="color: #000000; font-weight: bold;">esac</span><br />
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></div></div>
<p>Per aggiungere il nuovo init script all&#8217;interno dei runlevel di ubuntu è sufficiente scrivere da root</p>
<div class="codecolorer-container bash blackboard" style="border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">update-rc.d glassfish defaults</div></div>
<p>Ora è davvero tutto. Enjoy with glassfish!</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F&amp;title=Installare+Glassfish+su+Ubuntu+Server+8.10" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F&amp;title=Installare+Glassfish+su+Ubuntu+Server+8.10" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F&amp;title=Installare+Glassfish+su+Ubuntu+Server+8.10" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F&amp;T=Installare+Glassfish+su+Ubuntu+Server+8.10" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F&amp;title=Installare+Glassfish+su+Ubuntu+Server+8.10" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Installare+Glassfish+su+Ubuntu+Server+8.10+@+http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fsyscallme.2bopen.org%2F2009%2F07%2F07%2Finstallare-glassfish-su-ubuntu-server-810%2F&amp;t=Installare+Glassfish+su+Ubuntu+Server+8.10" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://syscallme.2bopen.org/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://syscallme.2bopen.org/2009/07/07/installare-glassfish-su-ubuntu-server-810/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
