<?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>DestaqueBlog &#187; ubuntu</title>
	<atom:link href="http://weblog.destaquenet.com/tag/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://weblog.destaquenet.com</link>
	<description>Blog da equipe Destaquenet.</description>
	<lastBuildDate>Tue, 23 Nov 2010 17:06:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Crie seu próprio pendrive USB multi-boot salvador da pátria</title>
		<link>http://weblog.destaquenet.com/2010/08/02/crie-seu-proprio-pendrive-usb-multi-boot-salvador-da-patria/</link>
		<comments>http://weblog.destaquenet.com/2010/08/02/crie-seu-proprio-pendrive-usb-multi-boot-salvador-da-patria/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 11:20:50 +0000</pubDate>
		<dc:creator>Daniel Martins</dc:creator>
				<category><![CDATA[Português]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[boot]]></category>
		<category><![CDATA[clonezilla]]></category>
		<category><![CDATA[drive]]></category>
		<category><![CDATA[ferramentas]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[gparted]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[memtest]]></category>
		<category><![CDATA[mint]]></category>
		<category><![CDATA[multi-boot]]></category>
		<category><![CDATA[pendrive]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://weblog.destaquenet.com/?p=1060</guid>
		<description><![CDATA[Não preciso convencê-lo de que carregar algumas distribuições Linux com você pode fazer a diferença entre a vida e a morte. Bem, é claro que eu estou sendo um pouco dramático, mas é realmente muito bom poder rodar um teste &#8230; <a href="http://weblog.destaquenet.com/2010/08/02/crie-seu-proprio-pendrive-usb-multi-boot-salvador-da-patria/">Continue lendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Não preciso convencê-lo de que carregar algumas distribuições Linux com você pode fazer a diferença entre a vida e a morte. Bem, é claro que eu estou sendo um pouco dramático, mas é realmente muito bom poder rodar um teste de memória numa máquina que insiste em jogar erros estranhos na sua cara, ou mesmo copiar discos ou partições importantes quando você está por aí.</p>
<p>Para mim, algumas ferramentas e distribuições são particularmente úteis:</p>
<ul>
<li><a href="http://clonezilla.org/">Clonezilla</a>. Ferramenta muito boa para clonagem de disco/partição. Leva algum tempo para iniciantes se acostumarem com ela, mas vale o esforço. Já fui salvo por esta ferramenta mais de uma vez.</li>
<li><a href="http://gparted.sourceforge.net/">GParted</a>. Excelente ferramenta para particionamento de disco.</li>
<li><a href="http://linuxmint.com/">Linux Mint</a>. Distribuição Linux baseada no Ubuntu muito fácil de usar. Eu gosto muito da edição Live-DVD, que inclui softwares como <a href="http://www.videolan.org/vlc/">VLC</a>, <a href="http://www.openoffice.org/">OpenOffice</a> e <a href="http://java.com/">Java</a>.</li>
<li><a href="http://ubuntu.com/">Ubuntu</a>. Uma das distribuições Linux mais populares hoje em dia.</li>
<li><a href="http://www.memtest.org/">Memtest86+</a>. Ferramenta para teste de memória incluída na maioria das distribuições Linux modernas. Indispensável.</li>
</ul>
<p>Agora, em vez de queimar um CD/DVD com cada uma dessas ferramentas, nós iremos usar um pendrive USB multi-boot.</p>
<p><span id="more-1060"></span></p>
<h3>Preparando a pendrive</h3>
<p>O primeiro passo é instalar um bootloader na pendrive para possamos escolher qual distribuição carregar quando bootando a partir dela. Sorte minha que a distribuição Linux que uso, Ubuntu, já vem com o Grub2 pré-instalado. Esta versão do <a href="http://www.gnu.org/software/grub/">Grub</a> em particular é necessária, já que ela nos permite montar e bootar imagens .ISO.</p>
<p>Uma vez que você esteja com o Grub2 instalado, plugue sua pendrive e se certifique de que sua partição principal seja bootável, e que ela esteja formatada com FAT32 (<code>vfat</code>).</p>
<p>Então, rode este comando para instalar o Grub2 no pendrive:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> grub-install <span style="color: #660033;">--no-floppy</span> <span style="color: #660033;">--root-directory</span>=<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>PENDRIVE <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdX</pre></div></div>

<p>Lembre de fazer com que <code>root-directory</code> aponte para o caminho onde o pendrive está montado, e <code>/dev/sdX</code> para o dispositivo em si. Por favor, verifique os parâmetros duas vezes antes de rodar o comando, ou você corre o risco de fazer algo de que se arrependerá depois!</p>
<h3>Configurando o Grub2</h3>
<p>Agora é hora de baixar as imagens .ISO das distribuições mencionadas anteriormente e colocá-las no diretório <code>/boot/iso</code> dentro da pendrive. Então, crie o arquivo <code>/boot/grub/grub.cfg</code> com o seguinte conteúdo:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">menuentry <span style="color: #ff0000;">&quot;Linux Mint 9 x86&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">isofile</span>=<span style="color: #ff0000;">&quot;/boot/iso/linuxmint-9-gnome-dvd-i386.iso&quot;</span>
  loopback loop <span style="color: #007800;">$isofile</span>
  linux <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>casper<span style="color: #000000; font-weight: bold;">/</span>vmlinuz <span style="color: #007800;">boot</span>=casper iso-scan<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">filename</span>=<span style="color: #007800;">$isofile</span> noeject noprompt <span style="color: #660033;">--</span>
  initrd <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>casper<span style="color: #000000; font-weight: bold;">/</span>initrd.lz
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
menuentry <span style="color: #ff0000;">&quot;Ubuntu 10.04 Desktop x86&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">isofile</span>=<span style="color: #ff0000;">&quot;/boot/iso/ubuntu-10.04-desktop-i386.iso&quot;</span>
  loopback loop <span style="color: #007800;">$isofile</span>
  linux <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>casper<span style="color: #000000; font-weight: bold;">/</span>vmlinuz <span style="color: #007800;">boot</span>=casper iso-scan<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">filename</span>=<span style="color: #007800;">$isofile</span> noeject noprompt <span style="color: #660033;">--</span>
  initrd <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>casper<span style="color: #000000; font-weight: bold;">/</span>initrd.lz
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
menuentry <span style="color: #ff0000;">&quot;Clonezilla Live 1.2.5-17 x86&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">isofile</span>=<span style="color: #ff0000;">&quot;/boot/iso/clonezilla-live-1.2.5-17-i686.iso&quot;</span>
  loopback loop <span style="color: #007800;">$isofile</span> 
  linux <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>live<span style="color: #000000; font-weight: bold;">/</span>vmlinuz <span style="color: #007800;">boot</span>=live <span style="color: #007800;">union</span>=aufs nolocales noprompt <span style="color: #007800;">ip</span>=frommedia <span style="color: #007800;">toram</span>=filesystem.squashfs <span style="color: #007800;">findiso</span>=<span style="color: #007800;">$isofile</span> 
  initrd <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>live<span style="color: #000000; font-weight: bold;">/</span>initrd.img
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
menuentry <span style="color: #ff0000;">&quot;GParted Live 0.5.2-9 x86&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">isofile</span>=<span style="color: #ff0000;">&quot;/boot/iso/gparted-live-0.5.2-9.iso&quot;</span>
  loopback loop <span style="color: #007800;">$isofile</span> 
  linux <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>live<span style="color: #000000; font-weight: bold;">/</span>vmlinuz <span style="color: #007800;">boot</span>=live <span style="color: #007800;">union</span>=aufs nolocales noprompt <span style="color: #007800;">ip</span>=frommedia <span style="color: #007800;">toram</span>=filesystem.squashfs <span style="color: #007800;">findiso</span>=<span style="color: #007800;">$isofile</span> 
  initrd <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>live<span style="color: #000000; font-weight: bold;">/</span>initrd.img
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
menuentry <span style="color: #ff0000;">&quot;Memory test (memtest86+)&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  linux16 <span style="color: #000000; font-weight: bold;">/</span>boot<span style="color: #000000; font-weight: bold;">/</span>iso<span style="color: #000000; font-weight: bold;">/</span>memtest86+.bin
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Não se esqueça de alterar o valor as variáveis <code>isofile</code>, se necessário.</p>
<h3>Ressalva</h3>
<p>Esse negócio todo é novo, e existem apenas algumas  distribuições que podem ser bootadas dessa forma. Caso queira testar outras distribuições, você provavelmente terá que descobrir quais opções de Kernel usar em cada uma delas.</p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.destaquenet.com/2010/08/02/crie-seu-proprio-pendrive-usb-multi-boot-salvador-da-patria/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Create your own save-your-ass multi-boot USB stick</title>
		<link>http://weblog.destaquenet.com/2010/08/02/create-your-own-save-your-ass-multi-boot-usb-stick/</link>
		<comments>http://weblog.destaquenet.com/2010/08/02/create-your-own-save-your-ass-multi-boot-usb-stick/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 11:15:46 +0000</pubDate>
		<dc:creator>Daniel Martins</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[boot]]></category>
		<category><![CDATA[clonezilla]]></category>
		<category><![CDATA[drive]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[gparted]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[memtest]]></category>
		<category><![CDATA[mint]]></category>
		<category><![CDATA[multi-boot]]></category>
		<category><![CDATA[rescue]]></category>
		<category><![CDATA[stick]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://weblog.destaquenet.com/?p=1043</guid>
		<description><![CDATA[I don&#8217;t have to convince you that carry around a couple of Linux distros can mean the difference between life and death. Well, of course I&#8217;m being a little bit melodramatic here, but it&#8217;s really nice to have the ability &#8230; <a href="http://weblog.destaquenet.com/2010/08/02/create-your-own-save-your-ass-multi-boot-usb-stick/">Continue lendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t have to convince you that carry around a couple of Linux distros can mean the difference between life and death. Well, of course I&#8217;m being a little bit melodramatic here, but it&#8217;s really nice to have the ability to quickly run a memory test on a machine that insists to misbehave, or even backup important stuff when you are on the go.</p>
<p>For me, some tools and distros are particularly useful:</p>
<ul>
<li><a href="http://clonezilla.org/">Clonezilla</a>. Very nice disk/partition cloning tool. It takes some time for beginners to get used to it, but it&#8217;s worth the effort. This tool saved my life more than once.</li>
<li><a href="http://gparted.sourceforge.net/">GParted</a>. Great tool for disk partitioning.</li>
<li><a href="http://linuxmint.com/">Linux Mint</a>. Very easy to use Ubuntu-based Linux distro. I particularly like the Live-DVD edition, which includes useful software like <a href="http://www.videolan.org/vlc/">VLC</a>, <a href="http://www.openoffice.org/">OpenOffice</a> and <a href="http://java.com/">Java</a>.</li>
<li><a href="http://ubuntu.com/">Ubuntu</a>. One of the most popular Linux distros nowadays.</li>
<li><a href="http://www.memtest.org/">Memtest86+</a>. Memory testing tool bundled in most Linux distros. Indispensable.</li>
</ul>
<p>Now, instead of burning one CD/DVD for each one of these tools, we&#8217;re going to use one multi-boot USB stick.</p>
<p><span id="more-1043"></span></p>
<h3>Preparing the flash drive</h3>
<p>The first step is to install a bootloader on the USB stick, so we can choose which distro/tool to load when booting from it. Lucky for me that my Linux distro of choice, Ubuntu, already comes with Grub2 pre-installed. This particular version of <a href="http://www.gnu.org/software/grub/">Grub</a> is required since it allows us to mount and boot .ISO images.</p>
<p>Once you have Grub2 installed, plug in your USB stick and make sure that its main partition is bootable and is formated with FAT32 (<code>vfat</code>).</p>
<p>Then, run this command to install Grub2 on the stick:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> grub-install <span style="color: #660033;">--no-floppy</span> <span style="color: #660033;">--root-directory</span>=<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>USB_STICK <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdX</pre></div></div>

<p>Remember to make <code>root-directory</code> point to the path where the flash drive is mounted, and change <code>/dev/sdX</code> to the actual device. Please double-check the parameters to avoid messing with the wrong disk!</p>
<h3>Configuring Grub2</h3>
<p>It&#8217;s time to download the .ISO images for one or more of the aforementioned distros and put them all inside the directory <code>/boot/iso/</code> inside flash drive. Then, create the file <code>/boot/grub/grub.cfg</code> with the following content:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">menuentry <span style="color: #ff0000;">&quot;Linux Mint 9 x86&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">isofile</span>=<span style="color: #ff0000;">&quot;/boot/iso/linuxmint-9-gnome-dvd-i386.iso&quot;</span>
  loopback loop <span style="color: #007800;">$isofile</span>
  linux <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>casper<span style="color: #000000; font-weight: bold;">/</span>vmlinuz <span style="color: #007800;">boot</span>=casper iso-scan<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">filename</span>=<span style="color: #007800;">$isofile</span> noeject noprompt <span style="color: #660033;">--</span>
  initrd <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>casper<span style="color: #000000; font-weight: bold;">/</span>initrd.lz
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
menuentry <span style="color: #ff0000;">&quot;Ubuntu 10.04 Desktop x86&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">isofile</span>=<span style="color: #ff0000;">&quot;/boot/iso/ubuntu-10.04-desktop-i386.iso&quot;</span>
  loopback loop <span style="color: #007800;">$isofile</span>
  linux <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>casper<span style="color: #000000; font-weight: bold;">/</span>vmlinuz <span style="color: #007800;">boot</span>=casper iso-scan<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">filename</span>=<span style="color: #007800;">$isofile</span> noeject noprompt <span style="color: #660033;">--</span>
  initrd <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>casper<span style="color: #000000; font-weight: bold;">/</span>initrd.lz
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
menuentry <span style="color: #ff0000;">&quot;Clonezilla Live 1.2.5-17 x86&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">isofile</span>=<span style="color: #ff0000;">&quot;/boot/iso/clonezilla-live-1.2.5-17-i686.iso&quot;</span>
  loopback loop <span style="color: #007800;">$isofile</span> 
  linux <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>live<span style="color: #000000; font-weight: bold;">/</span>vmlinuz <span style="color: #007800;">boot</span>=live <span style="color: #007800;">union</span>=aufs nolocales noprompt <span style="color: #007800;">ip</span>=frommedia <span style="color: #007800;">toram</span>=filesystem.squashfs <span style="color: #007800;">findiso</span>=<span style="color: #007800;">$isofile</span> 
  initrd <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>live<span style="color: #000000; font-weight: bold;">/</span>initrd.img
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
menuentry <span style="color: #ff0000;">&quot;GParted Live 0.5.2-9 x86&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">isofile</span>=<span style="color: #ff0000;">&quot;/boot/iso/gparted-live-0.5.2-9.iso&quot;</span>
  loopback loop <span style="color: #007800;">$isofile</span> 
  linux <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>live<span style="color: #000000; font-weight: bold;">/</span>vmlinuz <span style="color: #007800;">boot</span>=live <span style="color: #007800;">union</span>=aufs nolocales noprompt <span style="color: #007800;">ip</span>=frommedia <span style="color: #007800;">toram</span>=filesystem.squashfs <span style="color: #007800;">findiso</span>=<span style="color: #007800;">$isofile</span> 
  initrd <span style="color: #7a0874; font-weight: bold;">&#40;</span>loop<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>live<span style="color: #000000; font-weight: bold;">/</span>initrd.img
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
menuentry <span style="color: #ff0000;">&quot;Memory test (memtest86+)&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  linux16 <span style="color: #000000; font-weight: bold;">/</span>boot<span style="color: #000000; font-weight: bold;">/</span>iso<span style="color: #000000; font-weight: bold;">/</span>memtest86+.bin
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Don&#8217;t forget to change each <code>isofile</code> variable to match the downloaded images.</p>
<h3>Caveat</h3>
<p>This stuff is new, and there are only a few distros that can be booted that way. If you want to try this with other distros than the ones listed here, you&#8217;d probably need to Google for the right Kernel options to use.</p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.destaquenet.com/2010/08/02/create-your-own-save-your-ass-multi-boot-usb-stick/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Servidor De Email Local No Ubuntu Com Exim</title>
		<link>http://weblog.destaquenet.com/2010/06/25/servidor-de-email-local-no-ubuntu-com-exim/</link>
		<comments>http://weblog.destaquenet.com/2010/06/25/servidor-de-email-local-no-ubuntu-com-exim/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 11:10:07 +0000</pubDate>
		<dc:creator>Daniel Martins</dc:creator>
				<category><![CDATA[Português]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[ambiente]]></category>
		<category><![CDATA[configuração]]></category>
		<category><![CDATA[desenvolvimento]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[exim]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sendmail]]></category>
		<category><![CDATA[servidor]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[telnet]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://weblog.destaquenet.com/?p=981</guid>
		<description><![CDATA[Vimos em um post anterior como criar testes para código Java que envia e-mails. Agora o assunto é outro. Exim é um MTA open source que pode ser usado como alternativa ao Sendmail em sistemas operacionais Unix. Eu não tenho &#8230; <a href="http://weblog.destaquenet.com/2010/06/25/servidor-de-email-local-no-ubuntu-com-exim/">Continue lendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Vimos em um post anterior como criar testes para <a href="http://weblog.destaquenet.com/2008/09/20/2-boas-formas-de-testar-clientes-javamail/">código Java que envia e-mails</a>. Agora o assunto é outro.</p>
<p><a href="http://www.exim.org/">Exim</a> é um <acronym title="Mail Transfer Agent">MTA</acronym> open source que pode ser usado como alternativa ao <a href="http://www.sendmail.org/">Sendmail</a> em sistemas operacionais Unix. Eu não tenho idéia de qual é a melhor alternativa disponível, mas se você procura por um servidor de relay para instalar na sua configuração de desenvolvimento, Exim é provavelmente a opção mais simples para começar.</p>
<p>Neste artigo, veremos como configurar o Exim para enviar mensagens através do <a href="http://gmail.com/">Gmail</a>.</p>
<p><span id="more-981"></span></p>
<h3>Instalando o Exim</h3>
<p>Primeiro precisamos instalar o Exim e suas dependências, o que é algo bastante trivial em distribuições Linux modernas como <a href="http://www.ubuntu.com/">Ubuntu</a>/<a href="http://www.debian.org/">Debian</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> exim4</pre></div></div>

<h3>Usando Exim como servidor de relay</h3>
<p>Existe um assistente que nos ajuda a fazer as configurações básicas; rode o comando abaixo para abrí-lo e preencha cada tela como segue:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> dpkg-reconfigure exim4-config</pre></div></div>

<ol>
<li><strong>General type of mail configuration:</strong> mail sent by smarthost; received via SMTP or fetchmail</li>
<li><strong>System mail name:</strong> seudominio.com</li>
<li><strong>IP-addresses to listen on for incoming connections:</strong> 127.0.0.1 ; ::1</li>
<li><strong>Other destinations for which mail is accepted:</strong> Deixe em branco</li>
<li><strong>Machines to relay mail for:</strong> Deixe em branco</li>
<li><strong>Host name for the outgoing smarthost:</strong> smtp.gmail.com:587</li>
<li><strong>Hide local mail name in outgoing mail:</strong> Yes</strong></li>
<li><strong>Visible domain name for local users:</strong> seudominio.com</li>
<li><strong>Keep number of DNS-queries minimal:</strong> No</li>
<li><strong>Delivery method for local mail:</strong> mbox format in /var/mail/</li>
<li><strong>Split configuration into small files:</strong> Yes</li>
<li><strong>Root and postmaster mail recipient:</strong> Deixe em branco</li>
</ol>
<p>Agora precisamos configurar as credenciais do usuário no arquivo <code>/etc/exim4/passwd.client</code> adicionando a seguinte linha:</p>
<pre>
# Troque [username] e [password] pelos dados corretos
*.google.com:[username]:[password]
</pre>
<p>Agora basta rodar o comando abaixo para terminar as configurações:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> update-exim4.conf</pre></div></div>

<h3>Testando o servidor</h3>
<p>Um jeito simples &#8212; e nerd &#8212; de testar se as configurações estão corretas é usar o comando <code>telnet</code>:</p>
<pre>
$ telnet localhost 25
    Trying ::1...
    Connected to localhost.
    Escape character is '^]'.
    220 localhost ESMTP Exim 4.71 Wed, 23 Jun 2010 22:28:56 -0300
HELO localhost
    250 localhost Hello localhost [::1]
MAIL FROM: usuario@seudominio.com
    250 OK
RCPT TO: destino@email.com
    250 Accepted
DATA
    354 Enter message, ending with "." on a line by itself
SUBJECT: Assunto da mensagem
Testando Exim via Telnet. Massa!
.
    250 OK id=1ORbG5-0005uh-EF
QUIT
    221 localhost closing connection
    Connection closed by foreign host.
</pre>
<p>Abra os arquivos de log em <code>/var/log/exim4</code> para ver se a mensagem foi transmitida sem erros. Uma tentativa bem sucedida se parece com o seguinte:</p>
<pre>
2010-06-23 22:29:47 1ORbG5-0005uh-EF <= local@seudominio.com H=localhost [::1] P=smtp S=345
2010-06-23 22:29:50 1ORbG5-0005uh-EF => destino@email.com R=smarthost T=remote_smtp_smarthost H=gmail-smtp-msa.l.google.com [74.125.45.109] ..."
2010-06-23 22:29:50 1ORbG5-0005uh-EF Completed
</pre>
<p>Caso você não receba a mensagem e os logs não acusem nenhum erro, verifique se a mensagem não foi parar na caixa de spam antes que você mude quaisquer configurações.</p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.destaquenet.com/2010/06/25/servidor-de-email-local-no-ubuntu-com-exim/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting Up A Local Mail Server With Exim And Ubuntu</title>
		<link>http://weblog.destaquenet.com/2010/06/25/setting-up-a-local-mail-server-with-exim-and-ubuntu/</link>
		<comments>http://weblog.destaquenet.com/2010/06/25/setting-up-a-local-mail-server-with-exim-and-ubuntu/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 11:00:08 +0000</pubDate>
		<dc:creator>Daniel Martins</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[exim]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[sendmail]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[telnet]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://weblog.destaquenet.com/?p=936</guid>
		<description><![CDATA[Exim is an open source MTA that can be used as a drop-in replacement for Sendmail on Unix-like operating systems. I have no idea what&#8217;s the best mail server out there, but if you are looking for a relay-only server &#8230; <a href="http://weblog.destaquenet.com/2010/06/25/setting-up-a-local-mail-server-with-exim-and-ubuntu/">Continue lendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.exim.org/">Exim</a> is an open source <acronym title="Mail Transfer Agent">MTA</acronym> that can be used as a drop-in replacement for <a href="http://www.sendmail.org/">Sendmail</a> on Unix-like operating systems. I have no idea what&#8217;s the best mail server out there, but if you are looking for a relay-only server to install on your development setup, Exim is probably the easiest to get started with.</p>
<p>In this article I&#8217;ll show you how to configure Exim to send messages through <a href="http://gmail.com/">Gmail</a>.</p>
<p><span id="more-936"></span></p>
<h3>Installing Exim</h3>
<p>First we need to install Exim and its dependencies, which is a simple task in modern Linux distros like <a href="http://www.ubuntu.com/">Ubuntu</a>/<a href="http://www.debian.org/">Debian</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> exim4</pre></div></div>

<h3>Configuring Exim as a relay server</h3>
<p>There&#8217;s a wizard that helps us with the basic setup; run the following command line to open it and fill each screen as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> dpkg-reconfigure exim4-config</pre></div></div>

<ol>
<li><strong>General type of mail configuration:</strong> mail sent by smarthost; received via SMTP or fetchmail</li>
<li><strong>System mail name:</strong> yourdomain.com</li>
<li><strong>IP-addresses to listen on for incoming connections:</strong> 127.0.0.1 ; ::1</li>
<li><strong>Other destinations for which mail is accepted:</strong> Leave it blank</li>
<li><strong>Machines to relay mail for:</strong> Leave it blank</li>
<li><strong>Host name for the outgoing smarthost:</strong> smtp.gmail.com:587</li>
<li><strong>Hide local mail name in outgoing mail:</strong> Yes</strong></li>
<li><strong>Visible domain name for local users:</strong> yourdomain.com</li>
<li><strong>Keep number of DNS-queries minimal:</strong> No</li>
<li><strong>Delivery method for local mail:</strong> mbox format in /var/mail/</li>
<li><strong>Split configuration into small files:</strong> Yes</li>
<li><strong>Root and postmaster mail recipient:</strong> Leave it blank</li>
</ol>
<p>Now we have to configure the user credentials in the file <code>/etc/exim4/passwd.client</code> by adding the following line:</p>
<pre>
# Replace [username] and [password] by your account's credentials
*.google.com:[username]:[password]
</pre>
<p>Let&#8217;s finish the configuration by running the following command line:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> update-exim4.conf</pre></div></div>

<h3>Testing the setup</h3>
<p>Here&#8217;s an old-s<strong>c</strong>h<strong>ool</strong> way to test if our setup is working &#8212; with <code>telnet</code> command:</p>
<pre>
$ telnet localhost 25
    Trying ::1...
    Connected to localhost.
    Escape character is '^]'.
    220 localhost ESMTP Exim 4.71 Wed, 23 Jun 2010 22:28:56 -0300
HELO localhost
    250 localhost Hello localhost [::1]
MAIL FROM: username@yourdomain.com
    250 OK
RCPT TO: destination@email.com
    250 Accepted
DATA
    354 Enter message, ending with "." on a line by itself
SUBJECT: Message subject
Testing Exim via telnet. w00t!
.
    250 OK id=1ORbG5-0005uh-EF
QUIT
    221 localhost closing connection
    Connection closed by foreign host.
</pre>
<p>Open the log files at <code>/var/log/exim4</code> to see if the message relayed correctly. This is how a successful attempt looks like:</p>
<pre>
2010-06-23 22:29:47 1ORbG5-0005uh-EF <= local@yourdomain.com H=localhost [::1] P=smtp S=345
2010-06-23 22:29:50 1ORbG5-0005uh-EF => destination@email.com R=smarthost T=remote_smtp_smarthost H=gmail-smtp-msa.l.google.com [74.125.45.109] ..."
2010-06-23 22:29:50 1ORbG5-0005uh-EF Completed
</pre>
<p>If the log looks good and you didn&#8217;t get the message, it&#8217;s a good idea to check the spam box of the destination email before you change any configuration.</p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.destaquenet.com/2010/06/25/setting-up-a-local-mail-server-with-exim-and-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fabric + VirtualEnv: uma combinação explosiva (no bom sentido)</title>
		<link>http://weblog.destaquenet.com/2009/07/01/fabric-virtualenv-uma-combinacao-explosiva-no-bom-sentido/</link>
		<comments>http://weblog.destaquenet.com/2009/07/01/fabric-virtualenv-uma-combinacao-explosiva-no-bom-sentido/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 04:20:01 +0000</pubDate>
		<dc:creator>Daniel Martins</dc:creator>
				<category><![CDATA[Português]]></category>
		<category><![CDATA[Programação]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[automatização]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[django-flash]]></category>
		<category><![CDATA[fabric]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pypi]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[setuptools]]></category>
		<category><![CDATA[teste]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[virtualenv]]></category>

		<guid isPermaLink="false">http://weblog.destaquenet.com/?p=554</guid>
		<description><![CDATA[Escreveu uma super-hiper-biblioteca ou aplicação em Python mas quer se certificar de que ela funciona em diferentes versões do interpretador? Embora isso possa ser resolvido através da execução manual dos testes com os vários interpretadores, isso é chato e improdutivo. &#8230; <a href="http://weblog.destaquenet.com/2009/07/01/fabric-virtualenv-uma-combinacao-explosiva-no-bom-sentido/">Continue lendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Escreveu uma super-hiper-biblioteca ou aplicação em <a href="http://python.org">Python</a> mas quer se certificar de que ela funciona em diferentes versões do interpretador? Embora isso possa ser resolvido através da execução <em>manual</em> dos testes com os vários interpretadores, isso é chato e improdutivo. Além do mais, cada versão do Python pode ter diferentes bibliotecas instaladas, o que pode acabar influenciando no resultado dos testes.</p>
<p>Temos portanto dois problemas a serem resolvidos. O primeiro problema, relacionado a automatização de tarefas repetitivas, pode ser facilmente solucionado com <a href="http://docs.fabfile.org/">Fabric</a>, uma ferramenta muito útil para criação de scripts de build e deployment de aplicações. Já escrevemos <a href="http://weblog.destaquenet.com/2008/10/05/deployment-de-aplicacoes-python-com-fabric/">um texto introdutório</a> sobre a mesma, não deixe de conferir.</p>
<p>O segundo problema, entretanto, é um pouco mais complicado de se resolver, mas não é nenhum bicho de sete cabeças. Com <a href="http://pypi.python.org/pypi/virtualenv/">VirtualEnv</a>, é possível criar ambientes Python isolados com o objetivo de testar e executar aplicações em uma espécie de sandbox onde temos total controle sobre as bibliotecas ali instaladas.</p>
<p><span id="more-554"></span></p>
<h3>Instalando as diferentes versões do Python</h3>
<p>O primeiro passo é instalar as versões do Python a serem usadas nos testes. Rode o comando abaixo para instalar os diferentes interpretadores, supondo que você utilize <a href="http://www.debian.org/">Debian</a> e sua aplicação precise funcionar nas versões 2.4, 2.5 e 2.6 do Python:</p>
<pre>$ sudo apt-get install python2.4 python2.4-dev \
    python2.5 python2.5-dev \
    python2.6 python2.6-dev</pre>
<p>A versão atual do Ubuntu já inclui o Python 2.6 por padrão. Veja também que aproveitamos para instalar os arquivos de desenvolvimento para cada versão, pois eventualmente precisamos deles para compilar bibliotecas com extensões escritas em C.</p>
<h3>Instalando Fabric e VirtualEnv</h3>
<p>Da mesma forma:</p>
<pre>$ sudo apt-get install python-setuptools</pre>
<p>Após a instalação do <a href="http://pypi.python.org/pypi/setuptools/">SetupTools</a>, execute o seguinte comando para instalar o Fabric e o VirtualEnv:</p>
<pre>$ sudo easy_install Fabric virtualenv</pre>
<h3>Configurando ambientes isolados para sua aplicação</h3>
<p>O próximo passo é criar ambientes de execução isolados para sua aplicação, sendo que cada ambiente deve usar uma versão diferente do interpretador do Python. Para fazer isso, execute os comandos abaixo, substituindo o <code>APP</code> pelo nome da sua aplicação ou biblioteca:</p>
<pre>$ mkdir ~/.virtualenvs
$ cd ~/.virtualenvs
$ virtualenv --python=/usr/bin/python2.6 --no-site-packages APP-py2.6
$ virtualenv --python=/usr/bin/python2.5 --no-site-packages APP-py2.5
$ virtualenv --python=/usr/bin/python2.4 --no-site-packages APP-py2.4</pre>
<p>Primeiramente criamos o diretório <code>~/.virtualenvs</code>, que é por convenção o diretório padrão para armazenamento dos ambientes. Em seguida, criamos três ambientes para nossa aplicação <code>APP</code>. A flag <code>--no-site-packages</code> é <em>opcional</em> e indica que as bibliotecas instaladas no diretório <code>site-packages</code> do Python em questão não devem ser visíveis ao ambiente sendo criado.</p>
<p>Finalmente, não esqueça de instalar, em cada um dos ambientes, as dependências exigidas pela sua aplicação:</p>
<pre>$ source ~/.virtualenvs/APP-py2.6/bin/activate
(APP-py2.6) $ easy_install biblioteca1 biblioteca2 ... bibliotecaN
(APP-py2.6) $ source ~/.virtualenvs/APP-py2.5/bin/activate
(APP-py2.5) $ easy_install biblioteca1 biblioteca2 ... bibliotecaN
(APP-py2.5) $ source ~/.virtualenvs/APP-py2.4/bin/activate
(APP-py2.4) $ easy_install biblioteca1 biblioteca2 ... bibliotecaN</pre>
<p>Supondo que sua aplicação utilize o SetupTools para a configuração dos metadados do projeto (através do script <code>setup.py</code>), os comandos abaixo devem indicar se a aplicação funciona nos ambientes que criamos:</p>
<pre>$ source ~/.virtualenvs/APP-py2.6/bin/activate
(APP-py2.6) $ python setup.py test
...
(APP-py2.6) $ source ~/.virtualenvs/APP-py2.5/bin/activate
(APP-py2.5) $ python setup.py test
...
(APP-py2.5) $ source ~/.virtualenvs/APP-py2.4/bin/activate
(APP-py2.4) $ python setup.py test
...</pre>
<h3>Automatizando!</h3>
<p>Se tudo funcionou até aqui, estamos prontos para criar um script que nos permita rodar os testes de forma automática, nos diferentes ambientes.</p>
<p>Supondo que sua aplicação utilize o SetupTools para a configuração dos metadados do projeto, o exemplo abaixo resolve o problema:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># -*- coding: utf-8 -*-</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Environment info</span>
config.<span style="color: black;">project</span> = <span style="color: #483d8b;">'APP'</span>
config.<span style="color: black;">virtualenv_dir</span> = <span style="color: #483d8b;">'~/.virtualenvs'</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Supported Python versions</span>
config.<span style="color: black;">versions</span> = <span style="color: black;">&#40;</span><span style="color: #483d8b;">'2.4'</span>, <span style="color: #483d8b;">'2.5'</span>, <span style="color: #483d8b;">'2.6'</span>,<span style="color: black;">&#41;</span>
config.<span style="color: black;">default_version</span> = <span style="color: #483d8b;">'2.6'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> setup<span style="color: black;">&#40;</span>command, version=config.<span style="color: black;">default_version</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;Executes the given setup command with a virtual Python installation.
    &quot;&quot;&quot;</span>
    local<span style="color: black;">&#40;</span><span style="color: #483d8b;">'%s/%s-py%s/bin/python setup.py %s'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>config.<span style="color: black;">virtualenv_dir</span>, config.<span style="color: black;">project</span>, version, command<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #dc143c;">test</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;Runs all tests in different Python versions.
    &quot;&quot;&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> version <span style="color: #ff7700;font-weight:bold;">in</span> config.<span style="color: black;">versions</span>:
        setup<span style="color: black;">&#40;</span><span style="color: #483d8b;">'test'</span>, version<span style="color: black;">&#41;</span></pre></div></div>

<p>Agora é só alegria:</p>
<pre>$ fab test
Fabric v. 0.1.1.
Running test...
[localhost] run: ~/.virtualenvs/APP-py2.4/bin/python setup.py test
...
[localhost] run: ~/.virtualenvs/APP-py2.5/bin/python setup.py test
...
[localhost] run: ~/.virtualenvs/APP-py2.6/bin/python setup.py test
...</pre>
<p>Devo lembrar que o script mostrado é só um exemplo. Você pode (e <strong>deve</strong>) modificá-lo para que este atenda às suas necessidades.</p>
<h3>(Bônus!) Distribuindo sua aplicação para diferentes versões do Python</h3>
<p>Com mais algumas linhas de código, podemos criar tasks que nos permitam gerar arquivos para distribuição da aplicação para diferentes versões do Python:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> dist_src<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;Create source archive.
    &quot;&quot;&quot;</span>
    setup<span style="color: black;">&#40;</span><span style="color: #483d8b;">'sdist'</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> dist_eggs<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;Create binary archives, one for each Python version.
    &quot;&quot;&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> version <span style="color: #ff7700;font-weight:bold;">in</span> config.<span style="color: black;">versions</span>:
        setup<span style="color: black;">&#40;</span><span style="color: #483d8b;">'bdist_egg'</span>, version<span style="color: black;">&#41;</span></pre></div></div>

<h3>(Bônus!) Automatizando geração de documentação e upload para o PyPI</h3>
<p>Ainda acha pouco? <a href="http://github.com/danielfm/django-flash/blob/master/fabfile.py">Este outro exemplo</a> de script vai além e mostra, numa aplicação real, como automatizar o registro e upload dos pacotes para o <a href="http://pypi.python.org/pypi/">PyPI</a>, atualizar site de documentação, entre outras coisas.</p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.destaquenet.com/2009/07/01/fabric-virtualenv-uma-combinacao-explosiva-no-bom-sentido/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VPN PPTP no Ubuntu Intrepid</title>
		<link>http://weblog.destaquenet.com/2008/12/02/vpn-pptp-no-ubuntu-intrepid/</link>
		<comments>http://weblog.destaquenet.com/2008/12/02/vpn-pptp-no-ubuntu-intrepid/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 02:51:35 +0000</pubDate>
		<dc:creator>Daniel Martins</dc:creator>
				<category><![CDATA[Português]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[conectividade]]></category>
		<category><![CDATA[configuração]]></category>
		<category><![CDATA[dicas]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network manager]]></category>
		<category><![CDATA[pptp]]></category>
		<category><![CDATA[rede]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://weblog.destaquenet.com/?p=304</guid>
		<description><![CDATA[Um dia após o lançamento do Intrepid (versão 8.10) do Ubuntu Linux, eu já tinha feito o download e a instalação na minha máquina de trabalho, um notebook Dell. Vou poupar elogios, até porque eu utilizo o Ubuntu diariamente desde &#8230; <a href="http://weblog.destaquenet.com/2008/12/02/vpn-pptp-no-ubuntu-intrepid/">Continue lendo <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Um dia após o lançamento do Intrepid (versão 8.10) do <a href="http://www.ubuntu.com/">Ubuntu Linux</a>, eu já tinha feito o <em>download</em> e a instalação na minha máquina de trabalho, um notebook Dell. Vou poupar elogios, até porque eu utilizo o Ubuntu diariamente desde o lançamento da release Dapper Drake (versão 6.06), de Julho de 2006. De lá para cá, muito trabalho vem sendo feito para tornar o Ubuntu o sistema ideal para uso em desktops e laptops.</p>
<p>Um dos aspectos que se encontram em constante evolução é a parte de conectividade. O <a href="http://projects.gnome.org/NetworkManager/">Network Manager</a>, gerenciador de conexões utilizado nas versões mais recentes do Ubuntu, torna simples a tarefa de se conectar com praticamente qualquer tipo de rede, inclusive com as recém chegadas redes 3G.</p>
<p>Apesar de facilitar a vida na maioria dos casos, o Network Manager presente na última versão do Ubuntu parece não funcionar do jeito que deveria, principalmente quando tentamos conectar numa VPN PPTP (Point-to-Point Tunneling Protocol). Na versão anterior do Ubuntu, eu conseguia conectar em VPNs PPTP sem problemas, coisa que deixou de acontecer após a instalação da última versão do Ubuntu.</p>
<p>A boa notícia é que, depois de perder algumas horas pesquisando, eu consegui resolver o meu problema. E é isso que mostrarei a seguir! <span id="more-304"></span></p>
<h3>Atualizando o Network Manager</h3>
<p>A primeira coisa que fiz foi tentar substituir a versão pré-instalada do Network Manager pela <a href="http://launchpad.net/network-manager">versão distribuída</a> pelos próprios desenvolvedores.</p>
<p>Para isso, abra o Synaptic e selecione o menu <em>Settings &#8211; Repositories</em>. Em seguida, selecione a aba <em>Third-Party Software</em> e clique no botão <em>Add</em>. Finalmente, cole a linha abaixo e confirme:</p>
<pre>deb http://ppa.launchpad.net/network-manager/ubuntu intrepid main</pre>
<p>Feche a tela e pressione CTRL+R para baixar as informações atualizadas dos repositórios. Após o término, pressione CTRL+G para iniciar o processo de atualização dos pacotes. Quando a instalação terminar, o Ubuntu irá pedir que você faça o reboot. Obedeça. <img src='http://weblog.destaquenet.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Configurando a VPN</h3>
<p>Após o reboot, o sistema já deve estar funcionando com a nova versão do Network Manager. Clique no Applet do Network Manager e selecione o menu <em>VPN Connections &#8211; Configure VPN</em>. Aqui, basta configurar de acordo com as instruções que você deve ter recebido do pessoal responsável pela parte de redes da sua empresa.</p>
<p>Para não terminar o post aqui, eu vou mostrar como eu fiz para configurar a conexão VPN que estou utilizando atualmente. É obvio que cada empresa configura sua VPN de um jeito diferente, por isso o que segue abaixo é apenas um exemplo de configuração.</p>
<h4>Informações básicas</h4>
<p>Na primeira tela você deve informar os dados para conexão com a VPN, como IP do servidor da VPN, usuário e senha:</p>
<div id="attachment_308" class="wp-caption aligncenter" style="width: 230px"><a href="http://weblog.destaquenet.com/wp-content/uploads/2008/12/vpn01.png"><img class="size-medium wp-image-308" title="Informações básicas da VPN" src="http://weblog.destaquenet.com/wp-content/uploads/2008/12/vpn01-220x300.png" alt="Informações básicas" width="220" height="300" /></a><p class="wp-caption-text">Informações básicas</p></div>
<p>Clique no botão <em>Advanced</em> para configurar em detalhes como deverá ser a comunicação entre seu computador e a VPN:</p>
<div id="attachment_309" class="wp-caption aligncenter" style="width: 239px"><a href="http://weblog.destaquenet.com/wp-content/uploads/2008/12/vpn02.png"><img class="size-medium wp-image-309" title="Opções avançadas" src="http://weblog.destaquenet.com/wp-content/uploads/2008/12/vpn02-229x300.png" alt="Opções avançadas" width="229" height="300" /></a><p class="wp-caption-text">Opções avançadas</p></div>
<p>No meu caso, o servidor da VPN foi configurado para fazer autenticação via CHAP; marque ou desmarque as opções disponíveis na tela, se necessário.</p>
<h4>Configurando as rotas</h4>
<p>Prosseguindo, na aba <em>IPv4 Settings</em> você poderá configurar o seu IP na VPN. No meu caso, o IP local, juntamente com o servidor DNS e Gateway, são fornecidos automaticamente pelo servidor. Por isso eu optei por manter a opção <em>Automatic (VPN)</em> no campo <em>Method</em>.</p>
<p>Neste ponto você já deve ter a VPN funcionando, mas com um pequeno inconveniente: pelo menos aqui, a VPN passou a ser acessível através da rota padrão (IP 0.0.0.0). Isso significa que <strong>todo</strong> o tráfego é direcionado para a VPN!</p>
<p>Para solucionar esta questão, é preciso configurar uma rota através da qual a VPN possa ser acessada, mantendo inalterada a rota padrão. Para isso, basta clicar no botão <em>Routes&#8230;</em> e configurar a(s) rota(s):</p>
<div id="attachment_316" class="wp-caption aligncenter" style="width: 310px"><a href="http://weblog.destaquenet.com/wp-content/uploads/2008/12/vpn03.png"><img class="size-medium wp-image-316" title="Declarando rotas" src="http://weblog.destaquenet.com/wp-content/uploads/2008/12/vpn03-300x166.png" alt="Declarando rotas" width="300" height="166" /></a><p class="wp-caption-text">Declarando rotas</p></div>
<p>Aqui, eu substituí as rotas obtidas automaticamente pelas rotas informadas na tabela. No meu caso, a faixa de IP da VPN é 192.168.0.X, por isso o <em>Prefix</em> foi configurado como 24 (<a href="http://linux-ip.net/html/routing-intro.html">aprenda aqui</a> o que esse número significa). O campo <em>Gateway</em> foi configurado para o &#8220;IP remoto virtual&#8221; da VPN, fazendo com que os pacotes destinados a IPs 192.168.0.X sejam redirecionados para a VPN. O campo <em>Metric</em> foi <a href="http://linux.about.com/od/lna_guide/a/gdelna23t04.htm">deixado como zero</a>.</p>
<h3>Feito!</h3>
<p>Isso deve bastar. Tente conectar com a VPN:</p>
<div id="attachment_313" class="wp-caption aligncenter" style="width: 310px"><a href="http://weblog.destaquenet.com/wp-content/uploads/2008/12/vpn04.png"><img class="size-medium wp-image-313" title="Conectando na VPN" src="http://weblog.destaquenet.com/wp-content/uploads/2008/12/vpn04-300x150.png" alt="Conectando na VPN" width="300" height="150" /></a><p class="wp-caption-text">Conectando na VPN</p></div>
<p>Não conectou? Confira os dados de conexão e modifique os parâmetros avançados de conexão (métodos de autentiação, encriptação, etc). Tente encontrar o motivo nos logs <code>/var/log/messages</code> e <code>/var/log/syslog</code>. Conectou? Ótimo, agora faça o seguinte teste:</p>
<ol>
<li>Dispare um ping contra algum computador da VPN;</li>
<li>Dispare um ping contra algum computador da sua rede local;</li>
<li>Dispare um ping contra algum computador da Internet (ex: google.com);</li>
</ol>
<p>O teste falhou? Com certeza tem algo errado com a(s) sua(s) rota(s). Ainda conectado na VPN, utilize os comandos <code>ip route</code> e/ou <code>route -n</code> para ver como ficaram as rotas; faça os ajustes necessários, reze e tente novamente. O teste foi um sucesso? Parabéns, você conseguiu! <img src='http://weblog.destaquenet.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Update</strong>: Aos usuários do Fedora 10, o procedimento de configuração é praticamente o mesmo. O que muda é a configuração das rotas:</p>
<p style="text-align: center;">
<div id="attachment_343" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-343" title="rotas_fedora10" src="http://weblog.destaquenet.com/wp-content/uploads/2008/12/rotas_fedora10-300x182.png" alt="Declarando as rotas (Fedora 10)" width="300" height="182" /><p class="wp-caption-text">Declarando rotas (Fedora 10)</p></div>
]]></content:encoded>
			<wfw:commentRss>http://weblog.destaquenet.com/2008/12/02/vpn-pptp-no-ubuntu-intrepid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

