<?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>Naeh.net &#187; Linux &#8211; Logiciels</title>
	<atom:link href="http://naeh.net/categorie/linux/linux-logiciels/feed/" rel="self" type="application/rss+xml" />
	<link>http://naeh.net</link>
	<description>Le mémo du développeur</description>
	<lastBuildDate>Sun, 07 Aug 2011 20:29:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>upload avec barre de progression</title>
		<link>http://naeh.net/upload-avec-barre-de-progression/</link>
		<comments>http://naeh.net/upload-avec-barre-de-progression/#comments</comments>
		<pubDate>Sun, 07 Aug 2011 20:29:39 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux - Logiciels]]></category>
		<category><![CDATA[PHP / MySQL]]></category>
		<category><![CDATA[Programmation]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=213</guid>
		<description><![CDATA[dans cet article-tuto nous allons voir comment mettre en place un système d'upload avec une sympathique barre de progression. les pré-requis : - un serveur web Apache - PHP5 avec l'extension APC - jquery dans ce tuto je pars du principe qu'Apache et PHP sont installés et fonctionnels, on va juste voir comment installer APC [...]]]></description>
			<content:encoded><![CDATA[<p>dans cet article-tuto nous allons voir comment mettre en place un système d'upload avec une sympathique barre de progression.</p>
<p>les pré-requis :<br />
- un serveur web Apache<br />
- PHP5 avec l'extension APC<br />
- <a href="http://jquery.com/" target="_blank">jquery</a></p>
<p>dans ce tuto je pars du principe qu'Apache et PHP sont installés et fonctionnels, on va juste voir comment installer APC et activer le suivi de la progression d'upload :</p>

<div class="wp_codebox"><table><tr id="p2138"><td class="code" id="p213code8"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> php-apc
<span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php5<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>apc.ini</pre></td></tr></table></div>

<p>ajouter à la fin du fichier :</p>

<div class="wp_codebox"><table><tr id="p2139"><td class="code" id="p213code9"><pre class="text" style="font-family:monospace;">apc.rfc1867 = on</pre></td></tr></table></div>

<p>cette ligne magique, activera la suivi de progression d'upload sur le serveur.</p>
<p>on reload apache :</p>

<div class="wp_codebox"><table><tr id="p21310"><td class="code" id="p213code10"><pre class="bash" style="font-family:monospace;"><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>apache2 reload</pre></td></tr></table></div>

<p>le coté système de la chose est maintenant terminé, passons à l'upload :</p>
<p>pour la petite histoire, voici ce que l'on va faire :<br />
on va créer un formulaire, qui sera validé vers (target) une iframe invisible, le temps que l'upload se passe, on va contacter un petit script php en ajax (très souvent) qui va nous dire où en est l'upload, en nous retournant le pourcentage d'avancement (tout simplement), avec cette valeur, on va pouvoir mettre en place une barre de progression très facilement.</p>
<p>pour commencer, le formulaire :</p>

<div class="wp_codebox"><table><tr id="p21311"><td class="code" id="p213code11"><pre class="html" style="font-family:monospace;">&lt;?php $unique_id = uniqid(); //id unique de notre formulaire ?&gt;
&nbsp;
&lt;!-- iframe caché en javascript dans laquelle se fait l'upload, elle affichera le message de confirmation / ou erreur à la fin de l'upload --&gt;
&lt;iframe frameborder=&quot;0&quot; border=&quot;0&quot; id=&quot;upload_to&quot; name=&quot;upload_to&quot; style=&quot;width: 100%; border:none; border-color: #fff;&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;
&nbsp;
&lt;!-- le formulaire d'upload --&gt;
&lt;form id=&quot;upload_form&quot; enctype=&quot;multipart/form-data&quot; action=&quot;upload.php&quot; method=&quot;post&quot; target=&quot;upload_to&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;APC_UPLOAD_PROGRESS&quot; id=&quot;progress_key&quot; value=&quot;&lt;?php echo $unique_id?&gt;&quot;/&gt;
&lt;div id=&quot;progressouter&quot;&gt;
	&lt;div id=&quot;progressinner&quot;&gt;&lt;span id=&quot;progression_percent&quot;&gt;0&amp;nbsp;%&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;input id=&quot;file&quot; type=&quot;file&quot; name=&quot;file&quot; size=&quot;30&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;submit&quot; value=&quot;valider&quot; /&gt;&lt;/p&gt;
&lt;/form&gt;</pre></td></tr></table></div>

<p>le bout de php au début, permet de donner un id unique au formulaire<br />
il est renseigné dans le champ "<strong>APC_UPLOAD_PROGRESS</strong>" ceci permet au système de donner un id à l'upload en cours, ce qui nous permettra de consulter la progression en le connaissant (l'id).</p>
<p>l'iframe n'a rien de spéciale, elle est caché en javascript (voir plus bas).</p>
<p>le formulaire contient l'HTML de la barre de progression (la div <strong>progressouter</strong>, on pourrait la mettre ailleurs, chacun fait ce qu'il veut. et le champ hidden <strong>APC_UPLOAD_PROGRESS</strong> comme dit plus haut, obligatoire pour le suivi de l'upload.</p>
<p>passons maintenant à notre script d'upload : <strong>upload.php</strong><br />
l'upload en lui même n'est pas vraiment notre sujet du jour, donc, je prends l'exemple d'upload le plus simple au monde (donné sur <a href="http://php.net" target="_blank">php.net</a>)</p>

<div class="wp_codebox"><table><tr id="p21312"><td class="code" id="p213code12"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$uploaddir</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/var/www/uploads/'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$uploadfile</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$uploaddir</span> <span style="color: #339933;">.</span> <a href="http://www.php.net/basename"><span style="color: #990000;">basename</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/move_uploaded_file"><span style="color: #990000;">move_uploaded_file</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tmp_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uploadfile</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;File is valid, and was successfully uploaded.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Possible file upload attack!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>on aura besoin du fameux script qui retourne le pourcentage d'avancement de l'upload : <strong>progress.php</strong></p>

<div class="wp_codebox"><table><tr id="p21313"><td class="code" id="p213code13"><pre class="php" style="font-family:monospace;"><a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control: no-cache&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//utile pour IE (problème avec l'ajax)</span>
<span style="color: #666666; font-style: italic;">//progression</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'progress_key'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$upload</span> <span style="color: #339933;">=</span> apc_fetch<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'upload_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'progress_key'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$percent</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$upload</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$upload</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'done'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #000088;">$percent</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$upload</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'total'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
            <span style="color: #000088;">$percent</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">else</span>
            <span style="color: #000088;">$percent</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$upload</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'current'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$upload</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'total'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">echo</span> <a href="http://www.php.net/number_format"><span style="color: #990000;">number_format</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>c'est presque fini, il ne reste plus que le javascript :</p>

<div class="wp_codebox"><table><tr id="p21314"><td class="code" id="p213code14"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> getProgress<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> count <span style="color: #339933;">=</span> Math.<span style="color: #660066;">random</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">/// Math.random sélectionne un nombre entre 0 et 1 ( ex: 0.6489534931546957) pour IE aussi (même si le header no-cache devrait suffire)</span>
    $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
        type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;GET&quot;</span><span style="color: #339933;">,</span>
        url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;/progress.php?progress_key=&lt;?php echo($unique_id)?&gt;&amp;count=&quot;</span><span style="color: #339933;">+</span>count<span style="color: #339933;">,</span>
        success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>percent<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>percent <span style="color: #339933;">&lt;=</span> <span style="color: #CC0000;">100</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#progressinner&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;width&quot;</span><span style="color: #339933;">,</span> percent<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;%&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#progression_percent&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span>percent<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot; %&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>percent <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">100</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                setTimeout<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;getProgress()&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>percent <span style="color: #339933;">==</span> <span style="color: #CC0000;">100</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#upload_to&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;slow&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#file&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> startProgress<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#progressouter, #progression_percent&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    setTimeout<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;getProgress()&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#upload_to&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#upload_form'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">submit</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        startProgress<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>en gros (très gros même) ce js va cacher l'iframe au chargement de la page, et à la validation du formulaire, il va lancer la fonction startProgress(), qui elle, va afficher la barre de progression et lancer régulièrement getProgress, qui elle, fait un appel ajax à notre script progress.php et lui indiquant l'unique id généré tout au début de la page et en fonction du retour, elle va ajuster la largeur de la barre de progression.</p>
<p>si vous avez des questions, n'hésitez pas à les poser dans les commentaires.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnaeh.net%2Fupload-avec-barre-de-progression%2F&amp;title=upload%20avec%20barre%20de%20progression" id="wpa2a_2"><img src="http://naeh.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://naeh.net/upload-avec-barre-de-progression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sécuriser un serveur MySQL avec iptables</title>
		<link>http://naeh.net/securiser-un-serveur-mysql-avec-iptables/</link>
		<comments>http://naeh.net/securiser-un-serveur-mysql-avec-iptables/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 18:40:18 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux - Logiciels]]></category>
		<category><![CDATA[Linux - OS]]></category>
		<category><![CDATA[firewal]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[phpmyadmin]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=211</guid>
		<description><![CDATA[quand on a plusieurs serveurs avec un mysql sur chacun, on aimerait parfois avoir un seul phpmyadmin dans lequel tous les serveurs mysql remontent, la solution est très simple, il suffit d'aller dans /etc/mysql/my.cnf et de commenter la ligne : bind-address = 127.0.0.1 en ajoutant un # devant. ça s'applique aussi quand on a un [...]]]></description>
			<content:encoded><![CDATA[<p>quand on a plusieurs serveurs avec un mysql sur chacun, on aimerait parfois avoir un seul phpmyadmin dans lequel tous les serveurs mysql remontent, la solution est très simple, il suffit d'aller dans /etc/mysql/my.cnf et de commenter la ligne :</p>

<div class="wp_codebox"><table><tr id="p21117"><td class="code" id="p211code17"><pre class="bash" style="font-family:monospace;">bind-address           = 127.0.0.1</pre></td></tr></table></div>

<p>en ajoutant un # devant.</p>
<p>ça s'applique aussi quand on a un seul serveur mysql accessible par plusieurs serveurs web par exemple.</p>
<p>en faisant cela, on vient d'autoriser les connexions au serveur depuis... <strong>partout</strong> ! (alors que par défaut il ne les accepte que depuis localhost) ce qui va nous permettre d'avoir un phpmyadmin unique pour pleins de serveurs mysql.</p>
<p>le problème, c'est qu'en terme de sécurité, la règle est simple, "<strong>Je ferme tout, puis j'ouvre ce dont j'ai besoin</strong>"<br />
ici le besoin est d'ouvrir l'accès à Mysql depuis le serveur qui héberge phpmyadmin, or, avec notre modification, on vient d'ouvrir l'accès à tout le monde (encore faut-il avoir des login/password valides pour se connecter, mais vaut mieux ne pas tenter le diable^^).</p>
<p>pour remédier au problème, on va avoir recours au <strong>firewall</strong>, sous debain (et linux en général) c'est <strong>iptables</strong></p>
<p>on va explicitement permettre l'accès à notre mysql depuis le serveur hébergeant phpmyadmin, et... le refuser à tout le reste</p>

<div class="wp_codebox"><table><tr id="p21118"><td class="code" id="p211code18"><pre class="bash" style="font-family:monospace;">iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-s</span> IP_DU_SERVEUR_PHPMYADMIN <span style="color: #660033;">--dport</span> <span style="color: #000000;">3306</span> <span style="color: #660033;">-j</span> ACCEPT
iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #000000;">3306</span> <span style="color: #660033;">-j</span> DROP</pre></td></tr></table></div>

<p>et voilà, en 2 lignes c'est fait.<br />
la première autorise le serveur qui héberge phpmyadmin, la 2ème ferme tout.</p>
<p>il est à noter que ces règles seront perdues si le serveur redémarre, donc, si redémarrage, il faudra les retaper, ou sinon les mettre dans un script exécuté au démarrage, comment faire ? c'est le sujet d'un prochain post <img src='http://naeh.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnaeh.net%2Fsecuriser-un-serveur-mysql-avec-iptables%2F&amp;title=S%C3%A9curiser%20un%20serveur%20MySQL%20avec%20iptables" id="wpa2a_4"><img src="http://naeh.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://naeh.net/securiser-un-serveur-mysql-avec-iptables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>installer memcached sous debian lenny</title>
		<link>http://naeh.net/installer-memcached-sous-debian-lenny/</link>
		<comments>http://naeh.net/installer-memcached-sous-debian-lenny/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 13:40:59 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Divers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux - Logiciels]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=198</guid>
		<description><![CDATA[avec ce post nous allons voir la procédure pour installer memcache sur une debian lenny afin de l'utiliser avec php. Pour commencer installer memcached : apt-get install memcached ensuite, installer l'extension php pecl install memcache si l'installation échoue avec le message suivant : downloading memcache-2.2.6.tgz ... Starting to download memcache-2.2.6.tgz &#40;35,957 bytes&#41; ..........done: 35,957 bytes [...]]]></description>
			<content:encoded><![CDATA[<p>avec ce post nous allons voir la procédure pour installer memcache sur une debian lenny afin de l'utiliser avec php.</p>
<p>Pour commencer installer memcached :</p>

<div class="wp_codebox"><table><tr id="p19826"><td class="code" id="p198code26"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> memcached</pre></td></tr></table></div>

<p>ensuite, installer l'extension php</p>

<div class="wp_codebox"><table><tr id="p19827"><td class="code" id="p198code27"><pre class="bash" style="font-family:monospace;">pecl <span style="color: #c20cb9; font-weight: bold;">install</span> memcache</pre></td></tr></table></div>

<p>si l'installation échoue avec le message suivant :</p>

<div class="wp_codebox"><table><tr id="p19828"><td class="code" id="p198code28"><pre class="bash" style="font-family:monospace;">downloading memcache-2.2.6.tgz ...
Starting to download memcache-2.2.6.tgz <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">35</span>,<span style="color: #000000;">957</span> bytes<span style="color: #7a0874; font-weight: bold;">&#41;</span>
..........done: <span style="color: #000000;">35</span>,<span style="color: #000000;">957</span> bytes
<span style="color: #000000;">11</span> <span style="color: #7a0874; font-weight: bold;">source</span> files, building
running: phpize
<span style="color: #c20cb9; font-weight: bold;">sh</span>: phpize: <span style="color: #7a0874; font-weight: bold;">command</span> not found
ERROR: <span style="color: #000000; font-weight: bold;">`</span>phpize<span style="color: #ff0000;">' failed</span></pre></td></tr></table></div>

<p>Allez faire un tour ici : <a href="http://naeh.net/installation-fileinfo/" title="Installation de fileinfo" target="_blank">Installation de fileinfo</a> on a déjà rencontré ce problème <img src='http://naeh.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Pour rappel, il faut faire un simple :</p>

<div class="wp_codebox"><table><tr id="p19829"><td class="code" id="p198code29"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> php5-dev
et retenter le :
pecl <span style="color: #c20cb9; font-weight: bold;">install</span> memcache</pre></td></tr></table></div>

<p>il va surement vous poser une question, appuyez sur « entrée »</p>
<p>maintenant que memcache est correctement installer il faut l'activer en créant un fichier memcached.ini dans le dossier conf.d utilisé par le serveur (dans mon cas pour apache c'est : /etc/php5/apache2/conf.d) pour lighttpd par exemple c'est /etc/php5/cgi/conf.d) (cela évite de modifier les php.ini)<br />
memcached.ini doit contenir :</p>

<div class="wp_codebox"><table><tr id="p19830"><td class="code" id="p198code30"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">extension</span>=memcache.so</pre></td></tr></table></div>

<p>pour s'assurer que l'extension est bien installée, créer un fichier php contenant :</p>

<div class="wp_codebox"><table><tr id="p19831"><td class="code" id="p198code31"><pre class="php" style="font-family:monospace;"><a href="http://www.php.net/phpinfo"><span style="color: #990000;">phpinfo</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>et aller voir dedans, normalement vous devriez voir l'extension activée.</p>
<p><img src="http://naeh.net/wp-content/uploads/2011/07/memecache-300x171.gif" alt="phpinfo memecache" title="phpinfo memecache" width="300" height="171" class="aligncenter size-medium wp-image-203" /></p>
<p>pour l'utilisation, rien de bien méchant, la doc php (http://php.net/manual/fr/book.memcache.php) est très bien faite <img src='http://naeh.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>petit bonus :</strong><br />
pour vérifier que le service est bien lancé, faite :</p>

<div class="wp_codebox"><table><tr id="p19832"><td class="code" id="p198code32"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">netstat</span> <span style="color: #660033;">-latupen</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> memcached
résultat :
tcp        <span style="color: #000000;">0</span>      <span style="color: #000000;">0</span> 127.0.0.1:<span style="color: #000000;">11211</span>         0.0.0.0:<span style="color: #000000; font-weight: bold;">*</span>               LISTEN      <span style="color: #000000;">0</span>          <span style="color: #000000;">157533</span>      <span style="color: #000000;">5952</span><span style="color: #000000; font-weight: bold;">/</span>memcached</pre></td></tr></table></div>

<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnaeh.net%2Finstaller-memcached-sous-debian-lenny%2F&amp;title=installer%20memcached%20sous%20debian%20lenny" id="wpa2a_6"><img src="http://naeh.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://naeh.net/installer-memcached-sous-debian-lenny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Iptables &#8211; supprimer une règle spécifique</title>
		<link>http://naeh.net/iptables-supprimer-une-regle-specifique/</link>
		<comments>http://naeh.net/iptables-supprimer-une-regle-specifique/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 14:16:34 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux - Logiciels]]></category>
		<category><![CDATA[Linux - OS]]></category>
		<category><![CDATA[fail2ban]]></category>
		<category><![CDATA[iptables]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=179</guid>
		<description><![CDATA[Si comme moi, vous utilisez fail2ban ce qui est une très bonne chose, et que comme moi vous avez oublié de lui dire d'ignorer votre IP ce qui est une mauvaise chose et que par malheur vous vous plantez X fois (chez moi au bout du 2eme fail en 2 heures ==> ban pendant 10 [...]]]></description>
			<content:encoded><![CDATA[<p>Si comme moi, vous utilisez fail2ban ce qui est une très bonne chose, et que comme moi vous avez oublié de lui dire d'ignorer votre IP ce qui est une mauvaise chose et que par malheur vous vous plantez X fois (chez moi au bout du 2eme fail en 2 heures ==> ban pendant 10 jours !)</p>
<p>pour commencer il faut trouver une autre porte d'entrée au serveur (une autre adresse IP)</p>
<p>en suite le but est de supprimer la règle concernant votre IP sans devoir toucher aux autres règles voici comment faire :</p>

<div class="wp_codebox"><table><tr id="p17936"><td class="code" id="p179code36"><pre class="bash" style="font-family:monospace;">iptables <span style="color: #660033;">-L</span> <span style="color: #660033;">--line-numbers</span></pre></td></tr></table></div>

<p>ce qui donne (entre autre) :</p>

<div class="wp_codebox"><table><tr id="p17937"><td class="code" id="p179code37"><pre class="bash" style="font-family:monospace;">Chain fail2ban-ssh <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span> references<span style="color: #7a0874; font-weight: bold;">&#41;</span>
num  target     prot opt <span style="color: #7a0874; font-weight: bold;">source</span>               destination
<span style="color: #000000;">1</span>    DROP       all  <span style="color: #660033;">--</span>  kol-static-<span style="color: #000000;">36</span>-<span style="color: #000000;">240</span>-<span style="color: #000000;">16</span>-<span style="color: #000000;">61</span>.direct.net.in  anywhere
<span style="color: #000000;">2</span>    DROP       all  <span style="color: #660033;">--</span>  unknown-host.yaltanet.com.ua  anywhere
<span style="color: #000000;">3</span>    RETURN     all  <span style="color: #660033;">--</span>  anywhere             anywhere</pre></td></tr></table></div>

<p>là on vois qu'il y a 2 ip bannies, il faut repérer le numéro de ligne de cette qu'on veut supprimer (ce qui revient à autoriser l'ip a se connecter au serveur)</p>

<div class="wp_codebox"><table><tr id="p17938"><td class="code" id="p179code38"><pre class="bash" style="font-family:monospace;">iptables <span style="color: #660033;">-D</span> fail2ban-ssh X</pre></td></tr></table></div>

<p>fail2ban-ssh : le nom de la chain créée par fail2ban pour le ssh<br />
X : le #numéro de ligne qui nous intéresse</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnaeh.net%2Fiptables-supprimer-une-regle-specifique%2F&amp;title=Iptables%20%26%238211%3B%20supprimer%20une%20r%C3%A8gle%20sp%C3%A9cifique" id="wpa2a_8"><img src="http://naeh.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://naeh.net/iptables-supprimer-une-regle-specifique/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subversion 1.6 sur Debian lenny</title>
		<link>http://naeh.net/subversion-1-6-sur-debian-lenny/</link>
		<comments>http://naeh.net/subversion-1-6-sur-debian-lenny/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 18:56:54 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux - Logiciels]]></category>
		<category><![CDATA[svn subversion debian backports]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=169</guid>
		<description><![CDATA[alors là c'est le billet mémo par excellence étant utilisateur occasionnel de tortoiseSVN à jour, impossible pour moi d'utiliser svn en ligne de commande (beaucoup plus rapide que tortoise) sur ma debian, d'où l'idée de d'installer svn 1.6 qui n'est pas disponible dans les paquets debian. la procédure consiste a utiliser les backports, elle est [...]]]></description>
			<content:encoded><![CDATA[<p>alors là c'est le billet mémo par excellence <img src='http://naeh.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>étant utilisateur occasionnel de tortoiseSVN à jour, impossible pour moi d'utiliser svn en ligne de commande (beaucoup plus rapide que tortoise) sur ma debian, d'où l'idée de d'installer svn 1.6 qui n'est pas disponible dans les paquets debian.</p>
<p>la procédure consiste a utiliser les backports, elle est très simple, encore faut-il la connaitre (ou la trouver facilement)</p>
<p>pour commencer il faut savoir que svn 1.5 doit être déjà installé sur la machine, si ce n'est pas le cas, faire :</p>

<div class="wp_codebox"><table><tr id="p16943"><td class="code" id="p169code43"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> subversion subversion-tools apache2 libapache2-svn</pre></td></tr></table></div>

<p>1. configuration du sources.list<br />
il faut ajouter cette ligne à la fin du fichier <em>/etc/apt/sources.list</em></p>

<div class="wp_codebox"><table><tr id="p16944"><td class="code" id="p169code44"><pre class="sh" style="font-family:monospace;">deb http://www.backports.org/debian lenny-backports main contrib non-free</pre></td></tr></table></div>

<p>2. mettre à jour la base de paquets :</p>

<div class="wp_codebox"><table><tr id="p16945"><td class="code" id="p169code45"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> update</pre></td></tr></table></div>

<p>3. on instalel svn en spécifiant la source (backports) :</p>

<div class="wp_codebox"><table><tr id="p16946"><td class="code" id="p169code46"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #660033;">-t</span> lenny-backports <span style="color: #c20cb9; font-weight: bold;">install</span> subversion subversion-tools libapache2-svn</pre></td></tr></table></div>

<p>et maintenant on peut utiliser svn en ligne de commande avec des référentiels "commités" avec des version récentes de subversion (comme tortoise)</p>
<p>Source du tuto : <a href="http://swherdman.com/2009/05/subversion-16-on-debian-lenny/">http://swherdman.com/2009/05/subversion-16-on-debian-lenny/</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnaeh.net%2Fsubversion-1-6-sur-debian-lenny%2F&amp;title=Subversion%201.6%20sur%20Debian%20lenny" id="wpa2a_10"><img src="http://naeh.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://naeh.net/subversion-1-6-sur-debian-lenny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuration d&#039;Exim avec nom de domaine géré par gandi</title>
		<link>http://naeh.net/configuration-dexim-avec-nom-de-domaine-gere-par-gandi/</link>
		<comments>http://naeh.net/configuration-dexim-avec-nom-de-domaine-gere-par-gandi/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 12:26:40 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux - Logiciels]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[exim]]></category>
		<category><![CDATA[gandi]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=151</guid>
		<description><![CDATA[Bonjour, aujourd'hui nous allons voir comment, facilement, exploiter une fonctionnalité offerte par Gandi (ou bien comprise dans le prix de nom de domaine, ça dépend comment on voit les choses). beaucoup d'entre nous n'ont pas le temps (et souvent pas l'envie de non plus) de se prendre la tête avec un vrai MTA genre postfix [...]]]></description>
			<content:encoded><![CDATA[<p>Bonjour,</p>
<p>aujourd'hui nous allons voir comment, facilement, exploiter une fonctionnalité offerte par Gandi (ou bien comprise dans le prix de nom de domaine, ça dépend comment on voit les choses).</p>
<p>beaucoup d'entre nous n'ont pas le temps (et souvent pas l'envie de non plus) de se prendre la tête avec un vrai MTA genre postfix ou exim et le configurer en s'assurant de bien renseigner les enregistrement MX chez le registrar, d'installer les bons outils pour le POP (ou IMAP) etc. etc.</p>
<p>il faut savoir qu'avec un nom de domaine de chez Gandi, on a droit a quelques comptes emails (5 par domaine de mémoire) et une infinité d'alias sur ces comptes.</p>
<p>ce qu'on va voir ici, c'est comment configurer une machine (serveur dédié) pour assurer le minimum syndical en s'appuyant sur le service proposé par gandi.</p>
<p>dans notre exemple il s'agira d'un Exim4 (c'est le seul avec lequel j'ai testé pour l'instant, et ça marche tellement bien que je n'ai pas envie de changer <img src='http://naeh.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   )</p>
<p>on va supposer un compte admin@mon-domaine.com</p>
<p>tout d'abord il faut éditer le fichier : <strong>/etc/exim4/passwd.client</strong> en ajoutant tout à la fin :</p>

<div class="wp_codebox"><table><tr id="p15151"><td class="code" id="p151code51"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">*</span>:admin<span style="color: #000000; font-weight: bold;">@</span>mon-domaine.com:MOT-DE-PASSE-DU-COMPTE</pre></td></tr></table></div>

<p>en suite, on va éditer le fichier <strong>/etc/exim4/update-exim4.conf.conf</strong> pour avoir quelque chose comme :</p>

<div class="wp_codebox"><table><tr id="p15152"><td class="code" id="p151code52"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">dc_eximconfig_configtype</span>=<span style="color: #ff0000;">'satellite'</span>
<span style="color: #007800;">dc_other_hostnames</span>=<span style="color: #ff0000;">''</span>
<span style="color: #007800;">dc_local_interfaces</span>=<span style="color: #ff0000;">'127.0.0.1'</span>
<span style="color: #007800;">dc_readhost</span>=<span style="color: #ff0000;">'mon-domaine.com'</span>
<span style="color: #007800;">dc_relay_domains</span>=<span style="color: #ff0000;">''</span>
<span style="color: #007800;">dc_minimaldns</span>=<span style="color: #ff0000;">'false'</span>
<span style="color: #007800;">dc_relay_nets</span>=<span style="color: #ff0000;">''</span>
<span style="color: #007800;">dc_smarthost</span>=<span style="color: #ff0000;">'mail.gandi.net:587'</span>
<span style="color: #007800;">CFILEMODE</span>=<span style="color: #ff0000;">'644'</span>
<span style="color: #007800;">dc_use_split_config</span>=<span style="color: #ff0000;">'false'</span>
<span style="color: #007800;">dc_hide_mailname</span>=<span style="color: #ff0000;">'true'</span>
<span style="color: #007800;">dc_mailname_in_oh</span>=<span style="color: #ff0000;">'true'</span>
<span style="color: #007800;">dc_localdelivery</span>=<span style="color: #ff0000;">'mail_spool'</span></pre></td></tr></table></div>

<p>un petit</p>

<div class="wp_codebox"><table><tr id="p15153"><td class="code" id="p151code53"><pre class="bash" style="font-family:monospace;"><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>exim4 reload</pre></td></tr></table></div>

<p>et le tour est joué <img src='http://naeh.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>votre serveur envoie maintenant ces mails en utilisant le compte gandi, plus de soucis de conf complexe, maj à risque etc a se faire...</p>
<p>pour tester :</p>

<div class="wp_codebox"><table><tr id="p15154"><td class="code" id="p151code54"><pre class="bash" style="font-family:monospace;">test-machine:<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>exim4<span style="color: #666666; font-style: italic;"># mail user@omain.tld</span>
Subject: <span style="color: #7a0874; font-weight: bold;">test</span>
ceci est un message de <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #000000; font-weight: bold;">!</span>
.
Cc:</pre></td></tr></table></div>

<p>PS. procédure trouvé il y a un moment sur les forums gandi, mais je n'arrive jamais a la retrouver je la mets ici, au cas où.<br />
PS2. comme d'habitude, notre distribution ici est une Debian <img src='http://naeh.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnaeh.net%2Fconfiguration-dexim-avec-nom-de-domaine-gere-par-gandi%2F&amp;title=Configuration%20d%26%23039%3BExim%20avec%20nom%20de%20domaine%20g%C3%A9r%C3%A9%20par%20gandi" id="wpa2a_12"><img src="http://naeh.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://naeh.net/configuration-dexim-avec-nom-de-domaine-gere-par-gandi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installer et configurer Munin</title>
		<link>http://naeh.net/installer-et-configurer-munin/</link>
		<comments>http://naeh.net/installer-et-configurer-munin/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 11:20:10 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux - Logiciels]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[munin]]></category>
		<category><![CDATA[stats]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=110</guid>
		<description><![CDATA[... sur une debian. Aujourd'hui on va voir comment installer et configurer l'outil de monitoring munin Un petit article aide mémoire comme beaucoup d'autres sur ce blog pour commencer : apt-get install munin munin-node en suite il faut éditer le fichier de configuration : /etc/munin/munin.conf changer juste la valeur de htmldir pour choisir un répertoire [...]]]></description>
			<content:encoded><![CDATA[<p>... sur une debian.</p>
<p>Aujourd'hui on va voir comment installer et configurer l'outil de monitoring munin</p>
<p>Un petit article aide mémoire comme beaucoup d'autres sur ce blog <img src='http://naeh.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>pour commencer :</p>

<div class="wp_codebox"><table><tr id="p11059"><td class="code" id="p110code59"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> munin munin-node</pre></td></tr></table></div>

<p>en suite il faut éditer le fichier de configuration : <em>/etc/munin/munin.conf</em></p>
<p>changer juste la valeur de htmldir pour choisir un répertoire où les fichiers html des rapports seront déposés, pour moi c'est sous un vhosts de statistiques, exemple :</p>

<div class="wp_codebox"><table><tr id="p11060"><td class="code" id="p110code60"><pre class="bash" style="font-family:monospace;">htmldir	<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>munin</pre></td></tr></table></div>

<p>vous pouvez aussi laisser la valeur par défaut.</p>
<p>un autre fichier de configuration pourrait vous intéresser, personnellement je n'ai pas eu a le toucher : <em>/etc/munin/munin-node.conf</em></p>
<p><strong>Important : </strong>Assurez vous que le répertoire "htmldir" choisi plus haut soit accessible en écriture a l'utilisateur munin (sinon le cron vous bombarde de mails pas cool), moi j'ai fait un :</p>

<div class="wp_codebox"><table><tr id="p11061"><td class="code" id="p110code61"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> munin:www-data MON<span style="color: #000000; font-weight: bold;">/</span>HTML<span style="color: #000000; font-weight: bold;">/</span>DIR<span style="color: #000000; font-weight: bold;">/</span>DE<span style="color: #000000; font-weight: bold;">/</span>MUNIN</pre></td></tr></table></div>

<p>maintenant on restart tout ça :</p>

<div class="wp_codebox"><table><tr id="p11062"><td class="code" id="p110code62"><pre class="bash" style="font-family:monospace;"><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>munin-node restart</pre></td></tr></table></div>

<p>quelques minutes après (le temps de générer quelques stats) on va a l'url correspondant au htmldir et on admire les garphs <img src='http://naeh.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><center><img src="http://naeh.net/wp-content/uploads/2009/10/localhostlocaldomain-memory-day.png" alt="localhostlocaldomain-memory-day" title="localhostlocaldomain-memory-day" width="495" height="415" class="aligncenter size-full wp-image-111 margin:0 auto;" /></center></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnaeh.net%2Finstaller-et-configurer-munin%2F&amp;title=Installer%20et%20configurer%20Munin" id="wpa2a_14"><img src="http://naeh.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://naeh.net/installer-et-configurer-munin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lighttpd vs Apache vs Lighttpd + Apache</title>
		<link>http://naeh.net/lighttpd-vs-apache-vs-lighttpd-apache/</link>
		<comments>http://naeh.net/lighttpd-vs-apache-vs-lighttpd-apache/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 21:37:46 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Divers]]></category>
		<category><![CDATA[Linux - Logiciels]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=85</guid>
		<description><![CDATA[Il fut un temps où on ne se posait pas de question quant au serveur web, on prend Apache et on en parle plus, aujourd'hui les choses ont changé, Apache reste quand même le plus utilisé avec plus de 66% des parts de marché, suivi par IIS, puis tous les autres "petits" derrière, néanmoins en [...]]]></description>
			<content:encoded><![CDATA[<p>Il fut un temps où on ne se posait pas de question quant au serveur web, on prend Apache et on en parle plus, aujourd'hui les choses ont changé, Apache reste quand même le plus utilisé avec plus de 66% des parts de marché, suivi par IIS, puis tous les autres "petits" derrière, néanmoins en fonction des besoins, certains de ces petits peuvent s'avérer bien plus performants qu'Apache, aujourd'hui on va tester 3 configurations possibles avec Apache et Lighttpd.</p>
<p>d'après ce qu'on peut lire un peu partout sur le net, Lighttpd (lighty pour les intimes) est beaucoup plus performant quand il s'agit de servir des pages statiques, mais qu'en est-il vraiment ? et comment s'en sort-il avec le contenu dynamique ? (des sites statiques ça n'existe plus de nos jours ^^).</p>
<p>pour notre test, on va prendre un site très léger, basé sur Zend framework (donc loin d'être statique), contenant une page qui affiche 9 images au hasard a partir d'une tables mysql contenant environ 1000 enregistrements (seulement les emplacement des images sont stockés dans la base). Le serveur de test est un kimsufi L (petit processeur et 1Go de RAM).</p>
<p><strong>versions utilisées : </strong><br />
<a href="http://www.apache.org/" target="_blank">Apache 2.2.9</a><br />
<a href="http://www.lighttpd.net/" target="_blank">Lighttpd 1.4.19</a><br />
<a href="http://fr.php.net/" target="_blank">PHP 5.2.6</a></p>
<p>pour les tests on utilise <a href="http://packages.debian.org/fr/sid/siege" target="_blank">siege</a>, on lance donc un siege avec 100 concurrency sur 10 minutes, voici la commande :</p>

<div class="wp_codebox"><table><tr id="p8568"><td class="code" id="p85code68"><pre class="bash" style="font-family:monospace;">siege <span style="color: #660033;">-c100</span> <span style="color: #660033;">-t10M</span> URL_DU_SITE</pre></td></tr></table></div>

<p>on note également le Load average de la machine a la fin de l'opération.</p>
<h2>1ère configuration : Lighttpd tout seul</h2>
<p>voici le resultat :</p>

<div class="wp_codebox"><table><tr id="p8569"><td class="code" id="p85code69"><pre class="bash" style="font-family:monospace;">Load average : <span style="color: #000000;">4.87</span>
&nbsp;
Lifting the server siege...      done.
Transactions:		       <span style="color: #000000;">23859</span> hits
Availability:		      <span style="color: #000000;">100.00</span> <span style="color: #000000; font-weight: bold;">%</span>
Elapsed <span style="color: #000000; font-weight: bold;">time</span>:		      <span style="color: #000000;">600.37</span> secs
Data transferred:	       <span style="color: #000000;">83.25</span> MB
Response <span style="color: #000000; font-weight: bold;">time</span>:		        <span style="color: #000000;">2.02</span> secs
Transaction rate:	       <span style="color: #000000;">39.74</span> trans<span style="color: #000000; font-weight: bold;">/</span>sec
Throughput:		        <span style="color: #000000;">0.14</span> MB<span style="color: #000000; font-weight: bold;">/</span>sec
Concurrency:		       <span style="color: #000000;">80.21</span>
Successful transactions:       <span style="color: #000000;">23859</span>
Failed transactions:	           <span style="color: #000000;">0</span>
Longest transaction:	        <span style="color: #000000;">5.20</span>
Shortest transaction:	        <span style="color: #000000;">0.10</span></pre></td></tr></table></div>

<h2>2ème configuration : Apache2 tout seul</h2>
<p>le résultat :</p>

<div class="wp_codebox"><table><tr id="p8570"><td class="code" id="p85code70"><pre class="bash" style="font-family:monospace;">Load average : <span style="color: #000000;">77.51</span>
&nbsp;
Lifting the server siege...      done.
Transactions:		       <span style="color: #000000;">23543</span> hits
Availability:		      <span style="color: #000000;">100.00</span> <span style="color: #000000; font-weight: bold;">%</span>
Elapsed <span style="color: #000000; font-weight: bold;">time</span>:		      <span style="color: #000000;">599.66</span> secs
Data transferred:	       <span style="color: #000000;">82.16</span> MB
Response <span style="color: #000000; font-weight: bold;">time</span>:		        <span style="color: #000000;">2.04</span> secs
Transaction rate:	       <span style="color: #000000;">39.26</span> trans<span style="color: #000000; font-weight: bold;">/</span>sec
Throughput:		        <span style="color: #000000;">0.14</span> MB<span style="color: #000000; font-weight: bold;">/</span>sec
Concurrency:		       <span style="color: #000000;">80.22</span>
Successful transactions:       <span style="color: #000000;">23543</span>
Failed transactions:	           <span style="color: #000000;">0</span>
Longest transaction:	       <span style="color: #000000;">10.51</span>
Shortest transaction:	        <span style="color: #000000;">0.05</span></pre></td></tr></table></div>

<h2>3ème configuration : Lighttpd + Apache</h2>
<p>maintenant faisons le test en couplant les 2, dans cette configuration tout ce qui est statique (images, css, js, etc.) sera servi par lighty alors que les scripts php eux, seront traités par apache, pour cela on active le mod_proxy dans lighty, et on ajoute le code suivant dans le vhost de notre site :</p>

<div class="wp_codebox"><table><tr id="p8571"><td class="code" id="p85code71"><pre class="bash" style="font-family:monospace;"> <span style="color: #007800;">$HTTP</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">&quot;url&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">!</span>~ <span style="color: #ff0000;">&quot;\.(js|css|gif|jpg|png|ico|txt|swf|html|htm)$&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
               proxy.server  = <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #ff0000;">&quot;&quot;</span> =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>
                               <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #ff0000;">&quot;host&quot;</span> =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #ff0000;">&quot;127.0.0.1&quot;</span>, <span style="color: #ff0000;">&quot;port&quot;</span> =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000;">8080</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
                       <span style="color: #7a0874; font-weight: bold;">&#41;</span>
               <span style="color: #7a0874; font-weight: bold;">&#41;</span>
       <span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></td></tr></table></div>

<p>vous l'aurez compris, Apache écoute sur le port 8080 (c'est fait en changeant le fichier /etc/apache2/ports.conf).</p>
<p>voici le résultat :</p>

<div class="wp_codebox"><table><tr id="p8572"><td class="code" id="p85code72"><pre class="bash" style="font-family:monospace;">Load average : <span style="color: #000000;">14.79</span>
&nbsp;
Lifting the server siege...      done.
Transactions:		       <span style="color: #000000;">22684</span> hits
Availability:		      <span style="color: #000000;">100.00</span> <span style="color: #000000; font-weight: bold;">%</span>
Elapsed <span style="color: #000000; font-weight: bold;">time</span>:		      <span style="color: #000000;">600.25</span> secs
Data transferred:	       <span style="color: #000000;">79.10</span> MB
Response <span style="color: #000000; font-weight: bold;">time</span>:		        <span style="color: #000000;">2.13</span> secs
Transaction rate:	       <span style="color: #000000;">37.79</span> trans<span style="color: #000000; font-weight: bold;">/</span>sec
Throughput:		        <span style="color: #000000;">0.13</span> MB<span style="color: #000000; font-weight: bold;">/</span>sec
Concurrency:		       <span style="color: #000000;">80.53</span>
Successful transactions:       <span style="color: #000000;">22684</span>
Failed transactions:	           <span style="color: #000000;">0</span>
Longest transaction:	        <span style="color: #000000;">8.61</span>
Shortest transaction:	        <span style="color: #000000;">0.07</span></pre></td></tr></table></div>

<p>plutôt surprenant !</p>
<h2>Conclusion :</h2>
<p>Lighty s'en sort très bien au vu des transactions/s (ou le nombre total de transactions traitées), contrairement a ce qu'on pouvait attendre, coupler les 2 nous fait perdre en performances (on enregistre quand même un load average nettement inférieur a la config d'apache tout seul).</p>
<p>personnellement ce que je retiens, c'est que lighty n'est pas si mauvais que ça pour le contenu dynamique, les performances restent quand très proches dans les 3 cas, donc autant utiliser la solution qui nous plait <img src='http://naeh.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnaeh.net%2Flighttpd-vs-apache-vs-lighttpd-apache%2F&amp;title=Lighttpd%20vs%20Apache%20vs%20Lighttpd%20%2B%20Apache" id="wpa2a_16"><img src="http://naeh.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://naeh.net/lighttpd-vs-apache-vs-lighttpd-apache/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Partager un répertoire Windows avec VirtualBox</title>
		<link>http://naeh.net/partager-un-repertoire-windows-avec-virtualbox/</link>
		<comments>http://naeh.net/partager-un-repertoire-windows-avec-virtualbox/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 19:03:03 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Divers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux - Logiciels]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows - Logiciels]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[partage]]></category>
		<category><![CDATA[virtualBox]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=59</guid>
		<description><![CDATA[Dans cet article nous allons voir comment partager, facilement, un répertoire Windows avec une machine virtuelle sous VirtualBox. Tout d'abord, précisions l'environnement : Il s'agit d'un système Hôte sous Windows XP, nous installons dessus le logiciel VirtualBox, et dans ce dernier nous créons une machine virtuelle tournant sous Linux (Systême guest). Pour commencer il faut [...]]]></description>
			<content:encoded><![CDATA[<p>Dans cet article nous allons voir comment partager, facilement, un répertoire Windows avec une machine virtuelle sous VirtualBox.</p>
<p>Tout d'abord, précisions l'environnement :<br />
Il s'agit d'un système Hôte sous Windows XP, nous installons dessus le logiciel VirtualBox, et dans ce dernier nous créons une machine virtuelle tournant sous Linux (Systême guest).</p>
<p>Pour commencer il faut installer les additions client pour notre VirtualBox, pour cela je vous renvoie à notre article : <a href="http://naeh.net/additions-client-pour-virtualbox/">Additions client pour VirtualBox</a>.</p>
<p>Une fois les additions client installées, procédons comme suit :</p>
<ol>
<li>Sélectionner la machine virtuelle est cliquez sur "<strong>Répertoires Partagés</strong>"</li>
<li>Cliquez sur le "<strong>+</strong>" (PLUS) a droite de la fenêtre qui s'ouvre et sélectionner un répertoire à partager, vous pouvez lui donner un nom</li>
<li>Valider et démarrez votre machine virtuelle</li>
</ol>
<p>Maintenant, nous allons voir comment monter le partage du coté de notre système guest (Linux), pour cela, exécutez la commande suivante :</p>

<div class="wp_codebox"><table><tr id="p5975"><td class="code" id="p59code75"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-t</span> vboxsf NOM_PARTAGE POINT_MONTAGE</pre></td></tr></table></div>

<p>où :<br />
NOM_PARTAGE est le nom que vous avez donné à votre répertoire partagé lors de sa sélection.<br />
POINT_MONTAGE est le point (répertoire, ou encore emplacement) dans la machine virtuelle dans lequel vous voulez monter le répertoire.</p>
<p>voici un exemple avec un partage nommé Downloads :</p>

<div class="wp_codebox"><table><tr id="p5976"><td class="code" id="p59code76"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-t</span> vboxsf Downloads <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>downloads</pre></td></tr></table></div>

<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnaeh.net%2Fpartager-un-repertoire-windows-avec-virtualbox%2F&amp;title=Partager%20un%20r%C3%A9pertoire%20Windows%20avec%20VirtualBox" id="wpa2a_18"><img src="http://naeh.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://naeh.net/partager-un-repertoire-windows-avec-virtualbox/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Installer libssh2, ssh2 pour php</title>
		<link>http://naeh.net/installer-libssh2-ssh2-pour-php/</link>
		<comments>http://naeh.net/installer-libssh2-ssh2-pour-php/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 20:51:00 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux - Logiciels]]></category>
		<category><![CDATA[PHP / MySQL]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[libssh2]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[Serveur]]></category>
		<category><![CDATA[ssh2]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=56</guid>
		<description><![CDATA[Dans cet article nous allons voir comment installer l'extension ssh2 pour php5, cette extension permet l'utilisation de fonctionnalités SSH2 avec php (très utiles quand on veut faire du SFTP par exemple) pour plus d'informations cf. la documentation officielle sur php.net Pour l'installation, ce n'est pas très compliqué, il suffit de suivre ces quelques étapes à [...]]]></description>
			<content:encoded><![CDATA[<p>Dans cet article nous allons voir comment installer l'extension ssh2 pour php5, cette extension permet l'utilisation de fonctionnalités SSH2 avec php (très utiles quand on veut faire du SFTP par exemple) pour plus d'informations cf. <a href="http://fr.php.net/manual/fr/book.ssh2.php" target="_blank">la documentation officielle sur php.net</a></p>
<p>Pour l'installation, ce n'est pas très compliqué, il suffit de suivre ces quelques étapes à la lettre et tout ira très bien <img src='http://naeh.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>tout d'abord il faut s'assurer d'avoir les bons paquets d'installés, en voici une liste :</p>
<ul>
<li>php5-dev</li>
<li>openssl</li>
<li>libssl-dev</li>
<li>gcc</li>
<li>make</li>
<li>etc. je suppose que si vous installez cette extension, c'est que vous avez déjà php, apache etc.</li>
</ul>
<p><em>Toute la suite s'effectue en root</em></p>
<p>mais avant toute chose, n'oublions pas de faire un petit :</p>

<div class="wp_codebox"><table><tr id="p5687"><td class="code" id="p56code87"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> upgrade</pre></td></tr></table></div>

<p>en suite il faut créer un répertoire de travail :</p>

<div class="wp_codebox"><table><tr id="p5688"><td class="code" id="p56code88"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> libssh2
<span style="color: #7a0874; font-weight: bold;">cd</span> libssh2</pre></td></tr></table></div>

<p>ensuite télécharger libssh2 :</p>

<div class="wp_codebox"><table><tr id="p5689"><td class="code" id="p56code89"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>ovh.dl.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>sourceforge<span style="color: #000000; font-weight: bold;">/</span>libssh2<span style="color: #000000; font-weight: bold;">/</span>libssh2-<span style="color: #000000;">0.14</span>.tar.gz</pre></td></tr></table></div>

<p>puis l'extraire :</p>

<div class="wp_codebox"><table><tr id="p5690"><td class="code" id="p56code90"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzvf</span> libssh2-<span style="color: #000000;">0.14</span>.tar.gz</pre></td></tr></table></div>

<p>aller dans le répertoire créé et installer libssh2 :</p>

<div class="wp_codebox"><table><tr id="p5691"><td class="code" id="p56code91"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> libssh2-<span style="color: #000000;">0.14</span>
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> all <span style="color: #c20cb9; font-weight: bold;">install</span></pre></td></tr></table></div>

<p>maintenant que libssh2 est installée, passons a ssh2 :</p>
<p>on sort du repertoire de libssh2 et on télécharge ssh2 :</p>

<div class="wp_codebox"><table><tr id="p5692"><td class="code" id="p56code92"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ..
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>pecl.php.net<span style="color: #000000; font-weight: bold;">/</span>get<span style="color: #000000; font-weight: bold;">/</span>ssh2-<span style="color: #000000;">0.10</span>.tgz</pre></td></tr></table></div>

<p>extraire l'archive téléchargée :</p>

<div class="wp_codebox"><table><tr id="p5693"><td class="code" id="p56code93"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzvf</span> ssh2-<span style="color: #000000;">0.10</span>.tgz</pre></td></tr></table></div>

<p>aller dans le répertoire créé et installer ssh2 :</p>

<div class="wp_codebox"><table><tr id="p5694"><td class="code" id="p56code94"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ssh2-<span style="color: #000000;">0.10</span>
phpize <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-ssh2</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span></pre></td></tr></table></div>

<p>maintenant que l'installation est terminée, on active l'extension, ici on va copier le fichier ssh2.so dans le répertoire des extension de php5 (il peut être différent du mien selon la distrib et l'installation) :</p>

<div class="wp_codebox"><table><tr id="p5695"><td class="code" id="p56code95"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> modules<span style="color: #000000; font-weight: bold;">/</span>ssh2.so <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php5<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">20060613</span>+lfs</pre></td></tr></table></div>

<p>puis on ajoute l'extension en créant un fichier ssh2.ini dans le répertoire conf.d (comme pour toutes les autres extensions de php) on n'oublie pas de le faire pour apache mais aussi pour le mode CLI.</p>

<div class="wp_codebox"><table><tr id="p5696"><td class="code" id="p56code96"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;extension=ssh2.so&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php5<span style="color: #000000; font-weight: bold;">/</span>cli<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>ssh2.ini
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;extension=ssh2.so&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php5<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>ssh2.ini
<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>apache2 restart</pre></td></tr></table></div>

<p>Et voilà, notre extension est installée, a vous ssh2 et sftp avec php <img src='http://naeh.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fnaeh.net%2Finstaller-libssh2-ssh2-pour-php%2F&amp;title=Installer%20libssh2%2C%20ssh2%20pour%20php" id="wpa2a_20"><img src="http://naeh.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://naeh.net/installer-libssh2-ssh2-pour-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

