<?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>thirstymind.org &#187; install</title>
	<atom:link href="http://www.thirstymind.org/tag/install/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thirstymind.org</link>
	<description>andrew watts' weblog</description>
	<lastBuildDate>Sat, 17 Oct 2009 22:11:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Installing Cygwin on Windows for Unix users</title>
		<link>http://www.thirstymind.org/2008/07/15/installing-cygwin-on-windows-for-unix-users/</link>
		<comments>http://www.thirstymind.org/2008/07/15/installing-cygwin-on-windows-for-unix-users/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 21:31:54 +0000</pubDate>
		<dc:creator>Andrew Watts</dc:creator>
				<category><![CDATA[how to]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[instructions]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.thirstymind.org/?p=368</guid>
		<description><![CDATA[I need to have a terminal or my productivity diminishes to the point where I verge on having a mental breakdown, and unfortunately I have to use a windows laptop for work.  So I have become very accustomed at working with cygwin and all its little nuances and here are my steps/tips for installing [...]]]></description>
			<content:encoded><![CDATA[<p>I need to have a terminal or my productivity diminishes to the point where I verge on having a mental breakdown, and unfortunately I have to use a windows laptop for work.  So I have become very accustomed at working with cygwin and all its little nuances and here are my steps/tips for installing and integrating cygwin with windows. </p>
<p><strong>Move your &#8220;My Documents&#8221; directory.</strong></p>
<p>Windows likes using &#8220;My Documents&#8221; as the default location to store everything.  And this is typically located at C:\Documents and Settings\__username__\My Documents.  And in cygwin your home directory will be something like C:\cygwin\home\__username__. Personally that is one too many places for me to remember, so, I consolidated them into a location located at C:\dev for 2 reasons:</p>
<ol>
<li>cygwin doesn&#8217;t like spaces in its path, so this path will not have any</li>
<li>If i choose to remove C:\cygwin, I can without blowing away my important documents</li>
</ol>
<p>This is pretty simple to do, just use windows explorer and browse to your C:\ drive, then create a new folder named &#8220;dev&#8221;.  Then, if you want, copy all your C:\Documents and Settings\__username__\My Documents files into C:\dev. If you don&#8217;t, none of your existing documents will be in the &#8220;My Documents&#8221; location.</p>
<p>Next using windows explorer browse to your old &#8220;My Documents&#8221; folder and right click on the folder, select properties.  This will open a window with 4 tabs, select the Target tab and change the Target folder to C:\dev and hit the &#8216;OK&#8217; button to close the window.</p>
<p>We&#8217;ll fix the cygwin home directory problem later, so go ahead and install cygwin.</p>
<p><strong>Install cygwin</strong></p>
<p>There are million places on the internet that document how to install and configure cygwin, so I am not going to do that here.  But I am assuming you use the default cygwin install location of C:\cygwin and you install X Server and X11 Libraries.  If you don&#8217;t know where to start, visit <a href="http://www.cygwin.com">http://www.cygwin.com</a>, click the Install or Update now icon and follow the <a href="http://www.cygwin.com/cygwin-ug-net/setup-net.html">installation instructions</a>.</p>
<p><strong>Mount the C:\ drive</strong><br />
After installation there will be a file named Cygwin.bat located at c:\cygwin\Cygwin.bat, double click the file to start a cygwin terminal.</p>
<p>You can access the C:\ drive in cygwin by going to /cygwin/c, but that is too many characters for me to type and would rather I just type &#8216;cd /c&#8217; and get there.  So you can mount the C:\ drive at /c.</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> <span class="kw3">cd</span> <span class="sy0">/</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> <span class="kw2">mkdir</span> c</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> <span class="kw2">mount</span> c: <span class="sy0">/</span>c</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> <span class="kw3">cd</span> <span class="sy0">/</span>c</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> <span class="kw2">ls</span></div>
</li>
</ol>
</div>
<p><strong>Configuring your cygwin user</strong><br />
Once you have your c drive mounted you can set up your user account properly.  To do this you will need to edit the /etc/passwd file and create a link to the /c/dev (C:\dev) directory you created earlier.</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> vi <span class="sy0">/</span>etc<span class="sy0">/</span><span class="kw2">passwd</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;<span class="co0"># find your user name and change the home directory location to /home/__username__</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;<span class="co0"># and save the file.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;__username__:unused_by_nt<span class="sy0">/</span><span class="nu0">2000</span><span class="sy0">/</span>xp:<span class="nu0">69999</span>:<span class="nu0">10545</span>:Your Name:<span class="sy0">/</span>home<span class="sy0">/</span>__username__:<span class="sy0">/</span>bin<span class="sy0">/</span>bash</div>
</li>
</ol>
</div>
<p>If your home directory already exists make a back up of it.</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> <span class="kw3">cd</span> <span class="sy0">/</span>home</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> <span class="kw2">mv</span> __username__ __username__.old</div>
</li>
</ol>
</div>
<p>Finally, create a softlink from /home/__username__ to /c/dev</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> <span class="kw3">cd</span> <span class="sy0">/</span>home</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> <span class="kw2">ln</span> -s <span class="sy0">/</span>c<span class="sy0">/</span>dev __username__</div>
</li>
</ol>
</div>
<p>And I like having quick access to my desktop, so, while you are here create a softlink to your desktop, so that you can there with &#8216;cd ~/desktop&#8217;.</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> <span class="kw3">cd</span> <span class="sy0">/</span>home<span class="sy0">/</span>__username__</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> <span class="kw2">ln</span> -s <span class="sy0">/</span>c<span class="sy0">/</span>Documents\ and\ Settings<span class="sy0">/</span>__username__<span class="sy0">/</span>Desktop desktop</div>
</li>
</ol>
</div>
<p><strong>Configuring X11 and Xterms</strong><br />
Cygwin uses command windows for terminals and I much prefer using xterm and furthermore I want to double click an icon in my taskbar or on my desktop to start the xterm.  Luckily if you installed the X11 libraries, cygwin provides a script that does most of that for us.  It is located at /usr/X11R6/bin/startxwin.bat.</p>
<p>The only problem is that we need to have the X server running before starting an xterm.  So lets create a script that does that.  I put mine in /c/dev/bin/mystartx.sh:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="co0">#!/usr/bin/bash</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#91;</span> `<span class="kw2">ps</span> -W <span class="sy0">|</span> <span class="kw2">grep</span> -i xwin <span class="sy0">|</span> <span class="kw2">wc</span> -l` -eq <span class="nu0">0</span> <span class="br0">&#93;</span>; <span class="kw1">then</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;run <span class="sy0">/</span>usr<span class="sy0">/</span>X11R6<span class="sy0">/</span>bin<span class="sy0">/</span>Xwin -clipboard -emulate3buttons -multiwindow -silent-dup-error</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">fi</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">run xterm -sl <span class="nu0">9999</span> -sb -rightbar -<span class="kw3">bg</span> black -<span class="kw3">fg</span> white -cr yellow -ms <span class="kw2">red</span></div>
</li>
</ol>
</div>
<p>Next we need to execute this script, and to do that we can simply call it from the startxwin.bat script mentioned earlier.</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> <span class="kw2">cp</span> <span class="sy0">/</span>usr<span class="sy0">/</span>X11R6<span class="sy0">/</span>bin<span class="sy0">/</span>startxwin.bat <span class="sy0">/</span>c<span class="sy0">/</span>dev<span class="sy0">/</span>bin<span class="sy0">/</span>startxwin.bat</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sy0">&gt;</span> vi <span class="sy0">/</span>c<span class="sy0">/</span>dev<span class="sy0">/</span>bin<span class="sy0">/</span>startxwin.bat</div>
</li>
</ol>
</div>
<p>Then comment out the line that says:</p>
<div class="geshi no dos">
<ol>
<li class="li1">
<div class="de1">%<span class="re2">RUN</span>% XWin -multiwindow -clipboard -silent-dup-error -emulate3buttons</div>
</li>
</ol>
</div>
<p>And add the call the mystartx.sh right below it:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">bash -c <span class="st0">&#39;/c/dev/bin/mystartx.sh&#39;</span></div>
</li>
</ol>
</div>
<p>Next we can add the C:\dev\bin\startxwin.bat to our task bar and add a fancy icon like the X11 one for %SystemDrive%\cygwin\usr\X11R6\bin\XWin.exe.  Now if everything worked you should be able to click the new icon and start X server if needed and an xterm each time.</p>
<p>To recap, we now have:</p>
<ol>
<li>the main home directory for both windows and cygwin in the same place</li>
<li>the C:\ drive available at /c</li>
<li>An icon that will start a xterm, and x server if needed</li>
</ol>
<p>Now I only need ssh and apache, but that&#8217;s a topic for another post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thirstymind.org/2008/07/15/installing-cygwin-on-windows-for-unix-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

