<?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>Artiflo Inside &#187; Java</title>
	<atom:link href="http://www.artiflo.net/category/dev/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.artiflo.net</link>
	<description>A draft for /b/tard guys.</description>
	<lastBuildDate>Wed, 18 Jan 2012 18:03:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Authentification Kerberos en JNDI</title>
		<link>http://www.artiflo.net/2009/08/authentification-kerberos-en-jndi/</link>
		<comments>http://www.artiflo.net/2009/08/authentification-kerberos-en-jndi/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 20:39:20 +0000</pubDate>
		<dc:creator>Florian Cristina</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Sécurité]]></category>
		<category><![CDATA[Active directory]]></category>
		<category><![CDATA[authentification]]></category>
		<category><![CDATA[GSS-API]]></category>
		<category><![CDATA[GSSAPI]]></category>
		<category><![CDATA[JNDI]]></category>
		<category><![CDATA[kerberos JNDI]]></category>
		<category><![CDATA[SASL]]></category>

		<guid isPermaLink="false">http://www.artiflo.net/?p=1476</guid>
		<description><![CDATA[<p>La documentation officiel java au sujet de l&#8217;authentification kerberos en JNDI est très bien faite. Mais je vais quand même me faire un petit mémo à ce sujet.</p> <p>Le but du jeu est de mettre en place un processus d&#8217;authentification sécurisé entre une application java sur un poste en Windows XP et un controleur de [...]]]></description>
			<content:encoded><![CDATA[<p><!--:fr-->La documentation officiel java au sujet de l&#8217;<a href="http://java.sun.com/products/jndi/tutorial/ldap/security/gssapi.html">authentification kerberos en JNDI </a>est très bien faite. Mais je vais quand même me faire un petit mémo à ce sujet.</p>
<p>Le but du jeu est de mettre en place un processus d&#8217;authentification sécurisé entre une application java sur un poste en Windows XP et un controleur de domaine active directory sur Windows 2003. Le login et mot de passe utilisé sont ceux de l&#8217;utilisateur définis dans l&#8217;AD. Tout ceci en utilisant JNDI pour les requêtes LDAP.</p>
<p>Il existe plusieurs méthode d&#8217;authentification sécurisé <a href="http://java.sun.com/products/jndi/tutorial/ldap/security/sasl.html">SASL pour JNDI</a>. Je vais ici parler uniquement de l&#8217;authentification en Kerberos v5 à travers la GSSAPI.</p>
<p><!--:--><span id="more-1476"></span><!--:fr--></p>
<h4>1 / Connaitre les protocoles accepter par le serveur.</h4>
<p>Dans un premier temps, il faut être sur que le serveur accepte le GSSAPI.</p>
<p>Une <a href="http://java.sun.com/products/jndi/tutorial/ldap/security/src/ServerSasl.java">requete LDAP</a> permet d&#8217;apporter la réponse (remplacer localhost par l&#8217;ip ou le nom de domaine de votre serveur) :</p>
<pre lang="java">import javax.naming.*;
import javax.naming.directory.*;

import java.util.Hashtable;

/**
 * Demonstrates how to discover a server's supported SASL mechanisms.
 *
 * usage: java ServerSasl
 */
class ServerSasl {
    public static void main(String[] args) {

	try {
	    // Create initial context
	    DirContext ctx = new InitialDirContext();

	    // Read supportedSASLMechanisms from root DSE
	    Attributes attrs = ctx.getAttributes(
		"ldap://localhost:389", new String[]{"supportedSASLMechanisms"});

	    System.out.println(attrs);

	    // Close the context when we're done
	    ctx.close();
	} catch (NamingException e) {
	    e.printStackTrace();
	}
    }
}</pre>
<p>Le serveur devrait répondre quelque chose dans ce gout la :</p>
<pre lang="java">{supportedsaslmechanisms=supportedSASLMechanisms: GSSAPI, GSS-SPNEGO, EXTERNAL, DIGEST-MD5}</pre>
<p>Le support du Kerberos (GSSAPI) est donc confirmé.</p>
<h4>2 / Configuration client kerberos</h4>
<p>A présent, il faut configurer le poste client pour discuter avec le serveur Kerberos. Pour cela il faut créer le fichier de configuration de kerberos : krb5.ini. Sans ce fichier aucune transaction kerberos en LDAP ne peut être faite.</p>
<p>Créer le fichier dans la racine de Windows.</p>
<blockquote><p>Exemple c:\WINNT\kerb5.ini</p></blockquote>
<p>Il doit contenir au minimum ces informations : (remplacer &laquo;&nbsp;exemple&nbsp;&raquo; par vos informations)</p>
<blockquote><p>[libdefaults]<br />
default_realm = EXEMPLE.LAN<br />
default_checksum = rsa-md5</p>
<p>[realms]<br />
EXEMPLE.LAN = {<br />
kdc = SRV01.EXEMPLE.LAN<br />
}</p>
<p>[domain_realm]<br />
.EXEMPLE.LAN = EXEMPLE.LAN</p></blockquote>
<h4>3 / Test d&#8217;authentification</h4>
<p>Maintenant que le fichier de configuration est créé, il faut le tester. Si vous avez correctement configuré le PATH de votre poste client vous devez avoir accés aux commande kinit et klist si ce n&#8217;est pas le cas, ces binaires ce trouve dans le répertoire d&#8217;installation du JDK ou vous pouvez configurer votre path une bonne fois pour toute en <a href="http://www.inrialpes.fr/helix/people/genoud/ENSJAVA/tds/sujets/PriseEnMain/configWin2000.html">suivant ce tuto</a>.</p>
<p>Il faut dans un premier temps initialiser la connexion avec kinit.<br />
Dans l&#8217;interpreteur de commande windows rentrer kinit :</p>
<blockquote><p>C:\Documents and Settings\artiflo&gt;kinit</p></blockquote>
<p>Le mot de passe pour l&#8217;utilisateur courant est demandé :</p>
<blockquote><p>Password for artiflo@EXEMPLE.LAN:</p></blockquote>
<p>Si tout c&#8217;est bien passé un message d&#8217;indication est renvoyé :</p>
<blockquote><p>New ticket is stored in cache file C:\Documents and Settings\artiflo\krb5cc_artiflo</p></blockquote>
<p>On peut vérifier a présent que le ticket est bien arrivé en utilisant klist :</p>
<blockquote><p>C:\Documents and Settings\artiflo&gt;klist</p></blockquote>
<p>Ce qui devrait donner ceci :</p>
<blockquote><p>Credentials cache: C:\Documents and Settings\artiflo\krb5cc_artiflo</p>
<p>Default principal:artiflo@EXEMPLE.LAN, 1 entry found.</p>
<p>[1]  Service Principal:  krbtgt/EXEMPLE.LAN@EXEMPLE.LAN<br />
Valid starting:  Aug 11,  2009 14:49<br />
Expires:         Aug 12,  2009 00:49</p></blockquote>
<p>Tout c&#8217;est bien passer on peut retourner sur eclipse.</p>
<h4>4 / L&#8217;Autentification</h4>
<p>A présent je vais réutiliser les exemples fournis par java. Pour cela j&#8217;ai besoin de ces 3 fichiers.</p>
<p>1 / Le fichier de configuration : <a href="http://java.sun.com/products/jndi/tutorial/ldap/security/src/gsseg_jaas.conf">gsseg_jaas.conf</a></p>
<pre lang="java">GssExample { com.sun.security.auth.module.Krb5LoginModule required client=TRUE;};</pre>
<p>2 / Le dialogue : <a href="http://java.sun.com/products/jndi/tutorial/ldap/security/src/SampleCallbackHandler.java">SampleCallbackHandler.java</a></p>
<pre lang="java">import javax.security.auth.callback.*;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * Demonstrates how to write a callback handler for use with SASL.
 * Used with UseCallback.java, GssExample.java, and Mutual.java.
 *
 * Standalone test: java SampleCallbackHandler
 */
public class SampleCallbackHandler implements CallbackHandler {
    public void handle(Callback[] callbacks)
	throws java.io.IOException, UnsupportedCallbackException {
	    for (int i = 0; i &lt; callbacks.length; i++) {
		if (callbacks[i] instanceof NameCallback) {
		    NameCallback cb = (NameCallback)callbacks[i];
		    cb.setName(getInput(cb.getPrompt()));

		} else if (callbacks[i] instanceof PasswordCallback) {
		    PasswordCallback cb = (PasswordCallback)callbacks[i];

		    String pw = getInput(cb.getPrompt());
		    char[] passwd = new char[pw.length()];
		    pw.getChars(0, passwd.length, passwd, 0);

		    cb.setPassword(passwd);
		} else {
		    throw new UnsupportedCallbackException(callbacks[i]);
		}
	    }
    }

    /**
     * A reader from Standard Input. In real world apps, this would
     * typically be a TextComponent or similar widget.
     */
    private String getInput(String prompt) throws IOException {
	System.out.print(prompt);
	BufferedReader in = new BufferedReader(
	    new InputStreamReader(System.in));
	return in.readLine();
    }

    public static void main(String[] args) throws IOException,
    UnsupportedCallbackException {

	// Test handler

	CallbackHandler ch = new SampleCallbackHandler();
	Callback[] callbacks = new Callback[]{
	    new NameCallback("user id:"),
		new PasswordCallback("password:", true)};

	ch.handle(callbacks);
    }
}</pre>
<p>3 / La création du context JNDI : <a href="http://java.sun.com/products/jndi/tutorial/ldap/security/src/GssExample.java">GssExample.java</a></p>
<pre lang="java">import javax.naming.*;
import javax.naming.directory.*;
import javax.security.auth.login.*;
import javax.security.auth.Subject;

import java.util.Hashtable;

/**
 * Demonstrates how to create an initial context to an LDAP server
 * using "GSSAPI" SASL authentication (Kerberos v5).
 * Requires J2SE 1.4, or JNDI 1.2 with ldapbp.jar, JAAS, JCE, an RFC 2853
 * compliant implementation of J-GSS and a Kerberos v5 implementation.
 * Uses SampleCallbackHandler.
 *
 * usage: java
 *    -Djava.security.auth.login.config=gssapi_jaas.conf \
 *    -Djava.security.krb5.conf=krb5.conf \
 *      GssExample [qop [dn]]
 *
 * The first property indicates which JAAS login module the application needs
 * to use; the second property is for configuration of the Kerberos subsystem.
 *
 * 'qop' is a comma separated list of tokens, each of which is one of
 * auth, auth-int, or auth-conf. If none is supplied, the default is 'auth'.
 */
class GssExample {

    public static void main(String[] args) {

	// 1. Log in (to Kerberos)
	LoginContext lc = null;
	try {
	    lc = new LoginContext(GssExample.class.getName(),
		new SampleCallbackHandler());

	    // Attempt authentication
	    // You might want to do this in a "for" loop to give
	    // user more than one chance to enter correct username/password
	    lc.login();

	} catch (LoginException le) {
	    System.err.println("Authentication attempt failed" + le);
	    System.exit(-1);
	}

	// 2. Perform JNDI work as logged in subject
	Subject.doAs(lc.getSubject(), new JndiAction(args));
    }
}

/**
 * The application must supply a PrivilegedAction that is to be run
 * inside a Subject.doAs() or Subject.doAsPrivileged().
 */
class JndiAction implements java.security.PrivilegedAction {
    private String[] args;

    public JndiAction(String[] origArgs) {
	this.args = (String[])origArgs.clone();
    }

    public Object run() {
	performJndiOperation(args);
	return null;
    }

    private static void performJndiOperation(String[] args) {
	String dn;

	// Set up environment for creating initial context
	Hashtable env = new Hashtable(11);

	env.put(Context.INITIAL_CONTEXT_FACTORY,
	    "com.sun.jndi.ldap.LdapCtxFactory");

	// Must use fully qualified hostname
	env.put(Context.PROVIDER_URL,
	    "ldap://SRV01.EXEMPLE.LAN:389");

	// Request the use of the "GSSAPI" SASL mechanism
	// Authenticate by using already established Kerberos credentials
	env.put(Context.SECURITY_AUTHENTICATION, "GSSAPI");

	// Optional first argument is comma-separated list of auth, auth-int,
	// auth-conf
	if (args.length &gt; 0) {
	    env.put("javax.security.sasl.qop", args[0]);
	    dn = args[1];
	} else {
	    dn = "";
	}

	try {
	    /* Create initial context */
	    DirContext ctx = new InitialDirContext(env);

	    System.out.println(ctx.getAttributes(dn));

	    // do something useful with ctx

	    // Close the context when we're done
	    ctx.close();
	} catch (NamingException e) {
	    e.printStackTrace();
	}
    }
}</pre>
<p>Avec eclipse il ne reste plus qu&#8217;a rajouter quelques argument dans VM arguments  avant la compilation :</p>
<blockquote><p>-Djava.security.auth.login.config=C:\Workbench\GSS\src\GSS1\gsseg_jaas.conf<br />
-Djava.security.krb5.conf=C:\WINNT\krb5.ini</p></blockquote>
<p>Compiler. Indiquez votre nom d&#8217;utilisateur, puis votre mot de passe. Fini.</p>
<p>Par défaut la requête renverra tous les arguments. Mais vous pouvez par la suite créer ce que vous voulez comme requete, comme par exemple une requete qui cherche à renvoyer tous les groupes d&#8217;un USER :</p>
<pre lang="java">// Create the default search controls
SearchControls ctls = new SearchControls();
String filter = "(&amp;(member=CN=Arti flo,OU=ou_DLW_USER,OU=ou_DLW,DC=EXEMPLE,DC=LAN)(objectclass=group)))";

// Search for objects using the filter
NamingEnumeration answers = ctx.search("OU=ou_DLW_USER,OU=ou_DLW,DC=EXEMPLE,DC=LAN",filter, ctls);
while (answers.hasMore()) {
       SearchResult answer = answers.nextElement();
       System.out.println("&gt; " + answer.getNameInNamespace());
}</pre>
<p>Je dédicace mon premier billet java à mon bon lolo <img src='http://www.artiflo.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> <!--:--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.artiflo.net/2009/08/authentification-kerberos-en-jndi/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installation d&#8217;un serveur Ubuntu 9.04 64bits virtualisé via VirtualBox pour le développement d&#8217;applications Java / Flex.</title>
		<link>http://www.artiflo.net/2009/07/installation-dun-serveur-ubuntu-9-04-64bits-virtualise-via-virtualbox-pour-le-developpement-dapplications-java-flex/</link>
		<comments>http://www.artiflo.net/2009/07/installation-dun-serveur-ubuntu-9-04-64bits-virtualise-via-virtualbox-pour-le-developpement-dapplications-java-flex/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 20:00:15 +0000</pubDate>
		<dc:creator>Loïc Bisière</dc:creator>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Système]]></category>
		<category><![CDATA[Virtualisation]]></category>
		<category><![CDATA[9.04]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.artiflo.net/?p=1133</guid>
		<description><![CDATA[Cette documentation a pour objectif de reprendre pas à pas l'installation d'un serveur Ubuntu 9.04 64bits. Nous qualifierons ce serveur de pre-prod car son but est de supporter la mise en béta test de nos applications pour nos clients. De plus ce serveur sera virtualisé via VirtualBox. [...]]]></description>
			<content:encoded><![CDATA[<p>Bonjour à tous,</p>
<p><img class="size-medium wp-image-1149 alignright" title="glassfish_logo" src="http://www.artiflo.net/wp-content/uploads/2009/07/glassfish_logo_transparent-300x151.png" alt="GlassFish Logo" width="300" height="151" /></p>
<p>pré-requis pour lire cette documentation :</p>
<ul>
<li>Aimer Java / Flex</li>
<li>Aimer coder</li>
<li>Détester les admins sys</li>
</ul>
<h3>Introduction</h3>
<p>Cette documentation a pour objectif de reprendre pas à pas l&#8217;installation d&#8217;un serveur Ubuntu 9.04 64bits. Nous qualifierons ce serveur de pre-prod car son but est de supporter la mise en béta test de nos applications. De plus ce serveur sera vitualisé via VirtualBox.</p>
<p>Le tutorial débute après l&#8217;installation de Ubuntu Server 9.04 64bits. Lors de cette installation aucun service n&#8217;a été pré-installé.</p>
<p><span id="more-1133"></span></p>
<h3>Installer les pré-requis</h3>
<h4>1. Installer les paquets ssh</h4>
<blockquote><p>sudo apt-get install openssh-server</p></blockquote>
<p>Dès la fin de cette étape nous vous invitons à utiliser un client ssh tel que <a title="Putty.org" href="http://www.putty.org/" target="_blank">Putty</a>.</p>
<h4>2. Installer les paquet unzip</h4>
<blockquote><p>sudo apt-get install unzip</p></blockquote>
<h3>Installer les virtualbox additions sur Ubuntu Server 9.04</h3>
<h4>1. Installer les paquets</h4>
<blockquote><p>sudo apt-get install build-essential linux-headers-`uname -r`</p></blockquote>
<h4>2. Monter le fichier image des vboxadditions</h4>
<h4>3. Monter le CD-ROM</h4>
<blockquote><p>sudo mount /dev/cdrom /media/cdrom</p></blockquote>
<h4>4. Exécuter l&#8217;installation</h4>
<blockquote><p>cd /media/cdrom<br />
sudo ./VBoxLinuxAdditions-amd64.run</p></blockquote>
<h3>Installer Apache 2</h3>
<h4>1. Installer les paquets</h4>
<blockquote><p>sudo apt-get install apache2</p></blockquote>
<h3>Installer MySQL Server</h3>
<h4>1. Installer les paquets</h4>
<blockquote><p>sudo apt-get install mysql-server</p></blockquote>
<h3>Installer Php 5</h3>
<h4>1. Installer les paquets</h4>
<blockquote><p>sudo apt-get install php5 libapache2-mod-php5 php5-mysql</p></blockquote>
<h4>2. Configurer Apache</h4>
<blockquote><p>sudo nano /etc/apache2/apache2.conf</p></blockquote>
<p>Après la ligne :</p>
<blockquote><p>DefaultType text/plain</p></blockquote>
<p>Ajouter les lignes suivantes :</p>
<blockquote><p>AddType application/x-httpd-php .php<br />
AddType application/x-httpd-php-source .phps</p></blockquote>
<h4>3. Tester</h4>
<p>Créer le fichier phpinfo.php :</p>
<blockquote><p>sudo nano /var/www/phpinfo.php</p></blockquote>
<blockquote><p>&lt;?php<br />
phpinfo();<br />
?&gt;</p></blockquote>
<p>Relancer Apache :</p>
<blockquote><p>sudo /etc/init.d/apache2 reload</p></blockquote>
<p>Rendez-vous à :</p>
<p>http://ip.du.server/phpinfo.php</p>
<h3>Installer PhpMyAdmin</h3>
<h4>1. Installer les paquets</h4>
<blockquote><p>sudo apt-get install phpmyadmin</p></blockquote>
<h4>2. Tester</h4>
<p>http://ip.du.server/phpmyadmin</p>
<h3>Installer le serveur SVN et son module Apache</h3>
<h4>1. Installer les paquets</h4>
<blockquote><p>sudo apt-get install subversion</p></blockquote>
<h4>2. Créer le répertoire des repository</h4>
<blockquote><p>sudo mkdir /var/svn</p></blockquote>
<h4>3. Installer les paquets</h4>
<blockquote><p>sudo apt-get install libapache2-svn</p></blockquote>
<h4>4. Configuration</h4>
<blockquote><p>sudo nano /etc/apache2/mods-available/dav_svn.conf</p></blockquote>
<p>Remplacer la config par :</p>
<blockquote><p>&lt;Location /svn&gt;<br />
DAV svn<br />
SVNParentPath /var/svn<br />
SVNListParentPath On<br />
&lt;/Location&gt;</p></blockquote>
<p>Redémarrer Apache :</p>
<blockquote><p>sudo /etc/init.d/apache2 restart</p></blockquote>
<p>Vérifier la conf en vous rendant à l&#8217;adresse :</p>
<p>http://ip.du.server/svn/</p>
<h4>5. Sécurité</h4>
<blockquote><p>sudo nano /etc/apache2/mods-available/dav_svn.conf</p></blockquote>
<p>Remplacer la config par :</p>
<blockquote><p>&lt;Location /svn&gt;<br />
DAV svn<br />
SVNParentPath /var/svn<br />
SVNListParentPath On<br />
AuthType Basic<br />
AuthName &laquo;&nbsp;Depot Subversion&nbsp;&raquo;<br />
AuthUserFile /etc/apache2/dav_svn.passwd<br />
Require valid-user<br />
&lt;/Location&gt;</p></blockquote>
<p>Création du fichier htpasswd :</p>
<blockquote><p>sudo htpasswd -cs /etc/apache2/dav_svn.passwd utilisateur</p></blockquote>
<p>Pour créer d&#8217;autres utilisateurs :</p>
<blockquote><p>sudo htpasswd -s /etc/apache2/dav_svn.passwd utilisateur</p></blockquote>
<p>Faire appartenir ce fichier à l&#8217;utilisateur Apache :</p>
<blockquote><p>sudo chown www-data:www-data /etc/apache2/dav_svn.passwd</p></blockquote>
<p>Redémarrer Apache :</p>
<blockquote><p>sudo /etc/init.d/apache2 restart</p></blockquote>
<h4>6. Comment créer un projet</h4>
<blockquote><p>sudo svnadmin create /var/svn/projet<br />
sudo chown -R www-data:www-data /var/svn/projet</p></blockquote>
<h4>7. Comment supprimer un projet</h4>
<blockquote><p>sudo rm -r /var/svn/projet/</p></blockquote>
<h3>Installer JAVA</h3>
<h4>1. Installation</h4>
<p>Installer le dernier JDK :</p>
<blockquote><p>sudo apt-get install sun-java6-jdk</p></blockquote>
<h4>2. Configuration</h4>
<p>Editer le fichier profile de /etc :</p>
<blockquote><p>sudo nano /etc/profile</p></blockquote>
<p>Rajouter au début du fichier ces lignes :</p>
<blockquote><p>export JAVA_HOME=/usr/lib/jvm/java-6-sun<br />
export PATH=$PATH:$JAVA_HOME/bin</p></blockquote>
<p>Tester, vous devez tout d&#8217;abord relancer votre terminal :</p>
<blockquote><p>echo $JAVA_HOME<br />
echo $PATH</p></blockquote>
<h3>Installer le serveur GlassFish</h3>
<h4>1. Préparatifs</h4>
<p>Créer l&#8217;utilisateur GlassFish :</p>
<blockquote><p>sudo adduser &#8211;system glassfish</p></blockquote>
<p>Télécharger la dernière version de GlassFish (<a href="https://glassfish.dev.java.net/public/downloadsindex.html">link</a>) dans un répertoire dont l&#8217;utilisateur glassfish a les droits :</p>
<blockquote><p>cd /home/glassfish<br />
sudo wget lien.de.telechargement</p></blockquote>
<h4>2. Installation</h4>
<p>Exécuter l&#8217;installation via le nouveau user créé :</p>
<blockquote><p>sudo -u glassfish java -Xmx256M -jar nom.du.fichier.jar</p></blockquote>
<p>Déplacer le répertoire d&#8217;installation :</p>
<blockquote><p>sudo mv glassfish /opt</p></blockquote>
<p>Changer les règles pour accéder au répertoire sans le root :</p>
<blockquote><p>sudo chgrp -R admin /opt/glassfish/</p></blockquote>
<p>Exécuter le script d&#8217;installation :</p>
<blockquote><p>cd /opt/glassfish/<br />
sudo chmod -R +x lib/ant/bin/<br />
sudo -u glassfish lib/ant/bin/ant -f setup.xml</p></blockquote>
<p>Après le &laquo;&nbsp;Build Successful&nbsp;&raquo;, on test :</p>
<blockquote><p>sudo -u glassfish bin/asadmin start-domain domain1<br />
http://ip.du.server:4848 (admin | adminadmin)</p></blockquote>
<h4>3. Auto Start</h4>
<p>Créer le fichier :</p>
<blockquote><p>sudo nano /etc/init.d/glassfish</p></blockquote>
<p>Son contenu :</p>
<blockquote><p>#! /bin/sh</p>
<p>GLASSFISHPATH=/opt/glassfish/bin</p>
<p>case &laquo;&nbsp;$1&#8243; in<br />
start)<br />
echo &laquo;&nbsp;starting glassfish from $GLASSFISHPATH&nbsp;&raquo;<br />
sudo -u glassfish $GLASSFISHPATH/asadmin start-domain domain1<br />
;;<br />
restart)<br />
$0 stop<br />
$0 start<br />
;;<br />
stop)<br />
echo &laquo;&nbsp;stopping glassfish from $GLASSFISHPATH&nbsp;&raquo;<br />
sudo -u glassfish $GLASSFISHPATH/asadmin stop-domain domain1<br />
;;<br />
*)<br />
echo $”usage: $0 {start|stop|restart}”<br />
exit 3<br />
;;<br />
esac<br />
:</p></blockquote>
<p>Rendre le script exécutable :</p>
<blockquote><p>sudo chmod a+x /etc/init.d/glassfish</p></blockquote>
<p>Tester en arrêtant le serveur précédemment lancé, puis relancer le :</p>
<blockquote><p>sudo /etc/init.d/glassfish stop<br />
sudo /etc/init.d/glassfish start</p></blockquote>
<p>Mise en place du start/stop automatique de glassfish  :</p>
<blockquote><p>sudo update-rc.d glassfish defaults 90 10</p></blockquote>
<h4>4. Installation des drivers JDBC MySQL</h4>
<p>Installer le package :</p>
<blockquote><p>sudo apt-get install libmysql-java</p></blockquote>
<p>Création du lien symbolique dans le répertoire lib de GlassFish :</p>
<blockquote><p>sudo -u glassfish ln -s /usr/share/java/mysql-connector-java.jar /opt/glassfish/lib/</p></blockquote>
<h3>Installer le serveur Flex BlazeDS</h3>
<h4>1. Préparatifs</h4>
<p>Télécharger la dernière version de BlazeDS (<a href="http://opensource.adobe.com/wiki/display/blazeds/Release+Builds">link</a>) :</p>
<blockquote><p>sudo wget lien.de.telechargement</p></blockquote>
<h4>2. Installation</h4>
<p>Extraire les fichiers en tant qu&#8217;utilisateur blazeds dans un répertoire blazeds :</p>
<blockquote><p>unzip nom.du.fichier.zip -d blazeds</p></blockquote>
<p>Déplacer le répertoire d&#8217;installation :</p>
<blockquote><p>sudo mv blazeds /opt</p></blockquote>
<p>Changer les règles pour accéder au répertoire sans le root :</p>
<blockquote><p>sudo chgrp -R admin /opt/blazeds/</p></blockquote>
<p>Test :</p>
<blockquote><p>/opt/blazeds/tomcat/bin/./startup.sh</p></blockquote>
<p>http://ip.du.server:8400</p>
<h4>3. Auto Start</h4>
<p>Créer le fichier :</p>
<blockquote><p>sudo nano /etc/init.d/blazeds</p></blockquote>
<p>Son contenu :</p>
<blockquote><p>#! /bin/sh</p>
<p>export JAVA_HOME=/usr/lib/jvm/java-6-sun</p>
<p>BLAZEDS=/opt/blazeds/tomcat/bin</p>
<p>case &laquo;&nbsp;$1&#8243; in<br />
start)<br />
echo &laquo;&nbsp;starting Tomcat BlazeDS from $BLAZEDS&nbsp;&raquo;<br />
$BLAZEDS/./startup.sh<br />
;;<br />
restart)<br />
$0 stop<br />
$0 start<br />
;;<br />
stop)<br />
echo &laquo;&nbsp;stopingTomcat BlazeDS from $BLAZEDS&nbsp;&raquo;<br />
$BLAZEDS/./shutdown.sh<br />
;;<br />
*)<br />
echo $”usage: $0 {start|stop|restart}”<br />
exit 3<br />
;;<br />
esac<br />
:</p></blockquote>
<p>Rendre le script exécutable :</p>
<blockquote><p>sudo chmod a+x /etc/init.d/blazeds</p></blockquote>
<p>Tester en arrêtant le serveur précédemment lancé, puis relancer le :</p>
<blockquote><p>sudo /etc/init.d/blazeds stop<br />
sudo /etc/init.d/blazeds start</p></blockquote>
<p>Mise en place du démarrage automatique de tomcat blazeDS :</p>
<blockquote><p>sudo update-rc.d blazeds defaults 91 9</p></blockquote>
<h3>Migrer le serveur SVN</h3>
<h4>1. Dump de l&#8217;ancien serveur SVN</h4>
<blockquote><p>sudo svnadmin dump /chemin/vers/refrenciel &gt; /chemin/vers/fichier</p></blockquote>
<p>exemple dans ma configuration, créer tout d&#8217;abord un répertoire dans votre home pour regrouper tous vos dump :</p>
<blockquote><p>mkdire dumpSVN</p></blockquote>
<p>Puis, dumper vos projets :</p>
<blockquote><p>sudo svnadmin dump /var/svn/projet1 &gt; ~/dumpSVN/projet1<br />
sudo svnadmin dump /var/svn/projet2 &gt; ~/dumpSVN/projet2</p></blockquote>
<p>Puis créer un zip de votre dossier dumpSVN et récupérer le dans votre home du nouveau serveur.</p>
<h4>2. Préparation du nouveau serveur SVN</h4>
<p>Vous devez recréer vos projets :</p>
<blockquote><p>sudo svnadmin create /var/svn/projet<br />
sudo chown -R www-data:www-data /var/svn/projet</p></blockquote>
<p>exemple dans ma configuration :</p>
<blockquote><p>sudo svnadmin create /var/svn/projet1<br />
sudo svnadmin create /var/svn/projet2<br />
sudo chown -R www-data:www-data /var/svn/projet1<br />
sudo chown -R www-data:www-data /var/svn/projet2</p></blockquote>
<h4>3. Load dans le nouveau serveur SVN</h4>
<blockquote><p>sudo svnadmin load /chemin/vers/referentiel &lt; /chemin/vers/fichier</p></blockquote>
<p>exemple dans ma configuration, après avoir récupérer l&#8217;archive dumpSVN :</p>
<blockquote><p>unzip dumpSVN.zip<br />
sudo svnadmin load /var/svn/projet1 &lt; ~/dumpSVN/projet1<br />
sudo svnadmin load /var/svn/projet2 &lt; ~/dumpSVN/projet2</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.artiflo.net/2009/07/installation-dun-serveur-ubuntu-9-04-64bits-virtualise-via-virtualbox-pour-le-developpement-dapplications-java-flex/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

