<?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>Ivan Villareal</title>
	<atom:link href="http://blog.ivanvillareal.info/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ivanvillareal.info</link>
	<description>IT stuff and more...</description>
	<lastBuildDate>Fri, 13 Aug 2010 23:05:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Apache virtual host script in perl</title>
		<link>http://blog.ivanvillareal.info/linux/apache-virtual-host-script-in-perl/</link>
		<comments>http://blog.ivanvillareal.info/linux/apache-virtual-host-script-in-perl/#comments</comments>
		<pubDate>Thu, 27 May 2010 23:57:26 +0000</pubDate>
		<dc:creator>Ivan Villareal</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[configuration]]></category>

		<guid isPermaLink="false">http://blog.ivanvillareal.info/?p=250</guid>
		<description><![CDATA[This is a very short post about a little script I did to create remove virtual hosts easily.
I&#8217;ve found a couple of scripts (http://patrickgibson.com/utilities/virtualhost/, http://www.tamdenholm.com/portfolio/apache)&#160; to do this but they didn&#8217;t worked right, I&#8217;m using Ubuntu Karmic, maybe thats why. However instead of fixing those scripts I went to my vim editor and started typing [...]]]></description>
			<content:encoded><![CDATA[<p>This is a very short post about a little script I did to create remove virtual hosts easily.</p>
<p>I&#8217;ve found a couple of scripts (http://patrickgibson.com/utilities/virtualhost/, http://www.tamdenholm.com/portfolio/apache)&nbsp; to do this but they didn&#8217;t worked right, I&#8217;m using Ubuntu Karmic, maybe thats why. However instead of fixing those scripts I went to my vim editor and started typing this, I&#8217;ve spent about 2 hours writing this while I was watching a crappy tv program, but in the end it worked, it surely contains some bugs, or it is unsafe to run it, I just wanted to share this.</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Perl"><div class="devcodeoverflow"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl -w</span>
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> File<span style="color: #339933;">::</span><span style="color: #006600;">Path</span> <span style="color: #000066;">qw</span><span style="color: #009900;">&#40;</span>mkpath rmtree<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> Getopt<span style="color: #339933;">::</span><span style="color: #006600;">Long</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #b1b100;">our</span> <span style="color: #0000ff;">$ipAddress</span>        <span style="color: #339933;">=</span> <span style="color: #ff0000;">'127.0.0.1'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">our</span> <span style="color: #0000ff;">$apacheConfigFile</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'apache2.conf'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">our</span> <span style="color: #0000ff;">$apacheConfigDir</span>  <span style="color: #339933;">=</span> <span style="color: #ff0000;">'/etc/apache2'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">our</span> <span style="color: #0000ff;">$sitesAvailable</span>   <span style="color: #339933;">=</span> <span style="color: #ff0000;">'sites-available'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">our</span> <span style="color: #0000ff;">$docRootPrefix</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'/home/ivan/www'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">our</span> <span style="color: #0000ff;">$docRoot</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'public_html'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">our</span> <span style="color: #0000ff;">$logsDir</span>  <span style="color: #339933;">=</span> <span style="color: #ff0000;">'logs'</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$del</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">''</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$add</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">''</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$domain</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">''</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">unless</span> <span style="color: #009900;">&#40;</span>GetOptions <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'del'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">\$del</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'add'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">\$add</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'domain=s'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">\$domain</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">or</span> usage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    usage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#print $paramResults;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$add</span> <span style="color: #339933;">||</span> <span style="color: #0000ff;">$del</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: #0000ff;">$domain</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: #0000ff;">$add</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            createVhost<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$domain</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$del</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            deleteVhost<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$domain</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: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        usage<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: #666666; font-style: italic;">#print 'add aqui';</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    usage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> usage <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">print</span> <span style="color: #339933;">&lt;</span> <span style="color: #339933;">&lt;</span>USAGE
This program will add <span style="color: #b1b100;">or</span> remove
apache virtual hosts on ubuntu karmic 9<span style="color: #339933;">.</span>10
&nbsp;
usage<span style="color: #339933;">:</span> vhost<span style="color: #339933;">-</span>updater<span style="color: #339933;">.</span>pl <span style="color: #009900;">&#91;</span><span style="color: #339933;">--</span>add <span style="color: #339933;">|</span> <span style="color: #339933;">--</span>del<span style="color: #009900;">&#93;</span> <span style="color: #339933;">--</span>domain newhost<span style="color: #339933;">.</span>tld 
USAGE
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> returnVhostPaths
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$vhost</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@dir</span> <span style="color: #339933;">=</span> <span style="color: #000066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\//</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$docRootPrefix</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">%res</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@dir</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$vhost</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$hostDir</span> <span style="color: #339933;">=</span> <span style="color: #000066;">join</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">@dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$res</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'docRoot'</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$hostDir</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$docRoot</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$res</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'logsDir'</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$hostDir</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">$logsDir</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">#todo dir validation</span>
    <span style="color: #0000ff;">@dir</span> <span style="color: #339933;">=</span> <span style="color: #000066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\//</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$apacheConfigDir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@dir</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$sitesAvailable</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@dir</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$vhost</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #0000ff;">$res</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'apacheConfig'</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span> <span style="color: #000066;">join</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">@dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066;">return</span> <span style="color: #0000ff;">%res</span><span style="color: #339933;">;</span>   
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> createVhost <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$vhost</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">#first create the docRoot</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">%vhostInfo</span> <span style="color: #339933;">=</span> returnVhostPaths<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$vhost</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    informOut<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Creating docroot dir: $vhostInfo{'docRoot'}&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    informOut<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Creating log dir: $vhostInfo{'logsDir'}&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    mkpath<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$vhostInfo</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'docRoot'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$vhostInfo</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'logsDir'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
    informOut<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Site File: $vhostInfo{'apacheConfig'}&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$vhostContent</span> <span style="color: #339933;">=</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt; &quot;EOF&quot;;</span>
<span style="color: #cc0000; font-style: italic;">&lt;VirtualHost *:80&gt;</span>
<span style="color: #cc0000; font-style: italic;">&nbsp;   ServerName $vhost</span>
<span style="color: #cc0000; font-style: italic;">&nbsp;   DocumentRoot $vhostInfo{'docRoot'}</span>
<span style="color: #cc0000; font-style: italic;">&nbsp;   &lt;directory $vhostInfo{'docRoot'}&gt;</span>
<span style="color: #cc0000; font-style: italic;">&nbsp;       Options Indexes FollowSymLinks</span>
<span style="color: #cc0000; font-style: italic;">&nbsp;       AllowOverride All</span>
<span style="color: #cc0000; font-style: italic;">&nbsp;       Order allow,deny</span>
<span style="color: #cc0000; font-style: italic;">&nbsp;       Allow from all</span>
<span style="color: #cc0000; font-style: italic;">&nbsp;   &lt;/directory&gt;</span>
<span style="color: #cc0000; font-style: italic;">&nbsp;       ErrorLog $vhostInfo{'logsDir'}/error_log</span>
<span style="color: #cc0000; font-style: italic;">&nbsp;       CustomLog $vhostInfo{'logsDir'}/access_log &quot;%h %l %u %t \\&quot;%r\\&quot; %&gt;s %b \\&quot;%{Referer}i\\&quot; \\&quot;%{User-agent}i\\&quot;&quot;</span>
<span style="color: #cc0000; font-style: italic;">&nbsp;       LogLevel debug</span>
&nbsp;
&nbsp;
<span style="color: #cc0000; font-style: italic;">EOF</span>
    informOut<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Creating Vhost...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">open</span> FILE<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$vhostInfo</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'apacheConfig'</span><span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">or</span> <span style="color: #000066;">die</span> <span style="color: #0000ff;">$!</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">print</span> FILE <span style="color: #0000ff;">$vhostContent</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">close</span> FILE<span style="color: #339933;">;</span>
&nbsp;
    informOut<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Adding host $vhost&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">open</span> FILE<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;&gt;&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'/etc/hosts'</span> <span style="color: #b1b100;">or</span> <span style="color: #000066;">die</span> <span style="color: #0000ff;">$!</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">print</span> FILE <span style="color: #0000ff;">$ipAddress</span> <span style="color: #339933;">.</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">$vhost</span> <span style="color: #339933;">.</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">close</span> FILE<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$output</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`/usr/sbin/a2ensite $vhost`</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">print</span> <span style="color: #0000ff;">$output</span><span style="color: #339933;">;</span>
&nbsp;
    restartApache<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">#print $vhostConten t;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> restartApache
<span style="color: #009900;">&#123;</span>
    informOut<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Restarting apache&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$output</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`/etc/init.d/apache2 restart`</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">print</span> <span style="color: #0000ff;">$output</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> deleteVhost
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$vhost</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span><span style="color: #339933;">;</span>
     <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">%vhostInfo</span> <span style="color: #339933;">=</span> returnVhostPaths<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$vhost</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    informOut<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Removing $vhost from hosts file&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">open</span> IN<span style="color: #339933;">,</span> <span style="color: #ff0000;">'&lt; '</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'/etc/hosts'</span> <span style="color: #b1b100;">or</span> <span style="color: #000066;">die</span> <span style="color: #0000ff;">$!</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@hostsFile</span> <span style="color: #339933;">=</span> <span style="color: #009999;">&lt;IN&gt;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">close</span> IN<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@contents</span> <span style="color: #339933;">=</span> <span style="color: #000066;">grep</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!/^</span>127<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>1<span style="color: #0000ff;">\t</span><span style="color: #0000ff;">$vhost</span><span style="color: #339933;">/,</span> <span style="color: #0000ff;">@hostsFile</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066;">open</span> FILE<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'/etc/hosts'</span> <span style="color: #b1b100;">or</span> <span style="color: #000066;">die</span> <span style="color: #0000ff;">$!</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">print</span> FILE <span style="color: #0000ff;">@contents</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">close</span> FILE<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$output</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`/usr/sbin/a2dissite $vhost`</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">print</span> <span style="color: #0000ff;">$output</span><span style="color: #339933;">;</span>
&nbsp;
    informOut<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Removing  $vhostInfo{'apacheConfig'} file&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">unlink</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$vhostInfo</span><span style="color: #009900;">&#123;</span><span style="color: #ff0000;">'apacheConfig'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    restartApache<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot; manually remove $vhostInfo{'docRoot'}... <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> informOut <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$message</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span><span style="color: #339933;">;</span>
    <span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;$message <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></div></pre><!--END_DEVFMTCODE--></p>
<p>Here is a screenshot of the program running</p>
<p><a href="http://blog.ivanvillareal.info/wp-content/uploads/2010/05/Screenshot.png"><img class="aligncenter size-full wp-image-255" title="vhost creator Screenshot" src="http://blog.ivanvillareal.info/wp-content/uploads/2010/05/Screenshot.png" alt="vhost creator Screenshot" width="1024" height="600" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ivanvillareal.info/linux/apache-virtual-host-script-in-perl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Upgrading php5.1 to php5.3 on CENTOS 4</title>
		<link>http://blog.ivanvillareal.info/linux/upgrading-php5-1-to-php5-3-on-centos-4/</link>
		<comments>http://blog.ivanvillareal.info/linux/upgrading-php5-1-to-php5-3-on-centos-4/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 20:23:34 +0000</pubDate>
		<dc:creator>Ivan Villareal</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[configuration]]></category>

		<guid isPermaLink="false">http://blog.ivanvillareal.info/?p=232</guid>
		<description><![CDATA[I've used the remi repo for quickly upgrade php to 5.3 and mysql to 5.1 on a Centos 4 server]]></description>
			<content:encoded><![CDATA[<p>I needed to update the php version of a centos 4 box, so this is what I did:</p>
<p>I&#8217;ve decided to go for the easy way, using the remi repo, so first I&#8217;ve Downloaded the Extra Packages for Enterprise Linux (<em style="font-weight: bold; font-style: normal;">EPEL</em>)</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>box php5.3<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># wget http://download.fedora.redhat.com/pub/epel/4/i386/epel-release-4-9.noarch.rpm</span>
--<span style="color: #000000;">13</span>:08:07--  http:<span style="color: #000000; font-weight: bold;">//</span>download.fedora.redhat.com<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>epel<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4</span><span style="color: #000000; font-weight: bold;">/</span>i386<span style="color: #000000; font-weight: bold;">/</span>epel-release-<span style="color: #000000;">4</span>-9.noarch.rpm
           =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">`</span>epel-release-<span style="color: #000000;">4</span>-9.noarch.rpm<span style="color: #ff0000;">'</span>
<span style="color: #ff0000;">Resolving download.fedora.redhat.com... 209.132.183.67</span>
<span style="color: #ff0000;">Connecting to download.fedora.redhat.com|209.132.183.67|:80... connected.</span>
<span style="color: #ff0000;">HTTP request sent, awaiting response... 200 OK</span>
<span style="color: #ff0000;">Length: 13,686 (13K) [application/x-rpm]</span>
&nbsp;
<span style="color: #ff0000;">100%[=================================================================================&gt;] 13,686        --.--K/s            </span>
&nbsp;
<span style="color: #ff0000;">13:08:08 (405.60 KB/s) - `epel-release-4-9.noarch.rpm'</span> saved <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">13686</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">13686</span><span style="color: #7a0874; font-weight: bold;">&#93;</span></div></pre><!--END_DEVFMTCODE--></p>
<p>Then the remi repo:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>box php5.3<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># wget http://rpms.famillecollet.com/enterprise/remi-release-4.rpm</span>
--<span style="color: #000000;">13</span>:08:<span style="color: #000000;">21</span>--  http:<span style="color: #000000; font-weight: bold;">//</span>rpms.famillecollet.com<span style="color: #000000; font-weight: bold;">/</span>enterprise<span style="color: #000000; font-weight: bold;">/</span>remi-release-4.rpm
           =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">`</span>remi-release-4.rpm<span style="color: #ff0000;">'</span>
<span style="color: #ff0000;">Resolving rpms.famillecollet.com... 88.191.60.189</span>
<span style="color: #ff0000;">Connecting to rpms.famillecollet.com|88.191.60.189|:80... connected.</span>
<span style="color: #ff0000;">HTTP request sent, awaiting response... 200 OK</span>
<span style="color: #ff0000;">Length: 5,120 (5.0K) [application/x-rpm]</span>
&nbsp;
<span style="color: #ff0000;">100%[=================================================================================&gt;] 5,120         32.45K/s            </span>
&nbsp;
<span style="color: #ff0000;">13:08:22 (32.41 KB/s) - `remi-release-4.rpm'</span> saved <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">5120</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5120</span><span style="color: #7a0874; font-weight: bold;">&#93;</span></div></pre><!--END_DEVFMTCODE--></p>
<p>Then I&#8217;ve upgraded both repos:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>box php5.3<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># rpm -Uvh remi-release-4*.rpm epel-release-4*.rpm</span>
warning: remi-release-4.rpm: V3 DSA signature: NOKEY, key ID 00f97f56
warning: epel-release-<span style="color: #000000;">4</span>-9.noarch.rpm: V3 DSA signature: NOKEY, key ID 217521f6
Preparing...                <span style="color: #666666; font-style: italic;">########################################### [100%]</span>
   <span style="color: #000000;">1</span>:epel-release           <span style="color: #666666; font-style: italic;">########################################### [ 50%]</span>
   <span style="color: #000000;">2</span>:remi-release           <span style="color: #666666; font-style: italic;">########################################### [100%]</span>
</div></pre><!--END_DEVFMTCODE--></p>
<p>and after that I downloaded the remi repo file for Yum:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>box php5.3<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cd /etc/yum.repos.d/</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>box yum.repos.d<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># wget http://rpms.famillecollet.com/remi-enterprise.repo</span>
--<span style="color: #000000;">13</span>:09:<span style="color: #000000;">28</span>--  http:<span style="color: #000000; font-weight: bold;">//</span>rpms.famillecollet.com<span style="color: #000000; font-weight: bold;">/</span>remi-enterprise.repo
           =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">`</span>remi-enterprise.repo<span style="color: #ff0000;">'</span>
<span style="color: #ff0000;">Resolving rpms.famillecollet.com... 88.191.60.189</span>
<span style="color: #ff0000;">Connecting to rpms.famillecollet.com|88.191.60.189|:80... connected.</span>
<span style="color: #ff0000;">HTTP request sent, awaiting response... 200 OK</span>
<span style="color: #ff0000;">Length: 793 [text/plain]</span>
&nbsp;
<span style="color: #ff0000;">100%[=================================================================================&gt;] 793           --.--K/s            </span>
&nbsp;
<span style="color: #ff0000;">13:09:28 (50.42 MB/s) - `remi-enterprise.repo'</span> saved <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">793</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">793</span><span style="color: #7a0874; font-weight: bold;">&#93;</span></div></pre><!--END_DEVFMTCODE--></p>
<p>After that I just told yum to upgrade php:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>box yum.repos.d<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># yum --enable remi update php</span>
Repository remi is listed <span style="color: #c20cb9; font-weight: bold;">more</span> than once <span style="color: #000000; font-weight: bold;">in</span> the configuration
Repository remi-test is listed <span style="color: #c20cb9; font-weight: bold;">more</span> than once <span style="color: #000000; font-weight: bold;">in</span> the configuration
Setting up Update Process
Setting up repositories
epel                      100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 3.4 kB    00:00    
remi                      100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 2.6 kB    00:00    
Reading repository metadata <span style="color: #000000; font-weight: bold;">in</span> from <span style="color: #7a0874; font-weight: bold;">local</span> files
357f538e0bf37d10983cd3b22 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">732</span> kB    00:06    
epel      : <span style="color: #666666; font-style: italic;">################################################## 2267/2267</span>
e849a85ae6e8f1b8e5e71c08b 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">128</span> kB    00:03    
remi      : <span style="color: #666666; font-style: italic;">################################################## 444/444</span>
Resolving Dependencies
--<span style="color: #000000; font-weight: bold;">&gt;</span> Populating transaction <span style="color: #000000; font-weight: bold;">set</span> with selected packages. Please wait.
---<span style="color: #000000; font-weight: bold;">&gt;</span> Downloading header <span style="color: #000000; font-weight: bold;">for</span> php to pack into transaction set.
php-5.3.2-1.el4.remi.x86_ 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span>  19 kB    00:00    
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package php.x86_64 0:5.3.2-1.el4.remi <span style="color: #000000; font-weight: bold;">set</span> to be updated
--<span style="color: #000000; font-weight: bold;">&gt;</span> Running transaction check
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: php-common = 5.3.2-1.el4.remi <span style="color: #000000; font-weight: bold;">for</span> package: php
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: php-cli = 5.3.2-1.el4.remi <span style="color: #000000; font-weight: bold;">for</span> package: php
--<span style="color: #000000; font-weight: bold;">&gt;</span> Restarting Dependency Resolution with new changes.
--<span style="color: #000000; font-weight: bold;">&gt;</span> Populating transaction <span style="color: #000000; font-weight: bold;">set</span> with selected packages. Please wait.
---<span style="color: #000000; font-weight: bold;">&gt;</span> Downloading header <span style="color: #000000; font-weight: bold;">for</span> php-common to pack into transaction set.
php-common-5.3.2-1.el4.re 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span>  25 kB    00:01    
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package php-common.x86_64 0:5.3.2-1.el4.remi <span style="color: #000000; font-weight: bold;">set</span> to be updated
---<span style="color: #000000; font-weight: bold;">&gt;</span> Downloading header <span style="color: #000000; font-weight: bold;">for</span> php-cli to pack into transaction set.
php-cli-5.3.2-1.el4.remi. 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span>  19 kB    00:01    
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package php-cli.x86_64 0:5.3.2-1.el4.remi <span style="color: #000000; font-weight: bold;">set</span> to be updated
--<span style="color: #000000; font-weight: bold;">&gt;</span> Running transaction check
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: php-common = 5.1.6-3.el4s1.10 <span style="color: #000000; font-weight: bold;">for</span> package: php-mysql
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: php-common = 5.1.6-3.el4s1.10 <span style="color: #000000; font-weight: bold;">for</span> package: php-xml
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: php-common = 5.1.6-3.el4s1.10 <span style="color: #000000; font-weight: bold;">for</span> package: php-pdo
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libedit.so.0<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: php-cli
--<span style="color: #000000; font-weight: bold;">&gt;</span> Restarting Dependency Resolution with new changes.
--<span style="color: #000000; font-weight: bold;">&gt;</span> Populating transaction <span style="color: #000000; font-weight: bold;">set</span> with selected packages. Please wait.
---<span style="color: #000000; font-weight: bold;">&gt;</span> Downloading header <span style="color: #000000; font-weight: bold;">for</span> php-xml to pack into transaction set.
php-xml-5.3.2-1.el4.remi. 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span>  20 kB    00:00    
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package php-xml.x86_64 0:5.3.2-1.el4.remi <span style="color: #000000; font-weight: bold;">set</span> to be updated
---<span style="color: #000000; font-weight: bold;">&gt;</span> Downloading header <span style="color: #000000; font-weight: bold;">for</span> libedit to pack into transaction set.
libedit-20090923-3.0_1.el 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 5.8 kB    00:00    
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package libedit.x86_64 0:20090923-3.0_1.el4.rf <span style="color: #000000; font-weight: bold;">set</span> to be updated
---<span style="color: #000000; font-weight: bold;">&gt;</span> Downloading header <span style="color: #000000; font-weight: bold;">for</span> php-pdo to pack into transaction set.
php-pdo-5.3.2-1.el4.remi. 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span>  19 kB    00:00    
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package php-pdo.x86_64 0:5.3.2-1.el4.remi <span style="color: #000000; font-weight: bold;">set</span> to be updated
---<span style="color: #000000; font-weight: bold;">&gt;</span> Downloading header <span style="color: #000000; font-weight: bold;">for</span> php-mysql to pack into transaction set.
php-mysql-5.3.2-1.el4.rem 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span>  19 kB    00:00    
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package php-mysql.x86_64 0:5.3.2-1.el4.remi <span style="color: #000000; font-weight: bold;">set</span> to be updated
--<span style="color: #000000; font-weight: bold;">&gt;</span> Running transaction check
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libsqlite.so.0<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: php-pdo
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libmysqlclient.so.16<span style="color: #7a0874; font-weight: bold;">&#40;</span>libmysqlclient_16<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: php-mysql
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libmysqlclient.so.16<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: php-mysql
--<span style="color: #000000; font-weight: bold;">&gt;</span> Restarting Dependency Resolution with new changes.
--<span style="color: #000000; font-weight: bold;">&gt;</span> Populating transaction <span style="color: #000000; font-weight: bold;">set</span> with selected packages. Please wait.
---<span style="color: #000000; font-weight: bold;">&gt;</span> Downloading header <span style="color: #000000; font-weight: bold;">for</span> sqlite2 to pack into transaction set.
sqlite2-2.8.17-2.el4.remi 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 5.2 kB    00:00    
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package sqlite2.x86_64 0:2.8.17-2.el4.remi <span style="color: #000000; font-weight: bold;">set</span> to be updated
---<span style="color: #000000; font-weight: bold;">&gt;</span> Downloading header <span style="color: #000000; font-weight: bold;">for</span> mysql-libs to pack into transaction set.
mysql-libs-5.1.45-1.el4.r 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span>  24 kB    00:00    
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package mysql-libs.x86_64 0:5.1.45-1.el4.remi <span style="color: #000000; font-weight: bold;">set</span> to be updated
--<span style="color: #000000; font-weight: bold;">&gt;</span> Running transaction check
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libmysqlclient.so.15<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: perl-DBD-MySQL
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libmysqlclient.so.15<span style="color: #7a0874; font-weight: bold;">&#40;</span>libmysqlclient_15<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: mysql-server
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libmysqlclient_r.so.15<span style="color: #7a0874; font-weight: bold;">&#40;</span>libmysqlclient_15<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: mysql-server
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libmysqlclient.so.15<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: mysql-server
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libmysqlclient.so.15<span style="color: #7a0874; font-weight: bold;">&#40;</span>libmysqlclient_15<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: perl-DBD-MySQL
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: mysql-libs = 5.0.82sp1-1.el4_8 <span style="color: #000000; font-weight: bold;">for</span> package: mysql
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libmysqlclient.so.15<span style="color: #7a0874; font-weight: bold;">&#40;</span>libmysqlclient_15<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: mysql
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libmysqlclient.so.15<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: mysql
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libmysqlclient_r.so.15<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: mysql-server
--<span style="color: #000000; font-weight: bold;">&gt;</span> Restarting Dependency Resolution with new changes.
--<span style="color: #000000; font-weight: bold;">&gt;</span> Populating transaction <span style="color: #000000; font-weight: bold;">set</span> with selected packages. Please wait.
---<span style="color: #000000; font-weight: bold;">&gt;</span> Downloading header <span style="color: #000000; font-weight: bold;">for</span> mysqlclient15 to pack into transaction set.
mysqlclient15-5.0.67-1.el 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 3.9 kB    00:00    
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package mysqlclient15.x86_64 0:5.0.67-1.el4.remi <span style="color: #000000; font-weight: bold;">set</span> to be updated
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package perl-DBD-mysql.x86_64 0:4.013-1.el4.rf <span style="color: #000000; font-weight: bold;">set</span> to be updated
---<span style="color: #000000; font-weight: bold;">&gt;</span> Downloading header <span style="color: #000000; font-weight: bold;">for</span> mysql to pack into transaction set.
mysql-5.1.45-1.el4.remi.x 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span>  19 kB    00:00    
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package mysql.x86_64 0:5.1.45-1.el4.remi <span style="color: #000000; font-weight: bold;">set</span> to be updated
---<span style="color: #000000; font-weight: bold;">&gt;</span> Downloading header <span style="color: #000000; font-weight: bold;">for</span> mysql-server to pack into transaction set.
mysql-server-5.1.45-1.el4 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span>  27 kB    00:00    
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package mysql-server.x86_64 0:5.1.45-1.el4.remi <span style="color: #000000; font-weight: bold;">set</span> to be updated
--<span style="color: #000000; font-weight: bold;">&gt;</span> Running transaction check
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libmysqlclient.so.14<span style="color: #7a0874; font-weight: bold;">&#40;</span>libmysqlclient_14<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: perl-DBD-mysql
--<span style="color: #000000; font-weight: bold;">&gt;</span> Processing Dependency: libmysqlclient.so.14<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>64bit<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">for</span> package: perl-DBD-mysql
--<span style="color: #000000; font-weight: bold;">&gt;</span> Restarting Dependency Resolution with new changes.
--<span style="color: #000000; font-weight: bold;">&gt;</span> Populating transaction <span style="color: #000000; font-weight: bold;">set</span> with selected packages. Please wait.
---<span style="color: #000000; font-weight: bold;">&gt;</span> Downloading header <span style="color: #000000; font-weight: bold;">for</span> mysqlclient14 to pack into transaction set.
mysqlclient14-4.1.22-1.el 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 5.5 kB    00:00    
---<span style="color: #000000; font-weight: bold;">&gt;</span> Package mysqlclient14.x86_64 0:4.1.22-1.el4.remi <span style="color: #000000; font-weight: bold;">set</span> to be updated
--<span style="color: #000000; font-weight: bold;">&gt;</span> Running transaction check
&nbsp;
Dependencies Resolved
&nbsp;
=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
perl-DBD-mysql          x86_64     4.013-1.el4.rf   rpmforge          228 k
     replacing  perl-DBD-MySQL.x86_64 4.008-1.el4s1
&nbsp;
Updating:
php                     x86_64     5.3.2-1.el4.remi  remi              1.4 M
Installing <span style="color: #000000; font-weight: bold;">for</span> dependencies:
libedit                 x86_64     20090923-3.0_1.el4.rf  rpmforge          265 k
mysqlclient14           x86_64     4.1.22-1.el4.remi  remi              1.2 M
mysqlclient15           x86_64     5.0.67-1.el4.remi  remi              1.3 M
sqlite2                 x86_64     2.8.17-2.el4.remi  remi              161 k
Updating <span style="color: #000000; font-weight: bold;">for</span> dependencies:
mysql                   x86_64     5.1.45-1.el4.remi  remi              1.0 M
mysql-libs              x86_64     5.1.45-1.el4.remi  remi              1.7 M
mysql-server            x86_64     5.1.45-1.el4.remi  remi               11 M
php-cli                 x86_64     5.3.2-1.el4.remi  remi              2.6 M
php-common              x86_64     5.3.2-1.el4.remi  remi              963 k
php-mysql               x86_64     5.3.2-1.el4.remi  remi              155 k
php-pdo                 x86_64     5.3.2-1.el4.remi  remi              177 k
php-xml                 x86_64     5.3.2-1.el4.remi  remi              232 k
&nbsp;
Transaction Summary
=============================================================================
Install      5 Package<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span>        
Update       9 Package<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span>        
Remove       0 Package<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span>        
Total download <span style="color: #c20cb9; font-weight: bold;">size</span>: 22 M
Is this ok <span style="color: #7a0874; font-weight: bold;">&#91;</span>y<span style="color: #000000; font-weight: bold;">/</span>N<span style="color: #7a0874; font-weight: bold;">&#93;</span>: y
Downloading Packages:
<span style="color: #7a0874; font-weight: bold;">&#40;</span>1<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: php-xml-5.3.2-1.e 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 232 kB    00:04    
<span style="color: #7a0874; font-weight: bold;">&#40;</span>2<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: libedit-20090923- 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 265 kB    00:04    
<span style="color: #7a0874; font-weight: bold;">&#40;</span>3<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: php-common-5.3.2- 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 963 kB    00:15    
<span style="color: #7a0874; font-weight: bold;">&#40;</span>4<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: mysqlclient15-5.0 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 1.3 MB    00:23    
<span style="color: #7a0874; font-weight: bold;">&#40;</span>5<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: php-cli-5.3.2-1.e 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 2.6 MB    00:35    
<span style="color: #7a0874; font-weight: bold;">&#40;</span>6<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: perl-DBD-mysql-4. 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 228 kB    00:04    
<span style="color: #7a0874; font-weight: bold;">&#40;</span>7<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: php-pdo-5.3.2-1.e 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 177 kB    00:05    
<span style="color: #7a0874; font-weight: bold;">&#40;</span>8<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: mysql-5.1.45-1.el 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 1.0 MB    00:15    
<span style="color: #7a0874; font-weight: bold;">&#40;</span>9<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: sqlite2-2.8.17-2. 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 161 kB    00:05    
<span style="color: #7a0874; font-weight: bold;">&#40;</span>10<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: mysqlclient14-4. 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 1.2 MB    00:15    
<span style="color: #7a0874; font-weight: bold;">&#40;</span>11<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: mysql-server-5.1 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span>  11 MB    01:59    
<span style="color: #7a0874; font-weight: bold;">&#40;</span>12<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: php-5.3.2-1.el4. 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 1.4 MB    00:23    
<span style="color: #7a0874; font-weight: bold;">&#40;</span>13<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: mysql-libs-5.1.4 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 1.7 MB    00:23    
<span style="color: #7a0874; font-weight: bold;">&#40;</span>14<span style="color: #000000; font-weight: bold;">/</span>14<span style="color: #7a0874; font-weight: bold;">&#41;</span>: php-mysql-5.3.2- 100<span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">|</span>=========================<span style="color: #000000; font-weight: bold;">|</span> 155 kB    00:04    
warning: rpmts_HdrFromFdno: V3 DSA signature: NOKEY, key ID 00f97f56
Public key <span style="color: #000000; font-weight: bold;">for</span> php-xml-5.3.2-1.el4.remi.x86_64.rpm is not installed
Retrieving GPG key from http:<span style="color: #000000; font-weight: bold;">//</span>rpms.famillecollet.com<span style="color: #000000; font-weight: bold;">/</span>RPM-GPG-KEY-remi
Importing GPG key 0x00F97F56 <span style="color: #ff0000;">&quot;Remi Collet &quot;</span>
Is this ok <span style="color: #7a0874; font-weight: bold;">&#91;</span>y<span style="color: #000000; font-weight: bold;">/</span>N<span style="color: #7a0874; font-weight: bold;">&#93;</span>:
&nbsp;
Key imported successfully
warning: only V3 signatures can be verified, skipping V4 signature
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
&nbsp;
WARNING : This php-<span style="color: #000000; font-weight: bold;">*</span> RPM are not official Fedora build and
overrides the official ones. Don<span style="color: #ff0000;">'t file bugs on Fedora Project.</span>
&nbsp;
<span style="color: #ff0000;">Use dedicated forums http://forums.famillecollet.com/</span>
&nbsp;
<span style="color: #ff0000;">  Updating  : php-common                                           [ 1/24]warning: /etc/php.ini created as /etc/php.ini.rpmnew</span>
<span style="color: #ff0000;">  Updating  : php-common                   ####################### [ 1/24]</span>
<span style="color: #ff0000;">  Installing: mysqlclient15                ####################### [ 2/24]</span>
<span style="color: #ff0000;">warning: only V3 signatures can be verified, skipping V4 signature</span>
&nbsp;
<span style="color: #ff0000;">WARNING : This MySQL RPM is not an official Fedora build and it</span>
<span style="color: #ff0000;">overrides the official one. Don'</span>t <span style="color: #c20cb9; font-weight: bold;">file</span> bugs on Fedora Project.
Use dedicated forums http:<span style="color: #000000; font-weight: bold;">//</span>forums.famillecollet.com<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
  Updating  : mysql-libs                                           <span style="color: #7a0874; font-weight: bold;">&#91;</span> 3<span style="color: #000000; font-weight: bold;">/</span>24<span style="color: #7a0874; font-weight: bold;">&#93;</span>warning: <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>my.cnf created <span style="color: #c20cb9; font-weight: bold;">as</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>my.cnf.rpmnew
  Updating  : mysql-libs                   <span style="color: #666666; font-style: italic;">####################### [ 3/24]</span>
  Updating  : mysql                        <span style="color: #666666; font-style: italic;">####################### [ 4/24]</span>
  Installing: mysqlclient14                <span style="color: #666666; font-style: italic;">####################### [ 5/24]</span>
  Installing: sqlite2                      <span style="color: #666666; font-style: italic;">####################### [ 6/24]</span>
  Updating  : php-pdo                      <span style="color: #666666; font-style: italic;">####################### [ 7/24]</span>
  Installing: libedit                      <span style="color: #666666; font-style: italic;">####################### [ 8/24]</span>
  Updating  : php-cli                      <span style="color: #666666; font-style: italic;">####################### [ 9/24]</span>
  Updating  : php                          <span style="color: #666666; font-style: italic;">####################### [10/24]</span>
  Updating  : php-mysql                    <span style="color: #666666; font-style: italic;">####################### [11/24]</span>
  Updating  : php-xml                      <span style="color: #666666; font-style: italic;">####################### [12/24]</span>
  Installing: perl-DBD-mysql               <span style="color: #666666; font-style: italic;">####################### [13/24]</span>
  Updating  : mysql-server                 <span style="color: #666666; font-style: italic;">####################### [14/24]</span>
  Cleanup   : php-xml                      <span style="color: #666666; font-style: italic;">####################### [15/24]</span>
  Cleanup   : php-common                   <span style="color: #666666; font-style: italic;">####################### [16/24]</span>
  Cleanup   : php-cli                      <span style="color: #666666; font-style: italic;">####################### [17/24]</span>
  Removing  : perl-DBD-MySQL               <span style="color: #666666; font-style: italic;">####################### [18/24]</span>
  Cleanup   : php-pdo                      <span style="color: #666666; font-style: italic;">####################### [19/24]</span>
  Cleanup   : mysql                        <span style="color: #666666; font-style: italic;">####################### [20/24]</span>
  Cleanup   : mysql-server                 <span style="color: #666666; font-style: italic;">####################### [21/24]</span>
  Cleanup   : php                          <span style="color: #666666; font-style: italic;">####################### [22/24]</span>
  Cleanup   : mysql-libs                   <span style="color: #666666; font-style: italic;">####################### [23/24]</span>
  Cleanup   : php-mysql                    <span style="color: #666666; font-style: italic;">####################### [24/24]</span>
&nbsp;
Installed: perl-DBD-mysql.x86_64 <span style="color: #000000;">0</span>:<span style="color: #000000;">4.013</span>-1.el4.rf
Dependency Installed: libedit.x86_64 <span style="color: #000000;">0</span>:<span style="color: #000000;">20090923</span>-<span style="color: #000000;">3.0</span>_1.el4.rf mysqlclient14.x86_64 <span style="color: #000000;">0</span>:4.1.22-1.el4.remi mysqlclient15.x86_64 <span style="color: #000000;">0</span>:5.0.67-1.el4.remi sqlite2.x86_64 <span style="color: #000000;">0</span>:2.8.17-2.el4.remi
Updated: php.x86_64 <span style="color: #000000;">0</span>:5.3.2-1.el4.remi
Dependency Updated: mysql.x86_64 <span style="color: #000000;">0</span>:5.1.45-1.el4.remi mysql-libs.x86_64 <span style="color: #000000;">0</span>:5.1.45-1.el4.remi mysql-server.x86_64 <span style="color: #000000;">0</span>:5.1.45-1.el4.remi php-cli.x86_64 <span style="color: #000000;">0</span>:5.3.2-1.el4.remi php-common.x86_64 <span style="color: #000000;">0</span>:5.3.2-1.el4.remi php-mysql.x86_64 <span style="color: #000000;">0</span>:5.3.2-1.el4.remi php-pdo.x86_64 <span style="color: #000000;">0</span>:5.3.2-1.el4.remi php-xml.x86_64 <span style="color: #000000;">0</span>:5.3.2-1.el4.remi
Replaced: perl-DBD-MySQL.x86_64 <span style="color: #000000;">0</span>:<span style="color: #000000;">4.008</span>-1.el4s1
Complete<span style="color: #000000; font-weight: bold;">!</span>
</div></pre><!--END_DEVFMTCODE--></p>
<p>When this was done, I just synced /etc/php.ini with the new one /etc/php.ini.rpmnew and /etc/my.cnf with /etc/my.cnf.rpmnew when this was done I just restarted mysql and apache and I php5.3 was now available.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ivanvillareal.info/linux/upgrading-php5-1-to-php5-3-on-centos-4/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Compressing/Decompressing mysql dumps on the fly</title>
		<link>http://blog.ivanvillareal.info/linux/compressingdecompressing-mysql-dumps-on-the-fly/</link>
		<comments>http://blog.ivanvillareal.info/linux/compressingdecompressing-mysql-dumps-on-the-fly/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 20:17:06 +0000</pubDate>
		<dc:creator>Ivan Villareal</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[pipes]]></category>
		<category><![CDATA[restore]]></category>

		<guid isPermaLink="false">http://blog.ivanvillareal.info/?p=197</guid>
		<description><![CDATA[One line commands I use to compress or decompress mysql dumps.]]></description>
			<content:encoded><![CDATA[<p>Using pipes and redirection in the shell we can do backups or restore them, performing compression or decompression on the fly, this are the commands I frequently use:</p>
<p>Create a backup <dbname>with mysqldump and compress the stream with bzip2<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">ivan<span style="color: #000000; font-weight: bold;">@</span>mini:~$ mysqldump –h dbHost –u dbUser –pdbPass –add-drop-database –databases <span style="color: #000000; font-weight: bold;">&lt;</span>dbname<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">bzip2</span> <span style="color: #000000; font-weight: bold;">&gt;</span> dbName-02-<span style="color: #000000;">17</span>-2010.sql.bz2<span style="color: #000000; font-weight: bold;">&lt;/</span>dbname<span style="color: #000000; font-weight: bold;">&gt;</span></div></pre><!--END_DEVFMTCODE--></dbname></p>
<p>If I want to restore the backup I use:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">ivan<span style="color: #000000; font-weight: bold;">@</span>mini:~$ <span style="color: #c20cb9; font-weight: bold;">bunzip2</span> <span style="color: #000000; font-weight: bold;">&lt;</span> dbName-02-17-2010.sql.bz2 <span style="color: #000000; font-weight: bold;">|</span> mysql –h dbHost –u dbUser –pdbPass</div></pre><!--END_DEVFMTCODE--></p>
<p>I can switch bzip2 compression by changing only the program name for example gzip/gunzip lzma/unlzma</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ivanvillareal.info/linux/compressingdecompressing-mysql-dumps-on-the-fly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up a new centos VPS server from console</title>
		<link>http://blog.ivanvillareal.info/linux/setting-up-a-new-centos-vps-server-from-console/</link>
		<comments>http://blog.ivanvillareal.info/linux/setting-up-a-new-centos-vps-server-from-console/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 00:36:30 +0000</pubDate>
		<dc:creator>Ivan Villareal</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://blog.ivanvillareal.info/?p=185</guid>
		<description><![CDATA[How I did an initial configuration of a Centos 5.4 VPS server to have it working with virtual hosts.]]></description>
			<content:encoded><![CDATA[<p>I just got a couple of vps servers, that I have to configure to run some apps, this are the tasks I did to have them ready for production use:</p>
<p>&nbsp;</p>
<p>This servers didn’t came with a control panel (better for me), so the first thing I did was to login:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">ivan<span style="color: #000000; font-weight: bold;">@</span>mini:~$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> root<span style="color: #000000; font-weight: bold;">@</span>23.45.12.56</div></pre><!--END_DEVFMTCODE--></p>
<p>After this I checked the OS, version and architecture</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cat /etc/*release*</span>
CentOS release <span style="color: #000000;">5.4</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Final<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># uname -a</span>
Linux V100205C4HB9V-<span style="color: #000000;">1</span> 2.6.18-028stab064.7 <span style="color: #666666; font-style: italic;">#1 SMP Wed Aug 26 13:11:07 MSD 2009 x86_64 x86_64 x86_64 GNU/Linux</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;">#</div></pre><!--END_DEVFMTCODE--></p>
<p>Ok, now that I know the OS I create a normal user to avoid using the root account.</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># useradd –Gwheel ivan</div></pre><!--END_DEVFMTCODE--></p>
<p>Then I change the server name to mygdon</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># sed -i 's/V100205C4HB9V-1/mygdon/g' /etc/sysconfig/network</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># sed -i 's/V100205C4HB9V-1/mygdon/g' /etc/hosts</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># echo HOST.DOMAIN.com &gt; /etc/hostname</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># hostname -F /etc/hostname</div></pre><!--END_DEVFMTCODE--></p>
<p>Unfortunately I was unable to persist the new hostname, because it is a VPS server, there are ways around this, but didn’t have the time to make the changes so I just moved on, and leave this for later</p>
<p>The next thing I did was update the OS, and add the rpmforge repo because I will need some apps from there</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># yum update</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># yum upgrade</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># rpm -Uhv rpmforge-release-0.5.1-1.$dist.rf.$arch.rpm</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># yum update</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># yum upgrade</div></pre><!--END_DEVFMTCODE--></p>
<p>Then I installed some packages I often use:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># yum install htop screen vim-enhanced</div></pre><!--END_DEVFMTCODE--></p>
<p>The VPS already had a web stack installed I just did some configuration:</p>
<h2>Configuring Apache Virtual Hosts</h2>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># mkdir /var/www/vhosts/{site1, site2} –p</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># vi /etc/httpd/conf/httpd.conf</div></pre><!--END_DEVFMTCODE--></p>
<p>Here I Uncommented the following directive</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Apache configuration"><div class="devcodeoverflow"><span style="color: #00007f;">NameVirtualHost</span> *:<span style="color: #ff0000;">80</span></div></pre><!--END_DEVFMTCODE--></p>
<p>and Added a default vhost a new vhost</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Apache configuration"><div class="devcodeoverflow">&lt;<span style="color: #000000; font-weight:bold;">virtualhost</span> *:80&gt;
    <span style="color: #00007f;">DocumentRoot</span> /var/www/vhosts/default
    <span style="color: #00007f;">ServerName</span> mygdon.site1.net
    &lt;<span style="color: #000000; font-weight:bold;">directory</span> /var/www/vhosts/default&gt;
        <span style="color: #00007f;">Options</span> <span style="color: #0000ff;">Indexes</span> <span style="color: #0000ff;">FollowSymLinks</span>
        <span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">All</span>
        <span style="color: #00007f;">Order</span> <span style="color: #00007f;">allow</span>,<span style="color: #00007f;">deny</span>
        <span style="color: #00007f;">Allow</span> from <span style="color: #0000ff;">all</span>
    &lt;/<span style="color: #000000; font-weight:bold;">directory</span>&gt;
    <span style="color: #00007f;">ErrorLog</span> logs/mygdon.site1.net-error_log
    <span style="color: #00007f;">CustomLog</span> logs/mygdon.site1.net-access_log common
&lt;/<span style="color: #000000; font-weight:bold;">virtualhost</span>&gt;
&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">virtualhost</span> *:80&gt;
    <span style="color: #00007f;">DocumentRoot</span> /var/www/vhosts/site2
    <span style="color: #00007f;">ServerName</span> appname.site2.net
    &lt;<span style="color: #000000; font-weight:bold;">directory</span> /var/www/vhosts/site2&gt;
        <span style="color: #00007f;">Options</span> <span style="color: #0000ff;">Indexes</span> <span style="color: #0000ff;">FollowSymLinks</span>
        <span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">All</span>
        <span style="color: #00007f;">Order</span> <span style="color: #00007f;">allow</span>,<span style="color: #00007f;">deny</span>
        <span style="color: #00007f;">Allow</span> from <span style="color: #0000ff;">all</span>
    &lt;/<span style="color: #000000; font-weight:bold;">directory</span>&gt;
    <span style="color: #00007f;">ErrorLog</span> logs/appname.site2.net-error_log
    <span style="color: #00007f;">CustomLog</span> logs/appname.site2.net-access_log common
&lt;/<span style="color: #000000; font-weight:bold;">virtualhost</span>&gt;</div></pre><!--END_DEVFMTCODE--></p>
<p>then restarted the apache server:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># service httpd restart</span>
Stopping httpd:                                            <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span>
Starting  httpd:                                            <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span></div></pre><!--END_DEVFMTCODE--></p>
<p>and&nbsp; I wrote a simple php file to test this out:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>V100205C4HB9V-<span style="color: #000000;">1</span> ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># echo '&amp;lt;? phpinfo(); ?&amp;gt;' &gt; /var/www/vhosts/site1/index.php</div></pre><!--END_DEVFMTCODE--></p>
<p>And because I haven’t configured a DNS server I just temporarily added the server to my hosts file (On my local machine):</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow">root<span style="color: #339933;">@</span>mini<span style="color: #339933;">:/</span>etc<span style="color: #666666; font-style: italic;"># echo 'subdomain.site1.net 54.65.74.23' &gt; /etc/hosts</div></pre><!--END_DEVFMTCODE--></p>
<p>and here is the result:</p>
<p><a href="http://blog.ivanvillareal.info/wp-content/uploads/2010/02/testingvhost.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="testing-vhost" src="http://blog.ivanvillareal.info/wp-content/uploads/2010/02/testingvhost_thumb.png" border="0" alt="testing-vhost" width="644" height="379" /></a>&nbsp;</p>
<h2>Configuring Mysql</h2>
<p>Once I had the virtual hosts configuration in place I added a mysql user and changed the default root password:</p>
<p>&nbsp;</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="MySQL"><div class="devcodeoverflow"><span style="color: #FF00FF;">&#91;</span>root@V100205C4HB9V<span style="color: #CC0099;">-</span><span style="color: #008080;">1</span> vhosts<span style="color: #FF00FF;">&#93;</span><span style="color: #808080; font-style: italic;"># mysql</span>
Welcome <span style="color: #990099; font-weight: bold;">to</span> the MySQL monitor.  Commands <span style="color: #009900;">end</span> <span style="color: #990099; font-weight: bold;">with</span> <span style="color: #000033;">;</span> <span style="color: #CC0099; font-weight: bold;">or</span> \g.
Your MySQL <span style="color: #FF9900; font-weight: bold;">connection</span> id <span style="color: #CC0099; font-weight: bold;">is</span> 5
Server <span style="color: #000099;">version</span>: 5.0.77 Source distribution
&nbsp;
<span style="color: #990099; font-weight: bold;">Type</span> <span style="color: #008000;">'help;'</span> <span style="color: #CC0099; font-weight: bold;">or</span> <span style="color: #008000;">'<span style="color: #004000; font-weight: bold;">\h</span>'</span> for <span style="color: #990099; font-weight: bold;">help</span>. <span style="color: #990099; font-weight: bold;">Type</span> <span style="color: #008000;">'<span style="color: #004000; font-weight: bold;">\c</span>'</span> <span style="color: #990099; font-weight: bold;">to</span> clear the <span style="color: #00CC00;">buffer</span>.
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">show</span> <span style="color: #990099; font-weight: bold;">databases</span><span style="color: #000033;">;</span>
<span style="color: #CC0099;">+--------------------+</span>
<span style="color: #CC0099;">|</span> <span style="color: #990099; font-weight: bold;">Database</span>           <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">+--------------------+</span>
<span style="color: #CC0099;">|</span> information_schema <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> mysql              <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> test               <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">+--------------------+</span>
3 rows <span style="color: #990099; font-weight: bold;">in</span> <span style="color: #990099; font-weight: bold;">set</span> <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">UPDATE</span> mysql.<span style="color: #000099;">user</span> <span style="color: #990099; font-weight: bold;">SET</span> <span style="color: #000099;">Password</span><span style="color: #CC0099;">=</span><span style="color: #000099;">PASSWORD</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">'pass-here'</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">WHERE</span> <span style="color: #000099;">user</span><span style="color: #CC0099;">=</span><span style="color: #008000;">'root'</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 3 rows affected <span style="color: #FF00FF;">&#40;</span>0.02 sec<span style="color: #FF00FF;">&#41;</span>
Rows matched: 3  Changed: 3  <span style="color: #990099; font-weight: bold;">Warnings</span>: 0
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> FLUSH <span style="color: #990099; font-weight: bold;">PRIVILEGES</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.01 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #000099;">USER</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'localhost'</span> IDENTIFIED BY <span style="color: #008000;">'pass-here'</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.01 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">ALL</span> <span style="color: #990099; font-weight: bold;">PRIVILEGES</span> <span style="color: #990099; font-weight: bold;">ON</span> <span style="color: #CC0099;">*</span>.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'localhost'</span> <span style="color: #990099; font-weight: bold;">WITH</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">OPTION</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #000099;">USER</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'<span style="color: #008080; font-weight: bold;">%</span>'</span> IDENTIFIED BY <span style="color: #008000;">'pass-here'</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">ALL</span> <span style="color: #990099; font-weight: bold;">PRIVILEGES</span> <span style="color: #990099; font-weight: bold;">ON</span> <span style="color: #CC0099;">*</span>.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'<span style="color: #008080; font-weight: bold;">%</span>'</span> <span style="color: #990099; font-weight: bold;">WITH</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">OPTION</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> FLUSH <span style="color: #990099; font-weight: bold;">PRIVILEGES</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> <span style="color: #008080;">0</span> rows affected <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span></div></pre><!--END_DEVFMTCODE--></p>
<p>&nbsp;</p>
<p>Now the server is&nbsp; ready for adding some virtual hosts, I just need to configure a DNS server and the mail server, but because the DNS is on another server and already working I just have to add a new zone, as for mail server, this server will be only used to send emails so I don’t need to dig in postfix configuration files for now.</p>
<p>I&#8217;ll write another post regarding the security, but for now this will work.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ivanvillareal.info/linux/setting-up-a-new-centos-vps-server-from-console/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Ubuntu 9.10 on an hp mini 110-1125nr</title>
		<link>http://blog.ivanvillareal.info/linux/ubuntu-9-10-on-an-hp-mini-110-1125nr/</link>
		<comments>http://blog.ivanvillareal.info/linux/ubuntu-9-10-on-an-hp-mini-110-1125nr/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 00:56:14 +0000</pubDate>
		<dc:creator>Ivan Villareal</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[netbook]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.ivanvillareal.info/?p=148</guid>
		<description><![CDATA[I got this new mini 110, it came with Windows 7 Starter, and after a day of using it I was very frustrated because it was very limiting, for example, I was unable to change my Desktop background, the network management is confusing and frustrating, and it had a lot of crapware, except for the [...]]]></description>
			<content:encoded><![CDATA[<p>I got this new mini 110, it came with Windows 7 Starter, and after a day of using it I was very frustrated because it was very limiting, for example, I was unable to change my Desktop background, the network management is confusing and frustrating, and it had a lot of crapware, except for the hp games, that some of them are fun.</p>
<p>Anyway, right now I don&#8217;t have time to spend getting a new OS on this machine, I just want something that works, I don&#8217;t plan using this to work, but I would like to have some of the tools I use into this.</p>
<p>So my options were, trying Ubuntu remix or Windows Xp, after checking that hp had the drivers for XP, I was going to change Windows 7 to Xp, but I was reading how to create a USB boot drive, and it was too much hassle for me. (I&#8217;m very lazy for any Microsoft stuff).</p>
<p>My next option was Ubuntu remix, I&#8217;m not a big fan of Ubuntu, but I wanted something to just worked out of the box, also this little netbook comes with splashtop, a really nice feature for checking stuff online fast, and I didn&#8217;t want to loose this so I really didn&#8217;t knew how well this was going to work.</p>
<p>I started downloading Ubuntu 9.10 Karmic yesterday night, just in case, Today after more frustrating things, I decided to give Karmic a try.</p>
<p>I grabbed my usb pendrive, a 1gb &nbsp;kingston traveler, mounted the iso and ran usbinst.exe, it was pretty straightforward, my only advice to you would be to avoid saving space for your documents in the usb, my first try I set this to 30Mb and the boot failed, so I set the do not save feature.</p>
<p>It took about 40 minutes to finish copying the files, after it was done, I restarted the netbook with the pendrive connected, and at the first boot screen I pressed F9 key for booting options, selected the pendrive and that was it.</p>
<p>After testing ubuntu from the pendrive, it ran pretty well and everything but the wifi worked, I did an installation, keeping the windows partition and the hp restore partition, just in case.</p>
<p>The installation was pretty smooth, no issues at all, after the first boot I just installed the broadcom drivers, it was pretty easy with the driver manager in ubuntu, and the wifi was working</p>
<p>Update: My hp mini was stolen by a couple of elderly people, I saw the video <img src='http://blog.ivanvillareal.info/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> , so I&#8217;m unable to play more with this, but the time I had this I was very happy with it, it performed well.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ivanvillareal.info/linux/ubuntu-9-10-on-an-hp-mini-110-1125nr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>File Type Detection in PHP</title>
		<link>http://blog.ivanvillareal.info/linux/file-type-detecion-in-php/</link>
		<comments>http://blog.ivanvillareal.info/linux/file-type-detecion-in-php/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 04:47:24 +0000</pubDate>
		<dc:creator>Ivan Villareal</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[fileinfo]]></category>
		<category><![CDATA[pecl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.ivanvillareal.info/?p=150</guid>
		<description><![CDATA[I&#8217;m working on a project where the users can upload files, and I need to know the type of file they are uploading, a simple solution would be to check the extensions of the files, but this has many flaws, so I was looking for a reliable way to detect the type of file, and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a project where the users can upload files, and I need to know the type of file they are uploading, a simple solution would be to check the extensions of the files, but this has many flaws, so I was looking for a reliable way to detect the type of file, and I found a PECL extension called <a href="http://pecl.php.net/package/Fileinfo/php-src/ext/fileinfo">file info</a> this extension is enabled by default in PHP 5.3, unfortunately I&#8217;m runing PHP 5.2.10, and the prod server also has this version.</p>
<p>So what I did to install this on ubuntu 9.10 karmic was the following:</p>
<p>&nbsp;</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">root<span style="color: #000000; font-weight: bold;">@</span>mini:<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: #666666; font-style: italic;"># apt-get install php5-dev libmagic-dev php-pear</span>
....
root<span style="color: #000000; font-weight: bold;">@</span>mini:<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: #666666; font-style: italic;"># pear channel-update pear.php.net</span>
...
root<span style="color: #000000; font-weight: bold;">@</span>mini:<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: #666666; font-style: italic;"># pecl install Fileinfo</span>
....
Build process completed successfully
Installing <span style="color: #ff0000;">'/usr/lib/php5/20060613+lfs/fileinfo.so'</span>
<span style="color: #c20cb9; font-weight: bold;">install</span> ok: channel:<span style="color: #000000; font-weight: bold;">//</span>pear.php.net<span style="color: #000000; font-weight: bold;">/</span>Fileinfo-1.0.4</div></pre><!--END_DEVFMTCODE--></p>
<p>&nbsp;</p>
<p>and finally I added the extension to php.ini</p>
<p>extension=fileinfo.so</p>
<p>I restarted the apache server, and tested with this</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow">          <span style="color: #339933;">&lt;!--</span>DVFMTSC<span style="color: #339933;">--&gt;</span><span style="color: #000088;">$fileInfo</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> finfo<span style="color: #009900;">&#40;</span>FILEINFO_MIME<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #339933;">&lt;!--</span>DVFMTSC<span style="color: #339933;">--&gt;</span> 
<span style="color: #000088;">$mimeType</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$fileInfo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">buffer</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$uploadedFile</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
</div></pre><!--END_DEVFMTCODE--></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ivanvillareal.info/linux/file-type-detecion-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mount a remote filesystem using sshfs</title>
		<link>http://blog.ivanvillareal.info/linux/mount-a-remote-filesystem-using-sshfs/</link>
		<comments>http://blog.ivanvillareal.info/linux/mount-a-remote-filesystem-using-sshfs/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 19:25:39 +0000</pubDate>
		<dc:creator>Ivan Villareal</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[fuse]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sshfs]]></category>

		<guid isPermaLink="false">http://blog.ivanvillareal.info/?p=82</guid>
		<description><![CDATA[I often have to upload files to several servers, and some of them doesn&#8217;t have an rsync or ftp server, so if I&#8217;m going to make a deployment, I have to use scp, or sftp to upload the files.
This works well when I need to make a quick change or test 1 file, but If [...]]]></description>
			<content:encoded><![CDATA[<p>I often have to upload files to several servers, and some of them doesn&#8217;t have an rsync or ftp server, so if I&#8217;m going to make a deployment, I have to use scp, or sftp to upload the files.</p>
<p>This works well when I need to make a quick change or test 1 file, but If I have to synchronize several files it is a very time consuming task.</p>
<p>So what I use in this cases is <a title="This is a filesystem client based on the SSH File Transfer Protocol." href="http://fuse.sourceforge.net/sshfs.html" target="_blank">sshfs</a>&nbsp;it is a pretty cool tool, to allow me to mount any filesystem so I can use any rsync on a remote server&nbsp;without&nbsp;dealing with opening ports configure, the server or do other stuff,</p>
<p>Gentoo is my main OS, so it was really easy to have this working, I had to reconfigure the kernel to support fuse</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Text"><div class="devcodeoverflow">Symbol: FUSE_FS [=m]
Location:
  -&gt; File systems
      -&gt; Filesystem in Userspace support</div></pre><!--END_DEVFMTCODE--></p>
<p>and after this was ready I only installed sys-fs/sshfs-fuse</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>I<span style="color: #7a0874; font-weight: bold;">&#93;</span> sys-fs<span style="color: #000000; font-weight: bold;">/</span>sshfs-fuse
     Available versions:  <span style="color: #000000;">1.9</span> ~<span style="color: #000000;">2.1</span> <span style="color: #000000;">2.2</span>
     Installed versions:  <span style="color: #000000;">2.2</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">12</span>:<span style="color: #000000;">33</span>:09 PM 09<span style="color: #000000; font-weight: bold;">/</span>08<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2009</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
     Homepage:            http:<span style="color: #000000; font-weight: bold;">//</span>fuse.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>sshfs.html
     Description:         Fuse-filesystem utilizing the sftp service.
</div></pre><!--END_DEVFMTCODE--></p>
<p>when it was ready I did the following to mount the remote filesystem:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">ivan<span style="color: #000000; font-weight: bold;">@</span>gondor ~ $ sshfs phpfix<span style="color: #000000; font-weight: bold;">@</span>prestant.citizenhawk.net: preasent<span style="color: #000000; font-weight: bold;">/</span></div></pre><!--END_DEVFMTCODE--></p>
<p>After this I&#8217;m able to use the remote file system as usual.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ivanvillareal.info/linux/mount-a-remote-filesystem-using-sshfs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql5 and PHP5 on centos4</title>
		<link>http://blog.ivanvillareal.info/linux/mysql5-and-php5-on-centos4/</link>
		<comments>http://blog.ivanvillareal.info/linux/mysql5-and-php5-on-centos4/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 19:00:06 +0000</pubDate>
		<dc:creator>Ivan Villareal</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.ivanvillareal.info/?p=76</guid>
		<description><![CDATA[I have the need to install php5 and mysql 5 on a centos 4 server, so I found that the Centos Plus repository had this, and this is what I did to get these two working.
First check what is the version of the distro:
cat /etc/*release*
Then make an update:
yum update
After 496 package updates I&#8217;ve installed php5
yum [...]]]></description>
			<content:encoded><![CDATA[<p>I have the need to install php5 and mysql 5 on a centos 4 server, so I found that the Centos Plus repository had this, and this is what I did to get these two working.</p>
<p>First check what is the version of the distro:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/*</span>release<span style="color: #000000; font-weight: bold;">*</span></div></pre><!--END_DEVFMTCODE--></p>
<p>Then make an update:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">yum update</div></pre><!--END_DEVFMTCODE--></p>
<p>After 496 package updates I&#8217;ve installed php5<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">yum <span style="color: #660033;">--enablerepo</span>=centosplus <span style="color: #c20cb9; font-weight: bold;">install</span> php</div></pre><!--END_DEVFMTCODE--></p>
<p>This were the installed packages:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">php-5.1.6-3.el4s1.10
php-cli-5.1.6-3.el4s1.10
php-common-5.1.6-3.el4s1.10
</div></pre><!--END_DEVFMTCODE--></p>
<p>So I&#8217;ve created a info.php file, and restarted the apache server:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&lt;?php phpinfo(); ?&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <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>html<span style="color: #000000; font-weight: bold;">/</span>info.php <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> service httpd restart</div></pre><!--END_DEVFMTCODE--></p>
<p>It was working correctly, so the next thing was to have mysql 5 in it, so I did:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">yum <span style="color: #660033;">--enablerepo</span>=centosplus <span style="color: #c20cb9; font-weight: bold;">install</span> mysql-server</div></pre><!--END_DEVFMTCODE--></p>
<p>I got some problems here, first I got this:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">Transaction Check Error: <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>my.cnf from <span style="color: #c20cb9; font-weight: bold;">install</span> of mysql-libs-5.0.68-1.el4_6 conflicts with <span style="color: #c20cb9; font-weight: bold;">file</span> from package mysql-4.1.22-2.el4
<span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>charsets<span style="color: #000000; font-weight: bold;">/</span>Index.xml from <span style="color: #c20cb9; font-weight: bold;">install</span> of mysql-libs-5.0.68-1.el4_6 conflicts with <span style="color: #c20cb9; font-weight: bold;">file</span> from package mysql-4.1.22-2.el4
<span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>charsets<span style="color: #000000; font-weight: bold;">/</span>README from <span style="color: #c20cb9; font-weight: bold;">install</span> of mysql-libs-5.0.68-1.el4_6 conflicts with <span style="color: #c20cb9; font-weight: bold;">file</span> from package mysql-4.1.22-2.el4
<span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>charsets<span style="color: #000000; font-weight: bold;">/</span>armscii8.xml from <span style="color: #c20cb9; font-weight: bold;">install</span> of mysql-libs-5.0.68-1.el4_6 conflicts with <span style="color: #c20cb9; font-weight: bold;">file</span> from package mysql-4.1.22-2.el4
<span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>charsets<span style="color: #000000; font-weight: bold;">/</span>ascii.xml from <span style="color: #c20cb9; font-weight: bold;">install</span> of mysql-libs-5.0.68-1.el4_6 conflicts with <span style="color: #c20cb9; font-weight: bold;">file</span> from package mysql-4.1.22-2.el4</div></pre><!--END_DEVFMTCODE--></p>
<p>So what I found was that yum was trying to install mysql.i386 but the architechture is x86_64, to fix this I had to specify the arch<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">yum <span style="color: #660033;">--enablerepo</span>=centosplus <span style="color: #c20cb9; font-weight: bold;">install</span> mysql.x86_64 mysql-server</div></pre><!--END_DEVFMTCODE--></p>
<p>After this I was able to install it, but when I tried to start the server I received some errors about error messages not right, I&#8217;ve checked the installed packages and it was installed mysqlclient10, so I removed the error messages problem disappeared, however I still couldn&#8217;t startup the server, checking at the logs I found this:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow">InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
091012 11:01:18  InnoDB: Started; log sequence number <span style="color: #000000;">0</span> <span style="color: #000000;">0</span>                       091012 <span style="color: #000000;">11</span>:01:<span style="color: #000000;">18</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ERROR<span style="color: #7a0874; font-weight: bold;">&#93;</span> Fatal error: Can<span style="color: #ff0000;">'t open and lock privilege tables: Table '</span>mysql.host<span style="color: #ff0000;">' doesn'</span>t exist                                                     091012 <span style="color: #000000;">11</span>:01:<span style="color: #000000;">18</span>  mysqld ended                                               </div></pre><!--END_DEVFMTCODE-->\</p>
<p>To fix this I cleared the data dir, that had som files, this was in &#8216;/var/lib/mysql&#8217; and after that I ran mysql_install_db:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>prestant <span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># cd /var/lib/mysql </span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>prestant mysql<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># rm -rf *</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>prestant mysql<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># mysql_install_db --user=mysql -ldata=/var/lib/mysql</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>prestant mysql<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># service mysqld start</div></pre><!--END_DEVFMTCODE--></p>
<p>After the server was up, I changed the root password and added a new user:</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="Bash"><div class="devcodeoverflow"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>prestant mysql<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># mysqladmin -u root password NEWPASSWORD</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>prestant mysql<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># mysql -pNEWPASSWORD</span>
&nbsp;
</div></pre><!--END_DEVFMTCODE--><br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="MySQL"><div class="devcodeoverflow">Welcome <span style="color: #990099; font-weight: bold;">to</span> the MySQL monitor.  Commands <span style="color: #009900;">end</span> <span style="color: #990099; font-weight: bold;">with</span> <span style="color: #000033;">;</span> <span style="color: #CC0099; font-weight: bold;">or</span> \g.
Your MySQL <span style="color: #FF9900; font-weight: bold;">connection</span> id <span style="color: #CC0099; font-weight: bold;">is</span> 5
Server <span style="color: #000099;">version</span>: 5.0.82sp1 Source distribution
&nbsp;
<span style="color: #990099; font-weight: bold;">Type</span> <span style="color: #008000;">'help;'</span> <span style="color: #CC0099; font-weight: bold;">or</span> <span style="color: #008000;">'<span style="color: #004000; font-weight: bold;">\h</span>'</span> for <span style="color: #990099; font-weight: bold;">help</span>. <span style="color: #990099; font-weight: bold;">Type</span> <span style="color: #008000;">'<span style="color: #004000; font-weight: bold;">\c</span>'</span> <span style="color: #990099; font-weight: bold;">to</span> clear the current input statement.
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #000099;">USER</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'<span style="color: #008080; font-weight: bold;">%</span>'</span> IDENTIFIED BY <span style="color: #008000;">'passhere'</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">ALL</span> <span style="color: #990099; font-weight: bold;">PRIVILEGES</span> <span style="color: #990099; font-weight: bold;">ON</span> <span style="color: #CC0099;">*</span>.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'<span style="color: #008080; font-weight: bold;">%</span>'</span> IDENTIFIED BY <span style="color: #008000;">'passhere'</span> <span style="color: #990099; font-weight: bold;">WITH</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">OPTION</span> MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 <span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #000099;">USER</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'localhost'</span> IDENTIFIED BY <span style="color: #008000;">'passhere'</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">ALL</span> <span style="color: #990099; font-weight: bold;">PRIVILEGES</span> <span style="color: #990099; font-weight: bold;">ON</span> <span style="color: #CC0099;">*</span>.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'ivan'</span>@<span style="color: #008000;">'localhost'</span> <span style="color: #990099; font-weight: bold;">WITH</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">OPTION</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> 0 rows affected <span style="color: #FF00FF;">&#40;</span>0.00 sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> flush <span style="color: #990099; font-weight: bold;">privileges</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> <span style="color: #008080;">0</span> rows affected <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span>
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span> exit
Bye
&nbsp;
&nbsp;
</div></pre><!--END_DEVFMTCODE--></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ivanvillareal.info/linux/mysql5-and-php5-on-centos4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing Hybrid feature of an Acomdata drive.</title>
		<link>http://blog.ivanvillareal.info/linux/removing-hybrid-feature-of-an-acomdata-drive/</link>
		<comments>http://blog.ivanvillareal.info/linux/removing-hybrid-feature-of-an-acomdata-drive/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 17:58:28 +0000</pubDate>
		<dc:creator>Ivan Villareal</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[external hd]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[flashing]]></category>

		<guid isPermaLink="false">http://blog.ivanvillareal.info/?p=50</guid>
		<description><![CDATA[

About 2 years ago I purchased this 500Gb Acomdata drive that was on sale at Fry&#8217;s, it was a good deal back then, cost me about 100 bucks, it had an aluminium case and a power off switch, and I was in the need to expand the storage capacity of my multimedia server, which is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.ivanvillareal.info/wp-content/uploads/2009/10/AcomdataDrive.jpg"><br />
<img class="size-full wp-image-51 alignleft" title="Acomdata Drive" src="http://blog.ivanvillareal.info/wp-content/uploads/2009/10/AcomdataDrive.jpg" alt="500Gb Acomdata Drive" width="420" height="210" /></a></p>
<p>About 2 years ago I purchased this <a title="Product Page" href="http://www.acomdata.com/e5_hybriddrive.asp" target="_blank">500Gb Acomdata drive</a> that was on sale at Fry&#8217;s, it was a good deal back then, cost me about 100 bucks, it had an aluminium case and a power off switch, and I was in the need to expand the storage capacity of my multimedia server, which is linux based.</p>
<p>I didn&#8217;t researched this product, I didn&#8217;t even knew that acomdata was a brand, anyway I remember seeing the &#8220;Hybrid Drive&#8221; statement, but didn&#8217;t care, I was going to wipe this drive an reformat it as ext3, so I was aware that all the &#8220;software features&#8221; it had were useless to me, like the <span>PushButton&trade; Backup and the Nomad Mobile Desktop.</span></p>
<p><span>After I arrived home, I plugged this thing on my server, which had ivman and a custom script to mount anything, but after few seconds nothing happened, I look at the kernel&nbsp;messages&nbsp;and I started to worry, It showed as a CD drive instead of a Mass Storage Device, I tried&nbsp;unsuccessfully&nbsp;to mount this manually, so I&nbsp;thought&nbsp;this drive must be bad.</span></p>
<p>The next day I connected this drive to a Windows XP, and after some drivers install, it was working, I noticed that it created a virtual CD drive on Windows it had some software on it, so I&nbsp;thought&nbsp;that this was some kind of partition that would be erased after I formatted the drive, so I did this, but the partition was still there.</p>
<p>I did some research on the internet but didn&#8217;t found anything&nbsp;use full, so I was again trying to make this stupid drive worked on linux, I hate when I have to fight with the stuff I buy just to make it work on linux, I was very annoyed by this, finally after looking the kernel messages I&#8217;ve found that the drive was acting as a SCSI device, so I activated &#8220;Probe all LUNs on each SCSI device&#8221; in the kernel and after a kernel restart both partitions were available on&nbsp;Linux, however this still had a problem, because I was using ivman to detect the drive and mounted, ivman &nbsp;didn&#8217;t worked for hard drive partition, just for the virtual CD, I&#8217;ve tried&nbsp;unsuccessfully&nbsp;to delete that stupid CD partition on windows and Linux.</p>
<p>I had enough of this and I was going to take this drive back to the store, but in a desperation moment I took my screwdriver and started to tearing apart the drive, I wasn&#8217;t even stopped by the warranty void seal, my intention was to take the drive format it and put it back&nbsp;without&nbsp;the cd part, I did this, and the format was&nbsp;successful, the drive was totally empty, but when I put this back to the enclosure the stupid CD partition was there, empty this time, but it was there, so it was a firmware issue and I didn&#8217;t found a firmware upgrade to remove this stupid feature.</p>
<p>I did some scripts to detect this&nbsp;unmounted the CD part&nbsp;and mount the hard drive partition, it took me about a week to have this thing working the way I wanted, &nbsp;this was &nbsp;unbelievable,&nbsp;why they don&#8217;t put the software to remove this &#8220;hybryd feature&#8221;.</p>
<p>However this drive has been working fine, with the virtual CD partition still there until Yesterday, I was in the need to transfer some large files from work to home, and this was the drive more reachable from all the drives I have, so I bring it her to the&nbsp;office, and as soon as I plugged in the CD partition appeared on my Desktop, so I&nbsp;thought&nbsp;it has been a while now, lets see if I can finally reflash the firmware to remove this so called feature, and I&#8217;ve found a forum with several users trying to remove this, and suddenly I&#8217;ve found this &nbsp;post:</p>
<blockquote><p>You need this software from http://www.mediafire.com/?bgwuwq5xzbm</p>
<p>unzip and click on MP251MFG, click on &#8220;configure hdd&#8221; and once it says pass just unplug and plug in the device. CD PART gone.&nbsp;</p></blockquote>
<p>I quickly downloaded the file in question, it was a zip file called &#8220;REMOVE CD PART.zip&#8221; with about 1.5Mb in size, it has &nbsp;a Readme.pdf that describes the MP251MFG program, I booted up in Windows, installed the <a title="Ext2 file system on windows" href="http://www.fs-driver.org/" target="_blank">fsdriver</a>&nbsp;because this drive was an ext3, plugged the drive and run the MP251MFG.exe application this is what I saw:</p>
<p style="text-align: center;"><a href="http://blog.ivanvillareal.info/wp-content/uploads/2009/10/MP251MFG_Interface.png"><img class="size-full wp-image-57 aligncenter" title="MP251MFG.exe Interface" src="http://blog.ivanvillareal.info/wp-content/uploads/2009/10/MP251MFG_Interface.png" alt="MP251MFG.exe Interface" width="540" height="328" /></a></p>
<p>I didn&#8217;t backed up the drive, I was just exploring the options and I clicked the Configure HDD, a process was started and finished&nbsp;successfully, I was affraid that my data were gone, so I headed to check if the data was there, and it was, I copied the important stuff somewhere else, unplugged the drive and plugged back in, and voilà, the CD partition was gone along with the data in the drive, but that din&#8217;t matter the CD partition was really gone <img src='http://blog.ivanvillareal.info/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>The drive was reformatted to FAT32, so I reformatted back to ext3, and now it is working pretty well, 2 years later.</p>
<p>I&#8217;ve found that this program works for other drives too, here are some links where this program can be found</p>
<p>For Windows:</p>
<ul>
<li><a href="http://www.techsupportlive.com/index.php?_m=downloads&amp;_a=viewdownload&amp;downloaditemid=53&amp;nav=0,7" target="link">xSil251  Switch HDD to CD+HDD_Nomad Mobile Desktop_V1.04_091007</a></li>
<li><a href="http://www.techsupportlive.com/index.php?_m=downloads&amp;_a=viewdownload&amp;downloaditemid=29" target="link">xSil251 Switch CD+HDD to HDD 3.5_Toshiba_V1.02_041307</a>&nbsp;</li>
</ul>
<p>For Macintosh:</p>
<ul>
<li><a href="http://www.techsupportlive.com/index.php?_m=downloads&amp;_a=viewdownload&amp;downloaditemid=51&amp;nav=0,7" target="link">Switch to CD+Secure Nomad for Mac</a></li>
<li><a href="http://www.techsupportlive.com/index.php?_m=downloads&amp;_a=viewdownload&amp;downloaditemid=46" target="link">CD to HDD Convertor for Mac</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.ivanvillareal.info/linux/removing-hybrid-feature-of-an-acomdata-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up ssh keys for passwordless login</title>
		<link>http://blog.ivanvillareal.info/linux/setting-up-ssh-keys-for-passwordless-login/</link>
		<comments>http://blog.ivanvillareal.info/linux/setting-up-ssh-keys-for-passwordless-login/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 23:57:29 +0000</pubDate>
		<dc:creator>Ivan Villareal</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[auth]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[passwordless]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://blog.ivanvillareal.info/?p=40</guid>
		<description><![CDATA[Most part of the time I&#8217;ve spent on my development machine I have several terminals opened, but thanks to screen I only have one per server.
However I&#8217;m constantly in the need to login to some servers just to make a quick check of something, so I have to type in my credentials every time I [...]]]></description>
			<content:encoded><![CDATA[<p>Most part of the time I&#8217;ve spent on my development machine I have several terminals opened, but thanks to <a title="Screen is a full-screen window manager that multiplexes a physical terminal between several processes" href="http://www.gnu.org/software/screen/" target="_blank">screen </a>I only have one per server.</p>
<p>However I&#8217;m constantly in the need to login to some servers just to make a quick check of something, so I have to type in my credentials every time I log in, this really annoys me, because when I&#8217;m focused on something I don&#8217;t want to loose that focus waiting for the login prompt.</p>
<p>So what I did &nbsp;to fix this annoyance, was to use Key Authentication &nbsp;instead of Password Authentication, I&#8217;ve been using this for several years now under several distros&nbsp;without&nbsp;a problem.</p>
<p>So in short this is what I do, whenever I want to use Key Auth.<br />
<pre>gondor .ssh # cd ~/.ssh
gondor .ssh ~ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
53:df:bb:74:24:2d:7f:78:1f:85:66:f0:19:b6:9f:71 root@gondor
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|          . . o  |
|         . . = * |
|        S   . @.E|
|         .   o O=|
|              +o*|
|             . ++|
|              . .|
+-----------------+</pre><br />
I haven&#8217;t set a password for the key, &nbsp;because if I set a password I would have to type the password for the key each time, or setup a program to remember the key password like Gnome Keyring or Putty Pageant in Windows.</p>
<p>After my private and public keys are generated I copy the public key to the server where I want to access&nbsp;without&nbsp;password<br />
<pre>
gondor .ssh # ssh-copy-id -i id_rsa.pub ivan@odin
The authenticity of host 'odin (192.168.1.201)' can't be established.
RSA key fingerprint is bb:36:b4:0b:05:13:ce:a2:2e:95:97:59:65:f3:f8:a8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'odin,192.168.1.201' (RSA) to the list of known hosts.
Password:
Now try logging into the machine, with "ssh 'ivan@odin'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

gondor .ssh # ssh ivan@odin
Last login: Fri Sep 25 15:50:03 PDT 2009 from gondor.artedigital on ssh
Last login: Fri Sep 25 15:50:07 2009 from gondor.artedigital
ivan@odin ~ $</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ivanvillareal.info/linux/setting-up-ssh-keys-for-passwordless-login/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
<noscript><a href="http://www.hosting24.com/"><img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></a></noscript>
<!-- End Of Analytics Code -->
