<?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>SparkSupport.com Blog &#187; linux</title>
	<atom:link href="http://www.sparksupport.com/blog/category/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sparksupport.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 15 Sep 2011 14:39:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>LINUX VIRTULIZATION AND MIGRATION OF VM’S IN LINUX HOST TO WINDOWS HOST</title>
		<link>http://www.sparksupport.com/blog/linux-virtulization-and-migration-of-vm%e2%80%99s-in-linux-host-to-windows-host</link>
		<comments>http://www.sparksupport.com/blog/linux-virtulization-and-migration-of-vm%e2%80%99s-in-linux-host-to-windows-host#comments</comments>
		<pubDate>Wed, 14 Sep 2011 18:31:22 +0000</pubDate>
		<dc:creator>rakeshraj</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[linux virtulization]]></category>
		<category><![CDATA[migration of virtual machines from linux host to windows host]]></category>

		<guid isPermaLink="false">http://www.sparksupport.com/blog/linux-virtulization-and-migration-of-vm%e2%80%99s-in-linux-host-to-windows-host</guid>
		<description><![CDATA[&#160; Top 10 Linux Virtualization Software Virtualization is the latest buzz word. You may wonder computers are getting cheaper every day, why should I care and why should I use virtualization? Virtualization is a broad term that refers to the abstraction of computer resources such as: Platform Virtualization Resource Virtualization Storage Virtualization Network Virtualization Desktop [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify">&nbsp;</p>
<h1>Top 10 Linux Virtualization Software</h1>
<p style="text-align: justify">Virtualization is the latest buzz word. You may wonder computers are getting cheaper every day, why should I care and why should I use virtualization? Virtualization is a broad term that refers to the abstraction of computer resources such as:</p>
<ol>
<li>
<div style="text-align: justify">Platform Virtualization</div>
</li>
<li>
<div style="text-align: justify">Resource Virtualization</div>
</li>
<li>
<div style="text-align: justify">Storage Virtualization</div>
</li>
<li>
<div style="text-align: justify">Network Virtualization</div>
</li>
<li>
<div style="text-align: justify">Desktop Virtualization</div>
</li>
</ol>
<p>This article describes why you need virtualization and list commonly used FOSS and proprietary Linux virtualization software.</p>
<p style="text-align: justify">&nbsp;</p>
<h2>Why should I use virtualization?</h2>
<ul>
<li>
<div style="text-align: justify"><strong>Consolidation</strong> &#8211; It means combining multiple software workloads on one computer system. You can run various virtual machines in order to save money and power (electricity).</div>
</li>
<li>
<div style="text-align: justify"><strong>Testing</strong> &#8211; You can test various configuration. You can create less resource hungry and low priority virtual machines (VM). Often, I test new Linux distro inside VM. This is also good for students who wish to learn new operating systems and programming languages / database without making any changes to working environment. At my work place I give developers virtual test machines for testing and debugging their software.</div>
</li>
<li>
<div style="text-align: justify"><strong>Security and Isolation</strong> &#8211; If mail server or any other app gets cracked, only that VM will be under control of the attacker. Also, isolation means misbehaving apps (e.g. memory leaks) cannot bring down whole server.</div>
</li>
</ul>
<p style="text-align: justify">&nbsp;</p>
<h3>Open Source Linux Virtualization Software</h3>
<ol>
<li>
<div style="text-align: justify"><a href="http://openvz.org/" target="_blank">OpenVZ</a> is an operating system-level virtualization technology based on the Linux kernel and operating system.</div>
</li>
<li>
<div style="text-align: justify"><a href="http://www.xen.org/" target="_blank">Xen</a> is a virtual machine monitor for 32 / 64 bit Intel / AMD (IA 64) and PowerPC 970 architectures. It allows several guest operating systems to be executed on the same computer hardware concurrently. XEN is included with most popular Linux distributions such as Debian, Ubuntu, CentOS, RHEL, Fedora and many others.</div>
</li>
<li>
<div style="text-align: justify"><a href="http://kvm.qumranet.com/" target="_blank">Kernel-based Virtual Machine (KVM)</a> is a Linux kernel virtualization infrastructure. KVM currently supports native virtualization using Intel VT or AMD-V. A wide variety of guest operating systems work with KVM, including many flavours of Linux, BSD, Solaris, and Windows etc. KVM is included with Debian, OpenSuse and other Linux distributions.</div>
</li>
<li>
<div style="text-align: justify"><a href="http://linux-vserver.org/" target="_blank">Linux-VServer</a> is a virtual private server implementation done by adding operating system-level virtualization capabilities to the Linux kernel.</div>
</li>
<li>
<div style="text-align: justify"><a href="http://www.virtualbox.org/" target="_blank">VirtualBox</a> is an x86 virtualization software package, developed by Sun Microsystems as part of its Sun xVM virtualization platform. Supported host operating systems include Linux, Mac OS X, OS/2 Warp, Windows XP or Vista, and Solaris, while supported guest operating systems include FreeBSD, Linux, OpenBSD, OS/2 Warp, Windows and Solaris.</div>
</li>
<li>
<div style="text-align: justify"><a href="http://bochs.sourceforge.net/" target="_blank">Bochs</a> is a portable x86 and AMD64 PC emulator and debugger. Many guest operating systems can be run using the emulator including DOS, several versions of Microsoft Windows, BSDs, Linux, AmigaOS, Rhapsody and MorphOS. Bochs can run on many host operating systems, like Windows, Windows Mobile, Linux and Mac OS X.</div>
</li>
<li>
<div style="text-align: justify"><a href="http://user-mode-linux.sourceforge.net/" target="_blank">User Mode Linux (UML)</a> was the first virtualization technology for Linux. User-mode Linux is generally considered to have lower performance than some competing technologies, such as Xen and OpenVZ. Future work in adding support for x86 virtualization to UML may reduce this disadvantage.</div>
</li>
</ol>
<p style="text-align: justify">&nbsp;</p>
<h3>Proprietary Linux Virtualization Software</h3>
<ul>
<li>
<div style="text-align: justify"><a href="http://www.vmware.com/" target="_blank">VMware ESX Server and VMWare Server</a> &#8211; VMware Server (also known as GSX Server) is an entry-level server virtualization software. VMware ESX Server is an enterprise-level virtualization product providing data center virtualization. It can run various guest operating systems such as FreeBSD, Linux, Solaris, Windows and others.</div>
</li>
<li>
<div style="text-align: justify">Commercial implementations of XEN available with various features and support.</div>
<ul>
<li>
<div style="text-align: justify"><a href="http://citrix.com/" target="_blank">Citrix XenServer</a> : XenServer is based on the open source Xen hypervisor, an exceptionally lean technology that delivers low overhead and near-native performance.</div>
</li>
<li>
<div style="text-align: justify"><a href="http://www.oracle.com/technologies/virtualization/index.html" target="_blank">Oracle VM</a> : Oracle VM is based on the open-source Xen hypervisor technology, supports both Windows and Linux guests and includes an integrated Web browser based management console. Oracle VM features fully tested and certified Oracle Applications stack in an enterprise virtualization environment.</div>
</li>
<li>
<div style="text-align: justify"><a href="http://www.sun.com/software/products/xvm/index.jsp" target="_blank">Sun xVM</a> : The xVM Server uses a bare-metal hypervisor based on the open source Xen under a Solaris environment on x86-64 systems. On SPARC systems, xVM is based on Sun&#8217;s Logical Domains and Solaris. Sun plans to support Microsoft Windows (on x86-64 systems only), Linux, and Solaris as guest operating systems.</div>
</li>
</ul>
</li>
<li>
<div style="text-align: justify"><a href="http://www.parallels.com/" target="_blank">Parallels Virtuozzo Containers</a> &#8211; It is an operating system-level virtualization product designed for large-scale homegenous server environments and data centers. Parallels Virtuozzo Containers is compatible with x86, x86-64 and IA-64 platforms. You can run various Linux distributions inside Parallels Virtuozzo Containers.</div>
</li>
</ul>
<p style="text-align: justify">Personally, I&#8217;ve used VMware ESX / Server and VirtualBox.</p>
<p style="text-align: justify">&nbsp;</p>
<p style="text-align: justify"><span style="text-decoration: underline"><strong>METHODS FOR MIGRATION OF VM&#8217;S IN LINUX HOST TO WINDOWS HOST<br />
</strong></span></p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">In Linux the virtualization tool used can be one of the above mentioned. Let us take the case of VIRTUAL BOX. The guest in VBOX will have an extension &#8220;.vdi&#8221; and in WINDOWS HYPER-V it will be &#8220;.vhd&#8221;. The steps for converting .vdi to .vhd are given below:<br />
</span></p>
<p style="text-align: justify">&nbsp;</p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">There are times when you use Virtualbox and for some reason need to convert over to VMWare or Hyper-V (or other).<br />
</span></p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Finding this process on the Internet is tedious, and usually involves using QEMU, an open-source Virtualization product to perform the .raw &#8211;&gt; .vmdk step. However, if you are running on Windows, the QEMU Windows port will not perform the conversion without failure (at least on Windows 7!). So with that, I decided to go another route with a handy tool that I&#8217;ve used for years in some variation or another, WinImage.<br />
</span></p>
<p style="text-align: justify">&nbsp;</p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Tools you&#8217;ll need:<br />
</span></p>
<p><span style="font-family: Times New Roman;font-size: 12pt">. Sun VirtualBox &#8211; <a href="http://www.virtualbox.org">http://www.virtualbox.org</a>. WinImage (Shareware) &#8211; <a href="http://www.winimage.com">http://www.winimage.com</a></p>
<p></span></p>
<p style="text-align: justify">&nbsp;</p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Requirements:<br />
</span></p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Free disk space should be around 2 times the size of the .vdi disk image file size.<br />
</span></p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">For the sake of this document, we will use .vmdk as our output file, but the conversion steps are the same when it comes to .vhd.<br />
</span></p>
<p style="text-align: justify">&nbsp;</p>
<div>
<table style="border-collapse: collapse" border="0">
<col style="width: 624px"></col>
<col style="width: 2px"></col>
<tbody>
<tr>
<td style="padding: 1px" colspan="2" valign="middle">
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt"><strong>Convert the .vdi file to a raw disk image (.raw)<br />
</strong></span></p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Perform a search on your system for existing .vdi files that you are going to convert.<br />
</span></p>
<p style="text-align: justify">&nbsp;</p>
<ol style="margin-left: 72pt">
<li>
<div style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Go to a cmd prompt and navigate to the VirtualBox folder (typically c:\program files\sun\VirtualBox).<br />
</span></div>
</li>
<li>
<div style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">. Execute the following command against the .vdi file in question:<br />
</span></div>
</li>
</ol>
<p style="text-align: justify">&nbsp;</p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">vboxmanage.exe internalcommands converttoraw &#8220;x\path-to-vdi\diskimage.vdi&#8221; &#8220;x:\path-to-output-folder\diskimage.raw&#8221;<br />
</span></p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Depending on the size of your .vdi file, the time for conversion may greatly vary. Also, be sure you have around 2 times the available drive space that your existing .vdi currently consumes on your logical volume.<br />
</span></p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">i.e. if you have a 16gb .vdi file, just to be safe, I would make sure you have 32Gb free on your physical disk to ensure the conversion process can complete without errors. Usually you won&#8217;t need this much, but it is good to be safe. </span></p>
</td>
<td style="padding: 1px" valign="middle"></td>
</tr>
</tbody>
</table>
</div>
<p style="text-align: justify">&nbsp;</p>
<p style="text-align: justify"><img src="http://www.sparksupport.com/blog/wp-content/uploads/2011/09/091411_1834_LINUXVIRTUL1.png" alt="" /><span style="font-family: Times New Roman;font-size: 12pt"><br />
</span></p>
<p style="text-align: justify">&nbsp;</p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt"><strong>Convert .raw disk image to .vmdk format using WinImage<br />
</strong></span></p>
<p style="text-align: justify">&nbsp;</p>
<ul style="margin-left: 72pt">
<li>
<div style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Open WinImage, click on &#8216;Disk&#8217;&gt; &#8216;Convert Virtual Hard Disk image&#8230;&#8217;<br />
</span></div>
</li>
<li>
<div style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Next to the &#8216;File name:&#8217; field, click on the file type drop-down and select &#8216;All files (*.*)&#8217;.<br />
</span></div>
</li>
<li>
<div style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Navigate to the location where you stored your outputted .raw disk file and double-click it.<br />
</span></div>
</li>
<li>
<div style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Choose whether you wish to &#8216;Create Fixed Size Virtual Hard Disk&#8217; or &#8216;Create Dynamically Expanding Virtual Hard Disk&#8217; (I typically pick the latter) and click &#8216;OK&#8217;.<br />
</span></div>
</li>
<li>
<div style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Navigate to a folder where you wish to store the newly converted image to. Next to &#8216;Save as type:&#8217; (for the sake of this How-to) choose &#8216;VMWare VMDK (*.vmdk). and click &#8216;Save&#8217;.You should see a &#8216;Reading disk&#8217; progress indicator giving you the status of the conversion process. I&#8217;ve converted 30Gb images in about 10 minutes or less&#8230;but I have no firm numbers.<br />
</span></div>
</li>
<li>
<div style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Once the conversion is complete, you&#8217;ll see a dialog box that will ask you if you wish to connect to the partition. Click &#8216;OK&#8217; if you wish to view the content.<br />
</span></div>
</li>
</ul>
<p style="text-align: justify">&nbsp;</p>
<p style="text-align: justify"><img src="http://www.sparksupport.com/blog/wp-content/uploads/2011/09/091411_1834_LINUXVIRTUL2.png" alt="" /><span style="font-family: Times New Roman;font-size: 12pt"><br />
</span></p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt"><strong>Import your disk images into your existing Virtual Infrastructure<br />
</strong></span></p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Now that the files are converted, copy or move your converted disk image files to your virtualization software&#8217;s datastore/disk storage folder.<br />
</span></p>
<p style="text-align: justify">&nbsp;</p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Once moved/copied, you should now be able to create a new Virtual Machine and utilize the disks you just converted.<br />
</span></p>
<p style="text-align: justify">&nbsp;</p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Note that you will need to install the proper guest additions/tools to the virtual machine when you get it booted, so you will likely not have network access right off the bat.<br />
</span></p>
<p style="text-align: justify">&nbsp;</p>
<p style="text-align: justify"><a href="/how_to/show/1152"><span style="font-family: Times New Roman;font-size: 12pt">Conclusion</span></a><span style="font-family: Times New Roman;font-size: 12pt"><strong><br />
</strong></span></p>
<p style="text-align: justify"><span style="font-family: Times New Roman;font-size: 12pt">Indeed, that was a quick How-to, but it&#8217;s an important process that gets easily overlooked. The WinImage step makes quick work of converting the .raw image&#8230;and it is easy!<br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sparksupport.com/blog/linux-virtulization-and-migration-of-vm%e2%80%99s-in-linux-host-to-windows-host/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trac Installation on centOS</title>
		<link>http://www.sparksupport.com/blog/trac-installation-on-centos</link>
		<comments>http://www.sparksupport.com/blog/trac-installation-on-centos#comments</comments>
		<pubDate>Fri, 26 Aug 2011 08:07:37 +0000</pubDate>
		<dc:creator>priyans</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.sparksupport.com/blog/?p=1204</guid>
		<description><![CDATA[A.Dependencies 1.Basic 1.1.Python 2.5 or higher 1.2.Setup tools 1.3.Genshi 1.4.sqlite database Note:- 1.1.Python2.4 is already installed with centOS.It does not support full swing operation of Trac.So install &#8220;virtualenv&#8221; python tool.Get the tar ball from  http://pypi.python.org/pypi/virtualenv.Just untar it,get into the directory and do #python setup.py install Now it&#8217;ll be installed(Python2.7 will be automatically installed with it)!Then [...]]]></description>
			<content:encoded><![CDATA[<p><strong>A.Dependencies</strong><br />
<strong>1</strong>.Basic<br />
1.1.Python 2.5 or higher<br />
1.2.Setup tools<br />
1.3.Genshi<br />
1.4.sqlite database<br />
<strong>Note:-</strong><br />
1.1.Python2.4  is already  installed with centOS.It does not support full swing  operation of  Trac.So install &#8220;virtualenv&#8221; python tool.Get the tar ball  from  <strong><a href="http://pypi.python.org/pypi/virtualenv" target="_blank">http://pypi.python.org/pypi/virtualenv</a></strong>.Just untar it,get into the directory and do</p>
<pre class="brush: bash;"> #python setup.py install </pre>
<p>Now it&#8217;ll be installed(Python2.7 will be automatically installed with it)!Then create an environment by</p>
<pre class="brush: bash;">#python virtualenv.py ENV</pre>
<pre class="brush: bash;">#virtualenv ENV</pre>
<p>Done!!!</p>
<p><strong>Note</strong>:-Now new binaries will be available under &#8216;<strong>/root/ENV/bin</strong>&#8216;. We&#8217;re going to use commands from this directory for further.</p>
<p>Activate the new virtual environment by</p>
<pre class="brush: bash;">#source ./ENV/bin/activate</pre>
<p>(Here ENV is the virtual environment)</p>
<p>From  now onwards,it&#8217;ll take commands from virtual environment itself if  available! Otherwise it will go for default system binaries! If you want to return  to the real environment, trigger</p>
<pre class="brush: bash;">#deactivate</pre>
<p>1.2.Setup tools<br />
This will be installed automatically along the installation of &#8216;virtualenv&#8217;.<br />
1.3.Install Genshi by</p>
<pre class="brush: bash;">#easy_install Genshi</pre>
<p>1.4.Sqlite can be installed using &#8216;yum&#8217;.Install &#8216;devel&#8217; for sqlite also!</p>
<p><strong>2</strong>.mod_wsgi module for apache<br />
For compiling mod_wsgi with apache,simply follow the instructions given in: <strong><a href="http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide" target="_blank">http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide</a></strong></p>
<p><strong>B.Installing Trac</strong></p>
<pre class="brush: bash;">#easy_install Babel==0.9.5
#easy_install Trac
#easy_install -U Trac
#easy_install -U Trac==dev</pre>
<p><strong>C.Creating a project environment</strong></p>
<p><strong>1</strong>.Before  you proceed,create a directory for keeping trac project files under a  directory accessible to apache.(Here default path is used)</p>
<pre class="brush: bash;">#mkdir /var/www/trac</pre>
<p>Now make sure apache user can access all the directories and files under &#8216;trac&#8217;</p>
<pre class="brush: bash;">#chown -R apache.apache /var/www/trac</pre>
<p><strong>2</strong>.Create an environment</p>
<pre class="brush: bash;">#trac-admin /var/www/myproject initenv</pre>
<p>Enter  the name of project and database when you are prompted for. Leave  database name as default if you wish to use the default database!</p>
<p><strong>D.Deploying Trac</strong></p>
<pre class="brush: bash;">#tracd --port 8000 /var/www/trac/myproject</pre>
<p>(include &#8216;-s&#8217; for single instance)</p>
<p>Now open browser and go to : http://localhost:8000 . Trac web-based interface will be appeared!</p>
<p><strong>E.Granting admin rights to admin user</strong></p>
<pre class="brush: bash;">#trac-admin /var/www/myproject permission add admin TRAC_ADMIN</pre>
<p><strong>Warning</strong>:-  If you failed to activate virtual environment as described under  section A-1.1, you will need to specify path for all the commands  (For eg:/root/ENV/bin easy_install) and you may encounter an error &#8220;   File &#8220;/usr/lib/python2.4/site-packages/_xmlplus/parsers/expat.py&#8221;, line  4, in &lt;module&gt; from pyexpat import * ImportError:  /usr/lib/python2.4/site-packages/_xmlplus/parsers/pyexpat.so: undefined  symbol: PyUnicodeUCS4_Decode&#8221;. &#8220;.</p>
<p>For resolving this,trigger</p>
<pre class="brush: bash;">#export  PYTHONPATH=/path/to/lib/python2.7/site-packages/</pre>
<p>on each shell or edit files like /etc/profile or /etc/bashrc etc to take a permanent effect. But,this is not recommended and you should activate the virtual environment instead (<em>see</em> A-1.1) to avoid this scenario!!  Happy doing <img src='http://www.sparksupport.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sparksupport.com/blog/trac-installation-on-centos/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>device-mapper: remove ioctl failed: Device or resource busy</title>
		<link>http://www.sparksupport.com/blog/device-mapper-remove-ioctl-failed-device-or-resource-busy</link>
		<comments>http://www.sparksupport.com/blog/device-mapper-remove-ioctl-failed-device-or-resource-busy#comments</comments>
		<pubDate>Tue, 12 Jul 2011 13:43:10 +0000</pubDate>
		<dc:creator>Shijil T S</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[dmsetup lvremove ioctl failed]]></category>

		<guid isPermaLink="false">http://www.sparksupport.com/blog/?p=1195</guid>
		<description><![CDATA[I have jumped into this strange problem when I tried to remove a logical volume. Things would have been easy if I had used lsof command The logical volume was named /dev/lvols/ubuntu64 At first $lvremove /dev/lvols/ubuntu64 This command couldn&#8217;t remove the logical volume the next command I tried was root@manager-desktop:~# dmsetup remove --force /dev/lvols/ubuntu64 device-mapper: [...]]]></description>
			<content:encoded><![CDATA[<p>I have jumped into this strange problem when I tried to remove a logical volume.</p>
<p>Things would have been easy if I had used lsof command</p>
<p>The logical volume was named /dev/lvols/ubuntu64</p>
<p>At first</p>
<pre class="brush: bash;">

$lvremove /dev/lvols/ubuntu64
</pre>
<p>This command couldn&#8217;t remove the logical volume the next command I tried was</p>
<pre class="brush: bash;">

root@manager-desktop:~# dmsetup remove --force /dev/lvols/ubuntu64
device-mapper: remove ioctl failed: Device or resource busy
Command failed
</pre>
<p>So some process is using this logical volume and to find the process id the next command was</p>
<pre class="brush: bash;">

root@manager-desktop:~# lsof /dev/lvols/ubuntu64
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
vblade  31213 root    3u   BLK  252,4      0t0 115749 /dev/lvols/../mapper/lvols-ubuntu64
</pre>
<pre class="brush: bash;">

root@manager-desktop:~# kill -9 31213
</pre>
<p>Now issued the commands</p>
<pre class="brush: bash;">

root@manager-desktop:~# dmsetup remove --force /dev/lvols/ubuntu64

root@manager-desktop:~# lvremove /dev/lvols/ubuntu64
 Logical volume &quot;ubuntu64&quot; successfully removed
</pre>
<p>Voila.. simple fix and point to remember is never forget lsof command <img src='http://www.sparksupport.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sparksupport.com/blog/device-mapper-remove-ioctl-failed-device-or-resource-busy/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>We are hiring BTech/BE 2010, 2011 passed out candidates for our Technical Support and Development divisions</title>
		<link>http://www.sparksupport.com/blog/we-are-hiring-btechbe-2010-2011-passed-out-candidates-for-our-technical-support-and-development-divisions</link>
		<comments>http://www.sparksupport.com/blog/we-are-hiring-btechbe-2010-2011-passed-out-candidates-for-our-technical-support-and-development-divisions#comments</comments>
		<pubDate>Wed, 16 Mar 2011 09:17:46 +0000</pubDate>
		<dc:creator>Nisha Ajil</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Recruitment]]></category>

		<guid isPermaLink="false">http://www.sparksupport.com/blog/?p=1187</guid>
		<description><![CDATA[Description: We are looking for  BE/Btech freshers from IT, CSE ,EEE, EC branches for our Development and Technical Support wings. Proactive candidates with exceptional coding skills. The candidate must be capable of quickly learning new technologies and capable of working on applications deployed in distributed environment. Basic knowledge of Linux platform , Perl, PHP  will [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Description:</strong></p>
<p>We are looking for  BE/Btech freshers from IT, CSE ,EEE, EC branches  for our Development and Technical Support wings. Proactive candidates with  exceptional  coding skills. The candidate must be capable of quickly  learning new  technologies and capable of working on applications  deployed in distributed environment. Basic knowledge of Linux platform ,  Perl, PHP  will be a plus.</p>
<p><strong>Eligibility Criteria:</strong></p>
<ul>
<li> BTech/ BE &#8211; CSE, ECE , IT, EEE( 60%above final results and should  not have any back papers )</li>
<li>Excellent programming skills ( C, C++) .Basic knowledge of PHP/ Perl/Python  will be a plus. RHCE certified candidates for Technical Support wing.</li>
<li>Consistent academic record</li>
<li>Proactive attitude</li>
<li>Good written and oral communication.</li>
<li>Should be a self starter and must be willing to work on complicated   tasks.</li>
<li>A quick learner.</li>
<li>Familiarity with software development process .</li>
</ul>
<p><strong>Selection procedure:</strong></p>
<ul>
<li> Written Test ( Technical and Aptitude &#8211; objective type )</li>
<li>Technical Interview</li>
<li>Practical test .</li>
<li>HR Round</li>
</ul>
<p><strong>Terms:</strong></p>
<ul>
<li> 6 months on job training period</li>
<li> flat hierarchy</li>
<li> ample opportunities to grow</li>
<li> opportunity to grow with a fast growing  organization</li>
</ul>
<div><strong> </strong></div>
<p><strong>How to apply:</strong></p>
<p>Send your resumes to careers[at] sparksupport[dot]com with a covering   letter and subject line <strong>BTech Freshers</strong> .The openings are  immediate and the candidates should be ready to join  ASAP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sparksupport.com/blog/we-are-hiring-btechbe-2010-2011-passed-out-candidates-for-our-technical-support-and-development-divisions/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sphinx search server</title>
		<link>http://www.sparksupport.com/blog/sphinx-search-server</link>
		<comments>http://www.sparksupport.com/blog/sphinx-search-server#comments</comments>
		<pubDate>Wed, 02 Mar 2011 16:35:44 +0000</pubDate>
		<dc:creator>Tino Thomas</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.sparksupport.com/blog/?p=1161</guid>
		<description><![CDATA[Sphinx is an open source search engine designed to search text extremely quickly. It can be included in your programs to provide custom search functionality. In this document I am trying to explain you how to set it up in a linux machine and how php programs, that use mysql database, can call the sphinx [...]]]></description>
			<content:encoded><![CDATA[<p>Sphinx is an open source search engine designed to search text extremely  quickly. It can be included in your programs to provide custom search functionality. In this document I  am trying to explain you how to set it up in a linux machine and how  php programs, that use mysql database, can call the sphinx search engine  to provide custom search feature. So let us start with the  installation part.</p>
<p>Download and extract the tarball of sphinx</p>
<pre class="brush: bash;">

$ tar xzvf sphinx-0.9.8.tar.gz
$ cd sphinx
</pre>
<p>Run the configuration program:</p>
<pre class="brush: bash;">

$ ./configure
</pre>
<p>We can specify the location where sphinx should be installed by using &#8211;prefix option.<br />
Build the binaries.</p>
<pre class="brush: bash;">

$ make
</pre>
<p>Install the binaries.</p>
<pre class="brush: bash;">
$ make install
</pre>
<p>By  default, Sphinx utilities are installed in /usr/local/bin/. Sphinx has  three components: an index generator, a search engine, and a  command-line search utility: The index generator is called indexer. It queries your database, indexes each column in each row of the result, and ties each index entry to the row&#8217;s primary key. The search engine is a daemon called searchd.  The daemon receives search terms and other parameters, scours one or  more indices, and returns a result. If a match is made, searchd returns  an array of primary keys. Given those keys, an application can run a  query against the associated database to find the complete records that  comprise the match. Searchd communicates to applications through a  socket connection on port 3312. The handy search  utility lets you conduct searches from the command line without writing  code. If searchd returns a match, search queries the database and  displays the rows in the match set. The search utility is useful for  debugging your Sphinx configuration.</p>
<p>To  use Sphinx, you will need to create a configuration file. Default  configuration file name is sphinx.conf. All Sphinx programs look for  this file in current working directory by default. Sample  configuration file, sphinx.conf.dist, which has all the options  documented, is created by configure. Copy and edit that sample file to  make your own configuration.</p>
<pre class="brush: bash;">
$ cd /usr/local/etc
$ cp sphinx.conf.dist sphinx.conf
</pre>
<p>To start with sphinx, you must define one or more sources and one or more indexes. A  source identifies the database to index, provides authentication  information, and defines the query to use to construct each row. An  index requires a source (that is, a set of rows) and defines how the  data extracted from the source should be cataloged. You define your  source(s) and index(es) in the sphinx.conf file. Sample configuration file is setup to index documents table from Mysql database test. So there&#8217;s example.sql sample data file to populate that table with a few documents for testing purposes.</p>
<pre class="brush: bash;">

$ mysql -u test &lt; /usr/local/sphinx/etc/example.sql
</pre>
<p>We need to specify database information in configuration file like the following.<strong> </strong><strong> </strong><strong><br />
</strong></p>
<pre class="brush: bash;">

source src1
{
# data source type. mandatory, no default value
# known types are mysql, pgsql, mssql, xmlpipe, xmlpipe2, odbc
type                                    = mysql

#####################################################################
## SQL settings (for 'mysql' and 'pgsql' types)
#####################################################################

# some straightforward parameters for SQL source types
sql_host                                = localhost
sql_user                                = test
sql_pass                                = test
sql_db                                  = test
sql_port                                = 3306  # optional, default is 3306
</pre>
<p>Next,  create a query to produce rows to be indexed. The sql_query must  include the primary key you want to use for subsequent lookups, and it  must include all the fields you want to index and use as groups. It is  specified in the configuration file as the following.</p>
<pre class="brush: bash;">
sql_query                               = \
SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, title, content \
FROM documents
</pre>
<p>And  the search utility uses sql_query_info to find the records that match.  In the query, $id is replaced with each primary key that searchd  returns.</p>
<pre class="brush: bash;">
sql_query_info          = SELECT * FROM documents WHERE id=$id
</pre>
<p>Next we need to build an index.</p>
<pre class="brush: bash;">
index test1
{
# document source(s) to index
source= src1
# index files path and file name, without extension
# mandatory, path must be writable, extensions will be auto-appended
path                    = /var/test1
}
</pre>
<p>Here source is src1 and path defines  where to store the index data. You have to make sure that this directory exists  before generating the index. The searchd section at bottom configures the searchd daemon itself.</p>
<pre class="brush: bash;">
searchd
{
port                = 3312
log                    = /var/log/searchd/searchd.log
query_log            = /var/log/searchd/query.log
pid_file            = /var/log/searchd/searchd.pid
}
</pre>
<p>We  are now ready to build the index for the database table. Before running  indexer program to generate indices you have to make sure that mysql  program is running.</p>
<pre class="brush: bash;">
$/usr/local/bin/indexer --config /usr/local/etc/sphinx.conf --all
Sphinx 0.9.9-release (r2117)
Copyright (c) 2001-2009, Andrew Aksyonoff
using config file '/usr/local/etc/sphinx.conf'...
indexing index 'test1'...
collected 6 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 6 docs, 243 bytes
total 0.018 sec, 12926 bytes/sec, 319.16 docs/sec
</pre>
<p>The  -all argument rebuilds all the indexes listed in sphinx.conf. You can  use a different argument to rebuild fewer if you don&#8217;t need to rebuild  every index.</p>
<p>You can now test the index with the search utility</p>
<pre class="brush: bash;">
# /usr/local/bin/search --config /usr/local/etc/sphinx.conf spark
Sphinx 0.9.9-release (r2117)
Copyright (c) 2001-2009, Andrew Aksyonoff

using config file '/usr/local/etc/sphinx.conf'...
index 'test1': query 'spark ': returned 2 matches of 2 total in 0.006 sec

displaying matches:
1. document=5, weight=2, group_id=2, date_added=Sun Feb 13 11:50:30 2011
id=5
group_id=2
group_id2=9
date_added=2011-02-13 11:50:30
title=spark
content=spark support
2. document=6, weight=2, group_id=2, date_added=Sun Feb 13 11:53:30 2011
id=6
group_id=2
group_id2=10
date_added=2011-02-13 11:53:30
title=spark cochin
content=spark support cochin
</pre>
<p>To query the index from your PHP scripts, you need to run the search daemon which your script will talk to and Include the API (it&#8217;s located in api/sphinxapi.php) into your own scripts and use it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sparksupport.com/blog/sphinx-search-server/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying with Capistrano</title>
		<link>http://www.sparksupport.com/blog/deploying-with-capistrano</link>
		<comments>http://www.sparksupport.com/blog/deploying-with-capistrano#comments</comments>
		<pubDate>Tue, 21 Dec 2010 05:43:19 +0000</pubDate>
		<dc:creator>Jaseer</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[configure]]></category>
		<category><![CDATA[deploying with capistrano]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[howto capistrano]]></category>

		<guid isPermaLink="false">http://www.sparksupport.com/blog/?p=1124</guid>
		<description><![CDATA[What is Capisrano? Capistrano is a deployment tool and is popularly used for deploying rails applications to your servers. But its a good configuration tool too. You can setup your servers using capistrano. You can preform tasks like adding users, installing and configuring packages like apache, mysql or postfix, a xen vm etc on your [...]]]></description>
			<content:encoded><![CDATA[<h2><strong>What is Capisrano?</strong></h2>
<p>Capistrano is a deployment tool and is popularly used for deploying rails applications to your servers. But its a good configuration tool too. You can setup your servers using capistrano. You can preform tasks like adding users, installing and configuring packages like apache, mysql or postfix, a xen vm etc on your desired network host from a central server(wherever you kept the configuration repository).</p>
<h2>Puppet and Capistrano?</h2>
<p>Well., you might have heard about puppet &#8211; another popular network host configuration tool. Great..Now it will be easy to understand capistrano. If you haven&#8217;t, dont worry, I will make it clear for you.</p>
<p>The puppet is working in such a way that a puppet server will be running on one host in the nerwork. And all the desired hosts would run a puppet client daemon. You can configure your client manully and can automate installation on your clients. Whenever you want to change the configuration just do it on the server. It will be updated to the client as the client puppet daemons updates from the server in each interval that you specify. Now you would note that the client daemon pulls the configuration from puppet server. But in capistrano the user pushes the configuration to the desired client when he needs it. Puppet uses &#8220;meta language&#8221; for the configurations. Whereas capistrano uses ruby. And you know that you got several modules and feautres with ruby and so you may can write your additions to cap if you are well versed with that. One more thing you should note that puppet does its dependency resolution automatically, but in capistrano, you may have to handle the dependency manually in some cases. But as I said earlier you can overcome this if you know well and I would say it may be little difficult to go to that extent. But when you have done with a perfect configuration you feel it greatly helpful.</p>
<h2><strong>Installation and Configuration</strong></h2>
<p>To install just enter the command:</p>
<blockquote><p>$gem install capistrano</p></blockquote>
<p>Provided you have rubygems installed on your machine. If not, install it with apt or yum.</p>
<blockquote><p>$gem install deprec</p></blockquote>
<p>Note: I have found several docs without mentioning this..and it made my cap commands haden&#8217;t worked till I found this and installed..</p>
<p>Now create a repository as the source (central configuration repo) using svn. Svn is common version control system that is used in cordination with the cap. If you like git go with that.</p>
<blockquote><p>$svnadmin create sparkconf</p></blockquote>
<p>Sparkconf is the repository name where you will keep all the configuration of your servers. You can use your own repository name.</p>
<p>Configure this repo for access to the desired users. I wont go with svn details because its beyond the context of our topic.</p>
<p>now you can checkout your repo</p>
<blockquote><p>$svn co &lt;ur-repo-ulr&gt; sparkconf<br />
$cd sparkconf<br />
$capify .</p></blockquote>
<p>This &#8220;capify&#8221; command will initiate your cap repo. It will create a file named Capfile and a deploy.rb file in a directory named config. In capfile you can see that there is a statement to load deploy.rb file. So you can define your own tasks in Capfile or in deploy.rb. But usually this is not the convention. You would leave your Capfile without any changes. And you may specify some information about your setting in the deploy.rb file. The sample deploy.rb which is generated automatically, needs some explanation.</p>
<pre class="brush: ruby;">&lt;br /&gt;
set :application, &amp;quot;agileblazeworks&amp;quot;&lt;br /&gt;
set :repository,  &amp;quot;report&amp;quot;&lt;/p&gt;
&lt;p&gt;set :scm, :subversion&lt;br /&gt;
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`&lt;/p&gt;
&lt;p&gt;role :web, &amp;quot;rails.spark.com&amp;quot;                                 # Your HTTP server, Apache/etc&lt;br /&gt;
role :app, &amp;quot;rails.spark.com&amp;quot;                                 # This may be the same as your `Web` server&lt;br /&gt;
role :db,  &amp;quot;rails.spark.com&amp;quot;, :primary = true    # This is where Rails migrations will run&lt;br /&gt;
#role :db,  &amp;quot;your slave db-server here&amp;quot;&lt;/p&gt;
&lt;p&gt;# If you are using Passenger mod_rails uncomment this:&lt;br /&gt;
# if you're still using the script/reapear helper you will need&lt;br /&gt;
# these http://github.com/rails/irs_process_scripts&lt;/p&gt;
&lt;p&gt;# namespace :deploy do&lt;br /&gt;
#   task :start do ; end&lt;br /&gt;
#   task :stop do ; end&lt;br /&gt;
#   task :restart, :roles =&amp;amp;gt; :app, :except =&amp;amp;gt; { :no_release =&amp;amp;gt; true } do&lt;br /&gt;
#     run &amp;quot;#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}&amp;quot;&lt;br /&gt;
#   end&lt;br /&gt;
# end&lt;br /&gt;
</pre>
<p>Dont worry about the configuration here. Most of them are needed if you are deploying a rails application for a web server. After breifing this we will go for some other configuration options that you are really looking for&#8230;to install and configure packages on your hosts.</p>
<p>If your application (means your rails application) is not separated into application, web and database servers, you can either set them to be the same value; or comment out, or remove the one you do not require. The &#8220;:primary =&gt; true&#8221; part of the role definitions allows you to have more than one database server. If you dont have two skipp this primary option. If, for example when deploying a Rails application you only wanted db1 to run migrations, in the first example both might. Essentially when using the Rails deployment recipes, the :primary option defines where database migrations are run. Similar attributes include :no_release often used for the :web role by some of the recipes in circulation to decide which servers should not have the code checked out to them. Attributes like these are arbitrary and you can define some of your own, and use them to filter more precisely where your own tasks run.</p>
<p>You may add these options to the deploy.rb file</p>
<pre class="brush: ruby;">&lt;br /&gt;
set :user, 'jaseer'              #This is the user you have on the target machine. Capistrano try to login to the target machine using this account.&lt;br /&gt;
ssh_options[:keys] = %w(/home/users/mylocalname/.ssh/jas_rsa)&lt;br /&gt;
set :use_sudo, true            #if you want to append all commands with sudo.&lt;br /&gt;
set :password, &amp;quot;yourpassword&amp;quot;      #You can login using key (above) or with password. Use either key or password..not both.&lt;/p&gt;
&lt;p&gt;default_run_options[:pty] = true #this is really helpful. If you dont have this you will struggle in runnig sudo tasks. I had lost some time searching around this.&lt;br /&gt;
</pre>
<h2><strong>Some cap commands<br />
</strong></h2>
<blockquote><p>$ cap -h</p></blockquote>
<p>This will give out a list of all the options it accepts.</p>
<blockquote><p>$ cap -H</p></blockquote>
<p>It will give you a description of each option.</p>
<p>Next, let’s ask Capistrano what all tasks it will do. Capistrano comes bundled with several built-in tasks. You can also write your own to automate workflows of your own. For now, let’s see what tasks Capistrano knows:</p>
<blockquote><p>$ cap -T</p></blockquote>
<p>And finally, to get a detailed description of a command, type</p>
<blockquote><p>$cap -e &lt;task&gt;</p></blockquote>
<h2>Example</h2>
<p>Suppose you want install and configure nagios on one of your servers.</p>
<blockquote><p>cap deprec:nagios:install HOSTS=monitor.spark.com</p></blockquote>
<blockquote><p>This command will install nagios on the host monitor.blocksglobal.com (You can use ip also). Iif you want to override the user in deploy.rb, or any other files, use the option USER=&lt;username&gt; option. This will ask your sudo password, as you know for some task you may need the administrator privileges.</p></blockquote>
<p>Now generate configuration files</p>
<blockquote><p>#cap deprec:nagios:config_gen</p></blockquote>
<p>The configuration files are created in your localrepo not in the installed server. A directry tree is created under sparkconf/config/  with the name nagios. It will contain all configuration files of nagios like hosts.cfg, service.cfg etc. You can change each  according to your needs. Update svn. Push those configuration to your client.</p>
<blockquote><p>$cd config/nagios</p></blockquote>
<p>Change and configure the files as your needs, commit the changes and update svn. Go back to the root of your repository, here it is sparkconf. Now push the config to your nagios server.</p>
<blockquote><p>$cap deprec:nagios:config HOSTS=monitor.spark.com</p></blockquote>
<h2>Defining Tasks</h2>
<p>Now let me explain how to define tasks. Often I would define my own tasks in config/*/recipes.rb for example config/nagios/recipes.rb.  * Can be any thing like postfix, mysql as you generate the config directory for them using config_gen.</p>
<pre class="brush: ruby;">&lt;br /&gt;
namespace : one do&lt;br /&gt;
 task :default do&lt;br /&gt;
    test&lt;br /&gt;
    one.test&lt;br /&gt;
    two.test&lt;br /&gt;
  end&lt;br /&gt;
  task :test do&lt;br /&gt;
    puts &amp;quot;Test One Successful!&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
namespace :two do&lt;br /&gt;
  task :test do&lt;br /&gt;
    puts &amp;quot;Test Two Successful&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
</pre>
<p>Here these are the available commands I can use with cap&#8230;</p>
<blockquote><p>$cap one<br />
$cap one:default<br />
$cap one:test<br />
$cap two</p></blockquote>
<p>Hope you understood how to define them. Note in how many ways I called the task &#8220;test&#8221; inside the task default. This is easy right? Now go, create your repo and try your cap tasks..I will stop with a final simple example:</p>
<pre class="brush: ruby;">&lt;br /&gt;
task :backup_database, :roles =&amp;gt; :db, : only =&amp;gt; { :backup =&amp;gt; true } do&lt;br /&gt;
 run &amp;quot;#{sudo} mysqldump ... &amp;gt; /tmp/backup.sql&amp;quot;&lt;br /&gt;
 run &amp;quot;#{sudo} bzip2 /tmp/backup.sql&amp;quot;&lt;br /&gt;
 run &amp;quot;scp /tmp/backup.sql.bz2 offsite.host:/u/backups&amp;quot;&lt;br /&gt;
 run &amp;quot;#{sudo} rm /tmp/backup.sql.bz2&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
</pre>
<p>Next time I will write one more article on deploying rails app using cap.. Have fun..bye</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sparksupport.com/blog/deploying-with-capistrano/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xen Bridge Networking</title>
		<link>http://www.sparksupport.com/blog/xen-bridging</link>
		<comments>http://www.sparksupport.com/blog/xen-bridging#comments</comments>
		<pubDate>Sun, 19 Dec 2010 13:11:05 +0000</pubDate>
		<dc:creator>Tino Thomas</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[bridged networking]]></category>
		<category><![CDATA[bridging in xen]]></category>
		<category><![CDATA[virtual ethernet interfaces]]></category>
		<category><![CDATA[xen bridge]]></category>
		<category><![CDATA[xen bridging]]></category>
		<category><![CDATA[xen bridging explained]]></category>
		<category><![CDATA[xen network bridge]]></category>
		<category><![CDATA[xen networking]]></category>
		<category><![CDATA[xen networking explained]]></category>
		<category><![CDATA[xen virtual networks]]></category>

		<guid isPermaLink="false">http://www.sparksupport.com/blog/?p=1062</guid>
		<description><![CDATA[Xen provides couple of different networking options like bridge networking, nat networking and route networking. Bridging is a technique used for connecting different network segments. It is the default option for Xen networking as it simply connects all the virtual machines to the outside world through virtual network interfaces connected to the bridges created by [...]]]></description>
			<content:encoded><![CDATA[<p>Xen provides couple of different networking options like bridge networking, nat networking and route networking. Bridging is a technique used for connecting different network segments. It is the default option for Xen networking as it simply connects all the virtual machines to the outside world through virtual network interfaces connected to the bridges created by Xen. When using bridged networking, Xen creates a network bridge and then connects the actual physical network interface to this bridge. Virtual network interfaces are then created for dom0 and each of the guest domains; these are all attached to the network bridge. In this manner, all the domains can connect to any address to which the physical network interface can connect.</p>
<p>In the Xend configuration file /etc/xen/xend-config.sxp, the default directives related to the virtual network are shown below. Notice that the network-bridge and vif-bridge lines are the only ones uncommented. These are the lines needed for bridged networking.</p>
<pre class="brush: bash;">

(network-script network-bridge)
(vif-script vif-bridge)
# (network-script network-route)
# (vif-script vif-route)
# (network-script network-nat)
# (vif-script vif-nat)
</pre>
<p>The network script network-bridge is in the directory /etc/xen/scripts. It sets up the networking environment and uses the bridge-utils tool to set up the software bridge xenbr0. The vif script vif-bridge is also in the same directory as the network script. It sets up the backend vif for the guest domain when a guest domain boots up.</p>
<p>Before creating any guest domains if you check the network interfaces in Dom0 by typing &#8216;ifconfig&#8217; command, you can see an output like the following.</p>
<pre>[root@localhost xen]# ifconfig
<strong>eth0</strong>   Link encap:Ethernet  HWaddr 48:5B:39:89:E5:43
       inet addr:192.168.1.86  Bcast:192.168.1.255 Mask:255.255.255.0
<strong>lo </strong>    Link encap:Local Loopback
       inet addr:127.0.0.1  Mask:255.0.0.0
<strong>peth0</strong>  Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
       inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
<strong>vif0.0</strong> Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
       inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
<strong>xenbr0</strong> Link encap:Ethernet  HWaddr B2:8B:2C:4C:ED:0E
       UP BROADCAST RUNNING NOARP  MTU:1500 Metric:1
</pre>
<p>You may be wondering how and when all these network interfaces are created. Here is the sequence of events that happen when you boot up your Xen server and xend starts up (only dom0 is started and no guest domains set to auto start by xend. I only have one physical network interface on my server and it is named eth0).</p>
<p>1. Execute the /etc/xen/scripts/network-bridge script in /etc/xen/xend-config.sxp</p>
<p>2. This will create a new network bridge called xenbr0.</p>
<p>3. Copy the MAC address and IP address from the physical network<br />
interface eth0.</p>
<p>4. Stop the physical network interface eth0.</p>
<p>5. Create a new pair of connected virtual ethernet interfaces—veth0 and vif0.0.</p>
<p>6. Assign the previously copied MAC address and IP address to the virtual  interface   veth0.</p>
<p>7. Rename the physical network interface to peth0 from eth0.</p>
<p>8. Rename the virtual network interface veth0 to eth0.</p>
<p>9. Attach peth0 and vif0.0 to the bridge xenbr0.</p>
<p>10. Bring up the bridge xenbr0, and the network interfaces peth0, eth0, and vif0.0.</p>
<p>For each new domU, Xen creates a new pair of &#8220;connected virtual ethernet interfaces&#8221;, with one end in domU and the other in dom0. For linux domU&#8217;s, the device name it sees is named eth0. The other end of that virtual ethernet interface pair exists within dom0 as interface vif&lt;id#&gt;.0. When a domU is shutdown, the virtual ethernet interfaces for it are deleted.</p>
<p><a href="http://www.sparksupport.com/blog/wp-content/uploads/2010/12/virtual2.jpg"><img class="alignnone size-full wp-image-1073" src="http://www.sparksupport.com/blog/wp-content/uploads/2010/12/virtual2.jpg" alt="" width="500" height="286" /></a></p>
<p>when a domU starts up, xend (running in dom0) runs the vif-bridge script, which:<br />
- attaches vif&lt;id#&gt;.0 to xenbr0<br />
- vif&lt;id#&gt;.0 is brought up</p>
<p>So you would be able to see additional network interfaces after creating new guest domains.</p>
<pre>[root@localhost xen]# ifconfig
<strong>eth0</strong>   Link encap:Ethernet  HWaddr 48:5B:39:89:E5:43
       inet addr:192.168.1.86  Bcast:192.168.1.255  Mask:255.255.255.0
<strong>lo</strong>     Link encap:Local Loopback
       inet addr:127.0.0.1  Mask:255.0.0.0
<strong>peth0</strong>  Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
       inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
<strong>vif0.0</strong> Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
       inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
<strong>vif1.0</strong> Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
       inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
<strong>vif2.0</strong> Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF
       inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
<strong>xenbr0</strong> Link encap:Ethernet  HWaddr B2:8B:2C:4C:ED:0E
       UP BROADCAST RUNNING NOARP  MTU:1500 Metric:1
</pre>
<p>Here you can see the newly added interfaces vif1.0 and vif2.0 , which are virtual interfaces for the new guest domains created.</p>
<p>Inside the guest domain, the network interfaces look the same as on a typical machine.</p>
<pre>[user@DomU]# ifconfig -a
eth0   Link encap:Ethernet  HWaddr 00:16:3E:5A:32:DA
       inet addr:128.153.144.96 Bcast:128.153.145.255 Mask:255.255.254.0
       inet6 addr: fe80::216:3eff:fe5a:32da/64 Scope:Link
lo     Link encap:Local Loopback
       inet addr:127.0.0.1  Mask:255.0.0.0
       inet6 addr: ::1/128 Scope:Host
</pre>
<p>In a guest domain, whether the Xen network is in bridging mode or routing mode, the network interface looks the same as it would in a nonvirtualized machine.</p>
<p>Each DomU (guest domain) have a configuration file where we can specify the network settings associated with that domain. It is specified as the following in the corresponding configuration file.</p>
<pre class="brush: bash;">

vif = [mac=00:16:3E:02:00:41,bridge=xenbr0' ]
</pre>
<p>vif: Specifies the virtual network interface configuration for the domain. This is provided in the following format:<br />
vif = [ "key1 = value1", "key2 = value2" ]<br />
The common options used for this configuration directive are<br />
bridge: Specifies the network bridge that will be used for this interface.<br />
mac: Specifies the MAC address for this virtual interface.<br />
If you do not provide a MAC address, it is set to a random MAC address by Xen on boot.The random address is selected from the range of addresses assigned to Xensource by IEEE. At this point you understand how all the interfaces that have been listed  in Dom0 are created<br />
and what they mean. Next we can have a look at the packet flow in bridged networking. For that please refer the following figure.</p>
<p>.<br />
.<a href="http://www.sparksupport.com/blog/wp-content/uploads/2010/12/bridging1.jpg"><img class="alignnone size-full wp-image-1070" src="http://www.sparksupport.com/blog/wp-content/uploads/2010/12/bridging1.jpg" alt="" width="500" height="334" /></a></p>
<p>Packet arrives at hardware, is handled by dom0 Ethernet driver and appears on peth0. peth0  is bound to to the bridge, so its passed to the bridge from there.We can see that peth0, xenbr0, vif0.0, and vif1.0 are sharing the same MAC address FE:FF:FF:FF:FF:FF, which is the Ethernet broadcast address. This indicates that the physical interface, the loopback device of Domain0, and the backend interfaces of guest domains are all broadcasting to the bridge interface xenbr0. When the physical network interface receives the packets, it sends them all directly to the bridge interface xenbr0. Now the bridge distributes the packet, just like a switch would.The software bridge determines which domain&#8217;s backend interface to forward those packets to by the receiver&#8217;s MAC addresses. So, peth0 does not need to have an IP, only a MAC address. The vif interface puts the packet into Xen, which then puts the packet back to the domain the vif leads to.Its also done that way for dom0, hence the vif0.0-&gt;eth0 pair.</p>
<p>If you want to use a bridge name other than the default one( xenbr0) you can specify it in the xend configuration file like the following.</p>
<pre class="brush: bash;">

(network-script 'network-bridge bridge=&lt;name&gt;')
</pre>
<p>where &lt;name&gt; is the desired name of bridge.</p>
<p>Note also that network-bridge defaults to binding eth0 to the bridge. To change the physical network card, use</p>
<pre class="brush: bash;">

(network-script 'network-bridge bridge=&lt;name&gt; netdev=eth1')
</pre>
<p>If a server has more than one physical network interface, it may be useful to separate traffic between interfaces by creating additional bridges. In this way, one could connect xenbr0 to peth0 and xenbr1 to peth1 and give a virtual machine in say dom1 exclusive access to xenbr1. Everything necessary for this is present in the network-bridge script.</p>
<p>While useful from the command line, the /etc/xen/xend-config.sxp script will require some tuning in order to create bridges automatically during boot. By default, this script calls the network-bridge script; however, this script can only be called once. To avoid this problem, you need to create a network-wrapper script, which can be configured to call the network-bridge script twice. Use the following steps to configure this:</p>
<p>1. Create a script /etc/xen/scripts/network-wrapper with the following contents:</p>
<pre class="brush: bash;">

#!/bin/sh
/etc/xen/scripts/network-bridge $1 netdev=eth0 bridge=xenbr0
/etc/xen/scripts/network-bridge $1 netdev=eth1 bridge=xenbr1
</pre>
<p>Tune the /etc/xen/xend-config.sxp script so that it calls this network wrapper script, by adding the following:</p>
<pre class="brush: bash;">

(network-script network-bridge-wrapper)
</pre>
<p>3. Make sure that in the configuration file for each of the unprivileged domains, you indicate what network bridge to use. This would make the vif lines look like the following example line:</p>
<pre class="brush: bash;">

vif=[ 'bridge=xenbr1', 'mac=00:16:3e:07:d2:0e', ]
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sparksupport.com/blog/xen-bridging/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basics of iptables</title>
		<link>http://www.sparksupport.com/blog/iptables</link>
		<comments>http://www.sparksupport.com/blog/iptables#comments</comments>
		<pubDate>Fri, 17 Dec 2010 07:47:44 +0000</pubDate>
		<dc:creator>hans</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[iptables tutorial]]></category>
		<category><![CDATA[linux iptables]]></category>

		<guid isPermaLink="false">http://www.sparksupport.com/blog/?p=1041</guid>
		<description><![CDATA[Iptables is the default firewall used in many present Linux distros. It is a project under netfilter. Previously it was known as ipchains (For 2.2 Kernels) , ipfwadm(for 2.0 kernels) and nftables are their future project..Iptables are designed for ipv4 and ipv6table for ipv6. From ipfwadm to iptables , we can see marginal modifications done [...]]]></description>
			<content:encoded><![CDATA[<p>Iptables is the default firewall used in many present Linux distros. It is a project under netfilter. Previously it was known as ipchains (For 2.2 Kernels) , ipfwadm(for 2.0 kernels) and nftables are their future project..Iptables are designed for ipv4 and ipv6table for ipv6.</p>
<p>From ipfwadm to iptables , we can see marginal modifications done in design and hence in features. In ipfwadm a rule set matched the packets and actions are taken on that packets , then in ipchains , chains are Incorporated and the rules will decide , through which chain the packets need to be traversed, then in iptables , tables are introduced so that the  user can choose proper table based on his requirement , that means he can choose filter table for packet filtering . NAT tables for source and destination natting then mangle table for packet modifications.(We will discuss more about tables later ). Connection tracking capability is the yet another advancement with iptable. So we can say it as a statefull firewall. Rate limiting , system logging etc. are the other features included in iptables apart from it&#8217;s predecessors.</p>
<p>Iptables gets it&#8217;s ascendancy through the modularity and integrity with the kernel. It exploits the modularity of linux kernels.  A bunch of kernel modules need to be loaded for the full operation of iptables.</p>
<p>ip_tables iptable_filter  ip_conntrack  ip_conntrack_ftp<br />
iptable_nat  ip_nat_ftp  ipt_limit   ipt_multiport<br />
iptable_mangle  ipt_state  ipt_REJECT  ipt_LOG</p>
<p>These are some of required kernel modules. All are not required for all applications. For loading modules in bootup add script in rc.local using modprobe command. And also we need a kernel with some specific config options .If it&#8217;s not there we need to recompile the kernel to exploit the functions of iptable. For latest kernels almost all options are included , rarely need to be recompiled.  Some important options that need to be compiled in to kernel or as modules are</p>
<p>CONFIG_PACKET<br />
CONFIG_NETFILTER<br />
CONFIG_IP_NF_CONNTRACK<br />
CONFIG_IP_NF_FTP<br />
CONFIG_IP_NF_IRC<br />
ONFIG_IP_NF_IPTABLES<br />
CONFIG_IP_NF_FILTER<br />
CONFIG_IP_NF_NAT<br />
CONFIG_IP_NF_MATCH_STATE<br />
CONFIG_IP_NF_TARGET_LOG<br />
CONFIG_IP_NF_MATCH_LIMIT<br />
CONFIG_IP_NF_TARGET_MASQUERADE .</p>
<p>You can check your current kernel configuration by <strong>cat /boot/config-`uname -r`</strong>.As I already told the latest kernels are incorporated with almost all netfilter options. So you seldom need to worry about that.<br />
<strong><br />
Packet flow in iptables</strong><br />
Next I would like  to draw a vignette of packet flaw in iptables. There is definite order for traversing of packets through the different tables and chains in iptables. Basic understanding of that order is mandatory for writing complex firewall rules.</p>
<p>Iptable comprised of  three tables , MANGLE , FILTER and NAT table.<br />
Each tables have it&#8217;s own chains for packet processing.<br />
MANGLE table : This tables is responsible for the alternation of QoS bits in TCP header.For example TOS (Type of service) bit. But it rarely used for simple networks.Mangle table have five chains ,PREROUTING, POSTROUTING,FORWARD,INPUT and OUTPUT.</p>
<p>FILTER table:This is the most used table in small network environments.This table is responsible for packet filtering on the basis of corresponding rules. This table have INPUT, FORWARD and OUTPUT chains. Most used target and jumps in this table are ACCEPT, DROP/DENY and REJECT. We will discuss about this target and jump  later.</p>
<p>NAT table:This table used for network address translation which is  a imperative feature of routers.It have PREROUTING chain (for Destination address translation) FORWARD chain (address translation for packets from router itself) and POSTROUTING chain( for source address translation).</p>
<p>When packet reaches the hardware(NIC) it will be processed to hardware driver and through kernel.Then it traverse through different tables and chains in the iptables in desired order. In each chain , iptable compare the rules in that chain with that packet information , if it finds a match then action is taken based on that rule.(eg:REJECT) .If a packet is matched with the first rule in a chain , it will not check the second rule in the same chain , it will jump to next chain in the order.</p>
<p>The following figure will help you to understand the packet traversal through iptable chains.</p>
<p><a href="http://www.sparksupport.com/blog/wp-content/uploads/2010/12/iptable.gif"><img class="alignnone size-medium wp-image-1050" src="http://www.sparksupport.com/blog/wp-content/uploads/2010/12/iptable-214x300.gif" alt="" width="288" height="351" /></a></p>
<p><strong>Options with iptable command</strong>.</p>
<p>-t   Specify the table. By default FILTER table is taken .<br />
-j     Jump to the target<br />
-A      Append the rule to the end of the chain.<br />
-F  Flush. Deletes all the rules in the selected table<br />
-p  	Match protocol. Types include, icmp, tcp, udp, and all<br />
-s  	Match source IP address<br />
-d  	Match destination IP address<br />
-i  	Match &#8220;input&#8221; interface on which the packet enters.<br />
-o  	Match &#8220;output&#8221; interface on which the packet exits<br />
-m  used to match certain conditions . eg: state ESTABLISHED<br />
<strong><br />
Targets and Jumps with iptable</strong><br />
DROP/DENY : When a packet is dropped or denied it is simply  abandoned and no notification is send to the host. ie the packet disappears with out taking any further actions.</p>
<p>REJECT : The host reject the packet and sends  reply to the sending host , saying that the packet was dropped. Other wise it is same as that of DROP/DENY.</p>
<p>ACCEPT : This will accept the packet that matches the corresponding rules.</p>
<p>LOG : The packet information will be logged with syslogd daemon.</p>
<p>SNAT : Source nat used in NAT table POSTROUTING table for manipulating source ip address.</p>
<p>DNAT: destination NAT used in NAT table PREROUTING table to manipulate destination ip address and for port forwarding.</p>
<p>MASQUERADE : To change source ip address to the ip address of corresponding router  network interface.</p>
<p><strong>Iptable commands and rules</strong></p>
<p>iptables -L : To list all present rules in a table (By default it will show FILTER table rule.To specify the table use -t )<br />
iptables -t nat -L (list all NAT table rules)<br />
iptables -v -L : more detailed information about the rules<br />
iptables -F</p>
<table>: it will flush all rules in that table.<br />
iptables -t table -D   : to delete a particular rule from a tables&#8217;s chain. Or else we can give the rule number in that chain . eg: iptable -t nat -D PREROUTING 2<br />
iptables -P  : To set the default policy of a chain in FILTER table . eg: iptables -p OUPUT DROP<br />
<strong>Rule to allow only SSH traffic</strong></p>
<pre class="brush: bash;">

iptables -A INPUT -p tcp -s 0/0 --dport 22 -j ACCEPT &lt;This will allow port 22 on INPUT chain of filter table)
iptables-A OUTPUT -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -P INPUT DROP
</pre>
<p><strong>Rule for port forwarding</strong></p>
<pre class="brush: bash;">

 iptables -t nat -A PREROUTING -p tcp -d  'destination ip' --dport 80 -j DNAT --to-destination 192.168.1.10:80
Packet destined to 80 port of your public ip will be forwarded to the 80 port of private ip.We appending rule to the PREROUTING chain of NAT table.
iptables -A FORWARD -p tcp -s 0/0 -d 192.168.1.10 --dport 80 -j ACCEPT
</pre>
<p>I think this is enough for the basics. I will write more advanced rules on my next article. Try it!!!!!</table>
]]></content:encoded>
			<wfw:commentRss>http://www.sparksupport.com/blog/iptables/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic Web Scraping Using Selenium</title>
		<link>http://www.sparksupport.com/blog/dynamic-web-scraping-using-selenium</link>
		<comments>http://www.sparksupport.com/blog/dynamic-web-scraping-using-selenium#comments</comments>
		<pubDate>Wed, 24 Nov 2010 10:14:04 +0000</pubDate>
		<dc:creator>Shameem Khalid</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[Ajax Scraping using selenium]]></category>
		<category><![CDATA[Crawling Ajax]]></category>
		<category><![CDATA[scraping]]></category>
		<category><![CDATA[scraping + selenium]]></category>
		<category><![CDATA[web crawling]]></category>

		<guid isPermaLink="false">http://www.sparksupport.com/blog/?p=979</guid>
		<description><![CDATA[This article is a part of the on-going Web Scraping Series. If you are not familiar with Web Scraping please check with the first article . This session mainly deals with Dynamic Content Scraping. Nowadays most of the web portals are dynamic by making Ajax calls instead of old static web pages. Scraping on dynamic [...]]]></description>
			<content:encoded><![CDATA[<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		A:link { so-language: zxx } -->This article is a part of the on-going Web Scraping Series. If you are not familiar with Web Scraping please check with the <a title="first part" href="http://www.sparksupport.com/blog/tag/tor">first article </a>. This session mainly deals with Dynamic Content Scraping. Nowadays most of the web portals are dynamic by making Ajax calls instead of old static web pages. Scraping on dynamic environment is both interesting and challenging one.</p>
<p>The first part of the discussion concentrated mainly on static page scraping with Perl mechanize module. Even though mechanize provides extension for dynamic scraping, it is not very good.</p>
<p>So this session deals with making use of selenium testing tool for Web Scraping.</p>
<p><span style="text-decoration: underline;"><span style="color: #003366;"><strong>Prerequsites</strong></span></span></p>
<p>Selenium IDE is a Firefox add-on that records clicks, typing, and other actions to make a test, which you can play back in the browser.</p>
<ul>
<li><span style="color: #808080;"><a href="http://seleniumhq.org/download"><span style="text-decoration: underline;">Download 	Selenium IDE</span></a></span></li>
</ul>
<p>Selenium Remote Control (RC)  is a Java based Command line server for handling request from client.</p>
<ul>
<li><span style="text-decoration: underline;"><span style="color: #ffffff;"><a title="Download Selenium Remote Control" href="http://selenium.googlecode.com/files/selenium-remote-control-1.0.3.zip">Download Selenium Remote Control (RC)<br />
</a></span></span></li>
</ul>
<p><span style="color: #003366;"><span style="text-decoration: underline;"><strong>Pros and Cons</strong></span></span></p>
<p>It supports all Dynamic Content like Ajax, JavaScript, is easy to implement and it is possible to write selenium clients in any language we prefer, for example, here I have used Perl. You can also use Python, Java, etc.</p>
<p>Selenium based Web Scraping on small throughout is easy task.</p>
<p>It consumes lots of memory resource, for each request it will launch a new browser instance.</p>
<p><span style="color: #003366;"><strong><span style="text-decoration: underline;">Working of selenium</span></strong></span></p>
<p><strong>Selenium Remote Control</strong> (RC) is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser.</p>
<p><span style="color: #003366;"><em>Selenium RC comes in two parts.</em></span></p>
<ol>
<li>A server which 	automatically launches and kills browsers, and acts as a HTTP proxy for web requests from them.</li>
<li>Client libraries for your favourite computer language.</li>
</ol>
<p>The RC server also bundles <a href="http://seleniumhq.org/projects/core/"><span style="color: #0057ae;"><span style="text-decoration: underline;">Selenium Core</span></span></a>, and automatically loads it into the browser.</p>
<p>Here is a simplified architectural representation:</p>
<p><a href="http://www.sparksupport.com/blog/wp-content/uploads/2010/11/selenium-rc.png"><img class="aligncenter size-medium wp-image-981" src="http://www.sparksupport.com/blog/wp-content/uploads/2010/11/selenium-rc-300x292.png" alt="" width="300" height="292" /></a></p>
<p>For Detailed diagram <a title="http://seleniumhq.org/about/how.html" href="http://seleniumhq.org/about/how.html">http://seleniumhq.org/about/how.html</a></p>
<p><span style="color: #003366;"><em>How to Setup a Selenium Server</em></span></p>
<blockquote><p>Download Selenium RC server to directory  to /usr/local/selenium</p>
<p>#cd /usr/local/selenium</p>
<p>#unzip selenium-remote-control-1.0-beta-2-dist.zip</p>
<p>#cd  selenium-remote-control-1.0-beta-2</p>
<p>#cd selenium-server-1.0-beta-2</p>
<p>#java -jar selenium-server.jar #starting selenium server .By default it is listen to 4444</p></blockquote>
<p><span style="color: #003366;"><em>An example Client Program</em></span></p>
<p>As said in the above section, it is possible to create selenium client by recording user activities or else the programmers can create it using their own language. Python, Perl and Ruby, Java has supporting modules for it.</p>
<pre class="brush: plain;">
#Sample Perl Code
#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More &quot;no_plan&quot;;
use Test::Exception;

my $sel = Test::WWW::Selenium-&gt;new( host =&gt; &quot;192.168.1.20&quot;,
port =&gt; 4444,
browser =&gt; &quot;*firefox&quot;,
browser_url =&gt; &quot;http://www.godaddy.com/&quot; );
$sel-&gt;open_ok(&quot;/domains/search.aspx?ci=8969&quot;);
$sel-&gt;click_ok(&quot;domain_search_button&quot;);
$sel-&gt;wait_for_page_to_load_ok(&quot;30000&quot;);
my $data=$sel-&gt;get_html_source(); # here you get source of the current page
</pre>
<p>For more info please have a look at cpan <a title="http://search.cpan.org/search?query=selenium&amp;mode=all" href="http://search.cpan.org/search?query=selenium&amp;mode=all">http://search.cpan.org/search?query=selenium&amp;mode=all</a></p>
<p>As scraper you can extract required data from this source:</p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --><span style="color: #003366;"><strong>For scraping data from multiple pages</strong></span></p>
<p>Open selenium IDE and record the events that you are interested and analyse the code generated and try to implement your own way,</p>
<p>As a last word, let me add that selenium is not completely a scraping tool, it is instead, a testing tool.</p>
<p>For more about selenium have look at <a title="http://seleniumhq.org/" href="http://seleniumhq.org/">http://seleniumhq.org/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sparksupport.com/blog/dynamic-web-scraping-using-selenium/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Git access control with Gitosis</title>
		<link>http://www.sparksupport.com/blog/git-access-control-with-gitosis-2</link>
		<comments>http://www.sparksupport.com/blog/git-access-control-with-gitosis-2#comments</comments>
		<pubDate>Wed, 27 Oct 2010 10:42:22 +0000</pubDate>
		<dc:creator>hans</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git access control]]></category>
		<category><![CDATA[gitosis]]></category>

		<guid isPermaLink="false">http://www.sparksupport.com/blog/?p=956</guid>
		<description><![CDATA[There are many open source version control systems like Bazaar, Arch, Aegis, SVN ,CVS , Git etc. All systems have there own pros and cons. But I personally like Git due to it&#8217;s flexibility and possibilities.It have an excellent network compatibility. We can use the native Git protocol, but it also works over rsync, ssh, [...]]]></description>
			<content:encoded><![CDATA[<p>There are many open source version control systems like Bazaar, Arch, Aegis, SVN ,CVS , Git etc. All systems have there own pros and cons. But I personally like Git due to it&#8217;s flexibility and possibilities.It have an excellent network compatibility. We can use the native Git protocol, but it also works over rsync, ssh, HTTP and HTTPS. Access control is the more painful headache for admins. ie who can commit , who can access projects etc. Here we can manage git repositories with gitosis , which is a tool for git access control . More safe thing is gitosis can be used with ssh-key authentication which is one of the most secure data transfer methodology in linux. While we use key-authentication we don&#8217;t need to create that user in Git server , it tighten security further becuase developers will not get shell access on server.  There should be a Git user in server , here I am creating a user as &#8216;git&#8217; in server.</p>
<p>If you don&#8217;t have Git on your machine install it through yum(Redhat based) or apt-get(Debian based) depending up on your OS.</p>
<pre class="brush: bash;">
# apt-get install git-core
</pre>
<p>For the installation of gitosis we need python-setuptools package in our server.</p>
<pre class="brush: bash;">
# apt-get install python-setuptools
</pre>
<p>Now we can download gitosiis from it&#8217;s git repository.</p>
<pre class="brush: bash;">
# git clone git://eagain.net/gitosis.git
</pre>
<p>it&#8217;s of few KBs .Now install it with python script.</p>
<pre class="brush: bash;">
# cd gitosis
# python setup.py install
</pre>
<p>create an user as git(you can give any name) . Give him a shell otherwise ssh login might have problems ,then give the desired home directory.(which will be the Git Root directory).</p>
<p>It&#8217;s the time to upload public key to Git server. If you have a public-private key pair in local machineuse it , otherwise create a new one with ssk-keygen.</p>
<pre class="brush: bash;">
# ssh-keygen -t rsa
</pre>
<p>Public key will be in name id_rsa.pub . Copy the key and upload it to the server.</p>
<p>Next , execute the command</p>
<pre class="brush: bash;">
# sudo -H -u git gitosis-init &amp;lt; /tmp/id_rsa.pub
</pre>
<p>This will add some directories and files in to user git&#8217;s home directory and append the public key to authorized keys file of user git.<br />
Now clone the gitosis-admin repository to your local machine.</p>
<pre class="brush: bash;">
$ git clone git@GIT-SERVER:gitosis-admin.git
$ cd gitosis-admin
</pre>
<p>If you list this directory you can see only two directories .Here You can create new projects , make changes , do access control etc. What ever you do , you have to commit it and push it to the server to replicate the changes on server. Since we cloned gitosis-admin repository we can make all changes locally and push it to the server.</p>
<p><strong>Creating new repository and control access on new repository.</strong></p>
<p>For creating a new repository , edit the gitosis.conf file and add the entries as follows.<br />
Here I am assuming that the new repository name is &#8216;test&#8217;</p>
<pre class="brush: bash;">
[group testgroup]
members = hans
writable = test
</pre>
<p>Here group is just a name , no matter what it is. member is the list of users who can access the repository and &#8216;writable&#8217; is the name of repository. Commit this changes and push it to the server.</p>
<pre class="brush: bash;">
$ git commit -a -m &amp;quot;comment for this commit&amp;quot;
$ git push
</pre>
<p>Create the directory &#8216;test&#8217; and initiate it as a git repo.</p>
<pre class="brush: bash;">
$ mkdir test
$ cd test
$ git init
</pre>
<p>Add remote server url to the new repository config file.</p>
<pre class="brush: bash;">
$ git remote add origin git@GIT_SERVER:test.git
</pre>
<p>push the changes in to the server.</p>
<pre class="brush: bash;">
$ git push origin master:refs/heads/master
</pre>
<p>Eventhough we allowed user hans to access &#8216;test&#8217; repository , we didn&#8217;t add his public key to the server . So he will not be able to access the project repository. So copy his public key to &#8216;keydir&#8217; as hans.pub . It should have a &#8216;.pub&#8217; extension.</p>
<pre class="brush: bash;">
$ cd gitosis-admin
$ cp /home/hans/hans.pub keydir/hans.pub
$ git add keydir/hans.pub
$ git commit -a -m &amp;quot;comment&amp;quot;
$ git push
</pre>
<p>Yes we done it !<br />
Now user hans can clone the test repository to his local machine. He can make changes ,add files ,commit ,and push changes to the server.</p>
<p>hans $ git clone git@GIT_SERVER:test.git<br />
Now try it. Good Luck !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sparksupport.com/blog/git-access-control-with-gitosis-2/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

