<?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>Ramblings &#187; Setups</title>
	<atom:link href="http://ramblings.gibberishcode.net/archives/category/setups/feed" rel="self" type="application/rss+xml" />
	<link>http://ramblings.gibberishcode.net</link>
	<description>about fetching, interpreting, and executing.</description>
	<lastBuildDate>Sat, 01 May 2010 19:19:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Getting Ruby to talk to MSDE</title>
		<link>http://ramblings.gibberishcode.net/archives/getting-ruby-to-talk-to-msde/22</link>
		<comments>http://ramblings.gibberishcode.net/archives/getting-ruby-to-talk-to-msde/22#comments</comments>
		<pubDate>Fri, 09 Apr 2010 01:07:45 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Ruby Language]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Setups]]></category>

		<guid isPermaLink="false">http://ramblings.gibberishcode.net/?p=22</guid>
		<description><![CDATA[Getting Ruby to talk to Microsoft SQL Server 2005 is one thing.  Getting Ruby to talk to Microsoft SQL Server Developer Edition 2000, has one twist that threw me off for hours.  Here, I&#8217;ll show you how to do and hopefully save you lots of frustration and brain damage from banging your head [...]]]></description>
			<content:encoded><![CDATA[<p>Getting Ruby to talk to Microsoft SQL Server 2005 is one thing.  Getting Ruby to talk to Microsoft SQL Server Developer Edition 2000, has one twist that threw me off for hours.  Here, I&#8217;ll show you how to do and hopefully save you lots of frustration and brain damage from banging your head against the wall.
</p>
<p>I won&#8217;t cover a complete Ruby and Rails/Ramaze/Sinatra installation.  This post assumes you have that much down pat, so we&#8217;ll pick up the ball with installing FreeTDS, unixODBC, Ruby ODBC
</p>
<p>If you&#8217;re using Ubuntu 8.10, you can get away with installing everything from packages with the following:
</p>
<pre class="twilight">
apt-get install  unixodbc freetds-common tdsodbc \
             libodbc-ruby1.8 \
             libdbi-ruby1.8 libdbd-odbc-ruby \
             autoconf make
</pre>
<p><b>NOTE:  I wrote this article and right before publishing, attempted to replicate these results on both mac OS X and CentOS 5.  Both failed to work with the technique I thought I had all nice and worked out.  I spent several hours over many months trying to find out exactly what&#8217;s different between the packages, but never got very far with my investigations.  For a long time, it looked to me like both the ODBC packages and the FreeTDS packages need to be tweaked to properly handle [SERVER]\[DB_INSTANCE] construct that MSDE uses vs. just [SERVER] that the full-fledged SQL Server uses.</b>  This, after all, is the convention of the Windows ODBC driver and DSN definitions.  However, there&#8217;s a really simple solution that I hit upon on Actual Technologies&#8217; website that led me to a true universal solution and that&#8217;s to learn the port the INSTANCE runs on and set up the DSN specifically to that port!
</p>
<p>But beware, the above doesn&#8217;t get you all of the freetds tools, most importantly the tsql command which can help you with debugging issues before getting into the ODBC game (that is, direct TDS connections to your SQL Server).  So, to cover the most distros possible, I&#8217;ll document the &#8220;from source&#8221; approach for *nix systems and macports for Macs so you&#8217;ll find two sets of installation instructions for every step.</p>
<h2>Preparing your Environment</h2>
<p>I prefer to pull down all source packages into my local user directory under a &#8220;~/src&#8221; folder.  The instructions that follow assume you&#8217;re in this folder.  If you&#8217;re not, then please make the appropriate substitutions as you follow along.  Additionally, I configure and compile most things as a regular user then use sudo to install system-wide as a &#8220;super user.&#8221;
</p>
<h2>Install unixODBC</h2>
<p>unixODBC provides the ODBC connectivity for the TDS driver.</p>
<pre class="twilight">
wget http://www.unixodbc.org/unixODBC-2.2.14.tar.gz
tar zxfv unixODBC-2.2.14.tar.gz
cd unixODBC-2.2.14
./configure  --enable-gui=no
make
sudo make install
</pre>
<h3>On Macs</h3>
<pre class="twilight">
sudo port install unixODBC
</pre>
<h3>On CentOS</h3>
<pre class="twilight">
sudo yum install unixODBC unixODBC-devel
</pre>
<h2>Install FreeTDS</h2>
<p>FreeTDS provides the open source implementation of the protocol implemented by both Sybase and Microsoft SQL Server.
</p>
<pre class="twilight">
wget ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
tar zvxf freetds-stable.tgz
cd freetds-0.82/
sudo ./configure  --with-unixodbc=/usr/local
sudo make
sudo make install
</pre>
<h3>On Macs</h3>
<pre class="twilight">
sudo port install freetds
</pre>
<h3>On CentOS</h3>
<pre class="twilight">
sudo yum install freetds
</pre>
<h2>Install ruby-odbc</h2>
<p>The ruby-odbc package provides the ruby bindings for ODBC connectivity.
</p>
<pre class="twilight">
wget http://www.ch-werner.de/rubyodbc/ruby-odbc-0.9995.tar.gz
tar zvxf ruby-odbc-0.9995.tar.gz
cd ruby-odbc-0.9995/
ruby extconf.rb
make
sudo make install
</pre>
<h3>On Macs</h3>
<pre class="twilight">
sudo port install rb-odbc
</pre>
<h2>Install ruby DBI</h2>
<pre class="twilight">
wget http://rubyforge.org/frs/download.php/655/ruby-dbi-all-0.0.23.tar.gz
tar zvxf ruby-dbi-all-0.0.23.tar.gz
cd ruby-dbi-all
ruby setup.rb config --with=dbi,dbd_odbc
ruby setup.rb setup
sudo ruby setup.rb install
</pre>
<h2>Configure FreeTDS and ODBC</h2>
<p>If you&#8217;re connecting to either SQL Server 2000 or SQL Server 2005 Standard, Enterprise, etc., then the typical approach is to add an entry for the server to /etc/freetds/freetds.conf and then reference that entry in the /etc/odbc.ini.  Sometimes, these files get installed in /usr/local/etc.  If so, then I will usually symlink the files into /etc for convenience, so that&#8217;s what&#8217;s referenced below.
</p>
<p>My server is called &#8220;apvdbs01&#8243; (the WINS name) with an IP Address of 10.0.2.2 and the database I&#8217;m connecting to is called &#8220;test_development&#8221; while &#8220;username&#8221; and &#8220;passwd&#8221; should be substituted with an valid user account and credentials for successfully connection to the database server.
</p>
<p>
Add a server entry for your server (which I typically give same name as Windows Server) to /etc/freetds.conf, so that host points to the SQL Server address:
</p>
<pre class="twilight">
[apvdbs01]
host = 10.0.2.2
port = 1433
tds version = 7.0
</pre>
<p>TDS version 7.0 is for SQL Server 2000.  If you have SQL Server 2005, then tds version is 8.0.</p>
<pre class="twilight">
tsql –S apvdbs01 –U username –P passwd
</pre>
<p>Once you can connect directly with the TDS drivers, move on to adding the ODBC driver entries.</p>
<p>Add the FreeTDS ODBC driver by editing “/etc/odbcinst.ini” (make sure “/usr/local/lib/libtdsodbc.so” exists first):
</p>
<pre class="twilight">
[FreeTDS]
Description     = TDS driver (Sybase/MS SQL)
Driver          = /usr/lib/odbc/libtdsodbc.so
Setup           = /usr/lib/odbc/libtdsS.so
</pre>
<p>Add a new DSN to “/etc/odbc.ini”:</p>
<pre class="twilight">
[test_development]
Driver          = FreeTDS
Description     = ODBC connection via FreeTDS
Trace           = No
ServerName      = apvdbs01
Database        = test_development
</pre>
<p>So, &#8220;FreeTDS&#8221; is the driver that we gave for the lib TDS ODBC connector in the odbcinst.ini file (this allows you to install and maintain multiple versions of the libtdsodbc.so file).  We reference this driver in the odbc.ini file with the &#8220;Driver&#8221; entry and we reference the actual server data in the freetds.conf file via the &#8220;ServerName&#8221; entry.
</p>
<p>Now that you have ODBC configured for FreeTDS, test it with:</p>
<pre class="twilight">
	isql test_development username passwd
</pre>
<h2>But that doesn&#8217;t work for MSDE!</h2>
<p>The above will get you connected to a standard or enterprise SQL Server 2000/2005 installation, but does not work for an Embedded SQL Server 2000/2005 installation.  After trying many permutations, I finally came up with a configuration that actually works.  One of the key things to know about MSDE is that the MSDE server instance is in the form of &#8220;servername\instance&#8221; rather than straight up &#8220;servername&#8221; as with standard/enterprise installations.  This is known as a &#8220;named instance.&#8221;  The trick to connecting?  Find out the port the named instance is listening on and connect to that port rather than the 1433 port!</p>
<p>You can determine the port used by the instance by using the Server Network Utility in the Microsoft SQL Server program group on the Windows server where your database resides. Select the instance name from the drop down list and select TCP/IP from the list of enabled protocols. This will show you the port number for that instance.</p>
<pre class="twilight">
[test_msde2000]
Driver         = FreeTDS
Description    = ODBC connection via FreeTDS
Server         = 10.0.2.2
Database       = my_test_db
Port           = 1348
TDS_Version    = 7.0
</pre>
<p>I could then connect to the MSDE instance like so:</p>
<pre class="twilight">
isql test_msde2000 username passwd
</pre>
<h2>Test ODBC connectivity from Ruby</h2>
<p>If both tsql and isql commands work, then you&#8217;re well on your way to connecting to SQL Server via Ruby.  To test Ruby with the above ODBC configurations:</p>
<pre class="twilight">
irb
require "dbi"
dbh = DBI.connect("dbi:ODBC:test_development", "username", "passwd")
</pre>
<h2>Connecting with Sequel</h2>
<p>One of my favorite tools for connecting to SQL DBMS&#8217; is Sequel, which is maintained by Jeremy Evans.  To connect using Sequel, install the gem:
</p>
<pre class="twilight">
sudo gem install sequel
</pre>
<p>And then give this a shot:</p>
<pre class="twilight">
irb
require 'rubygems'
require 'sequel'

DB = Sequel.odbc('test_development', :db_type => 'mssql', :user => 'username', :password => 'passwd')
</pre>
<h2>References</h2>
<p>http://www.freetds.org/userguide/confirminstall.htm</p>
<p>http://www.unixodbc.org/odbcinst.html</p>
<p>http://www.actualtech.com</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.gibberishcode.net/archives/getting-ruby-to-talk-to-msde/22/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Apache 2.2 and Active Directory and Group restrictions</title>
		<link>http://ramblings.gibberishcode.net/archives/apache-22-and-active-directory-and-group-restrictions/36</link>
		<comments>http://ramblings.gibberishcode.net/archives/apache-22-and-active-directory-and-group-restrictions/36#comments</comments>
		<pubDate>Wed, 22 Jul 2009 16:44:44 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Setups]]></category>
		<category><![CDATA[Systems]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[authnz ldap module]]></category>
		<category><![CDATA[mod_authnz_ldap]]></category>

		<guid isPermaLink="false">http://ramblings.gibberishcode.net/?p=36</guid>
		<description><![CDATA[I was really struggling with getting Apache and Active Directory talking and restricting access (authorizing) only a sub-set of users that belonged to a particular group.  Here, I show you how I solved the problem.

The Stage
I am setting up a Ubuntu server with Apache 2.2 and authenticating users against a Windows 2003 Server&#8217;s Active [...]]]></description>
			<content:encoded><![CDATA[<p>I was really struggling with getting Apache and Active Directory talking and restricting access (authorizing) only a sub-set of users that belonged to a particular group.  Here, I show you how I solved the problem.
</p>
<h2>The Stage</h2>
<p>I am setting up a Ubuntu server with Apache 2.2 and authenticating users against a Windows 2003 Server&#8217;s Active Directory.  This is standard fare when all you need is a require valid-user directive.  But when it came to getting require ldap-group directive going, I really stumbled.  And on multiple fronts, too.  I am not a Windows guru by any measure, nor am I an LDAP guru, so there was a huge cultural and vocabulary barrier for me to cross on both the LDAP vernacular and the somewhat different parlance surrounding Microsoft&#8217;s documentation on Active Directory.  Its like a Southern Redneck talking to a Scottish Highlander about home-brewing beer.
</p>
<p>So here&#8217;s what we&#8217;re going to do:</p>
<ul>
<li>Apache 2.2</li>
<li>Microsoft Active Directory (Windows 2003 Server)</li>
<li>authnz_ldap module</li>
</ul>
<p>For this effort, I am authenticating users that reside in the MyBusiness -> Users folders and I&#8217;m restricting access to the Auditors Security Group, also residing under MyBusiness.  The domain I use is &#8220;sample.local&#8221; herein.  See the screen shot of the Active Directory structure and details of the Auditors group below:
</p>
<p><img src="http://www.cybrains.net/images/ad_screenshot.png" alt='Active Directory Screenshot' /></p>
<p>There are <a href="http://httpd.apache.org/docs/trunk/mod/mod_authnz_ldap.html">plenty of resources out there</a> about getting the authnz_ldap module working with Apache, so I won&#8217;t be covering this part of the setup.  Instead, I will focus on the gestalt of the actual configuration.
</p>
<h2>Will the Real AuthLdapUrl Please Stand Up?</h2>
<p>There seems to be no real standard way to set the AuthLdapURL configuration string.  I think I visited ten or fifteen web sites on the topic and each one was a little bit different!  And none really explained fully the chosen syntax and LDAP selectors being used.  Fortunately, I came across a <a href="http://www.computerperformance.co.uk/Logon/Logon_CSVDE.htm">site dedicated to explaining CSVDE</a>, which turned out to be a bit of a rosetta stone for me.
</p>
<p>CSVDE is a tool I had never heard of, but yet is apparently installed on every Windows 2003 Server.  After about five minutes of reading and 20 minutes of perusing the CSV export I generated, I knew exactly how to construct the AuthLdapURL configuration string.  Well, with one caveat, that is.  I still am not sure what &#8220;(objectClass=*)&#8221; does for me, but several examples had it and I kept it.
</p>
<h2>Know your Users</h2>
<p>All of my users are maintained under group policies and they reside under the domain&#8217;s root node in &#8220;MyBusiness&#8221; and &#8220;Users&#8221; under that.  Standard Windows accounts, especially system administrator accounts reside in a &#8220;Users&#8221; folder directly off the domain&#8217;s root node.  This was one of the first points of contention that I had to understand when looking at the vast majority of other people&#8217;s solution.  Simply put, know which &#8220;Users&#8221; you wish to work with in Apache.
</p>
<p>Knowing I wanted to authenticate users under the MyBusiness node, my AuthLdapUrl becomes:
</p>
<pre class="twilight">
AuthLDAPURL ldap://ad.sample.local:389/OU=MyBusiness,DC=sample,DC=local?sAMAccountName?sub?(objectClass=*)
</pre>
<h2>Bind a User so Apache can Query</h2>
<p>You do have to bind to Active Directory so that Apache can actually query.  To do this, I created a User under the standard &#8220;Users&#8221; folder (where administrator, and other such accounts traditionally reside).  I don&#8217;t know if I applied correct rights or not, but the account is no more than a &#8220;Domain User&#8221; member.  I called the user &#8220;AD_VIEWER&#8221; with description &#8220;Account to bind Apache to Active Directory for authentication.&#8221;  This leads to the following Apache directives:
</p>
<pre class="twilight">
AuthLDAPBindDN "AD_VIEWER@sample.local"
AuthLDAPBindPassword bottom_secret_password
</pre>
<p>I tested the above getting the usual &#8220;require valid-user&#8221; directive working with Apache.  Once I was sure I could do this much, it was time to turn my attention to restricting access to users that are members of a specific group.
</p>
<h2>Where&#8217;s my Group?</h2>
<p>I struggled for quite a while with the groups before I finally got wise and set the debug level to get more details into the apache log files.  The debug logging level can be set with:
</p>
<pre class="twilight">
LogLevel debug
</pre>
<p>And this leads to quite detailed information about what&#8217;s going on with Apache and Authentication.  For example, before I got my ldap-group configuration correct, I was seeing this:
</p>
<pre class="twilight">
[debug] mod_authnz_ldap.c(721): [2934] auth_ldap authorise: require group: testing for uniquemember: CN=Code Connoisseur,OU=MyBusiness,OU=Users,DC=sample,DC=local (CN=Auditors,OU=MyBusiness,DC=sample,DC=local)
[debug] mod_authnz_ldap.c(737): [2934] auth_ldap authorise: require group "CN=Auditors,OU=MyBusiness,DC=sample,DC=local": authorisation failed [Comparison complete][No such object]
[debug] mod_authnz_ldap.c(852): [2934] auth_ldap authorise: authorisation denied
</pre>
<p>Note the &#8220;No such object&#8221; as this was telling me the group itself was not found.  I tried many permutations without success until I found the CSVDE program and was able to dump the Active Directory to Excel for further inspection.  I realized with the CSVDE output that I was doing both the<br />
AuthLDAPURL (the above AuthLDAPURL is correct as I have spared you from my mistakes).  The correct ldap-group config string for accessing a Security Group defined under MyBusiness is:</p>
<pre class="twilight">
require ldap-group CN=Auditors,OU=Security Groups,OU=MyBusiness,DC=sample,DC=local
</pre>
<p>In short, you have to exactly declare the selector for your Active Directory Group or Apache will fail to find it.  After getting the group setting right, I now see &#8220;attribute member&#8221; and &#8220;Comparison true&#8221; in the logs, which indicates that the group was found and that my user is a member of that group.
</p>
<pre class="twilight">
[debug] mod_authnz_ldap.c(377): [3134] auth_ldap authenticate: using URL ldap://10.0.1.5:389/OU=MyBusiness,DC=sample,DC=local?sAMAccountName?sub?(objectClass=*)
[debug] mod_authnz_ldap.c(474): [3134] auth_ldap authenticate: accepting mwlang
[debug] mod_authnz_ldap.c(715): [3134] auth_ldap authorise: require group: testing for group membership in "CN=Auditors,OU=Security Groups,OU=MyBusiness,DC=sample,DC=local"
[debug] mod_authnz_ldap.c(721): [3134] auth_ldap authorise: require group: testing for member: CN=Michael Lang,OU=Employees,OU=Users,OU=Users,OU=MyBusiness,DC=sample,DC=local (CN=Auditors,OU=Security Groups,OU=MyBusiness,DC=sample,DC=local)
[debug] mod_authnz_ldap.c(730): [3134] auth_ldap authorise: require group: authorisation successful (attribute member) [Comparison true (adding to cache)][Compare True]
</pre>
<h2>The complete Apache Config</h2>
<p>Bringing all of the items discussed above together, we arrive at this Apache configuration.  I am using Virtual Hosts to uniquely identify the service.  Also of note, I am using Ramaze to provide the functionality of the actual site, so please do take this into account if you&#8217;re copying and pasting.  This config is a complete virtual host entry:
</p>
<pre class="twilight"><span class="Keyword">&lt;</span>VirtualHost *:<span class="Keyword">80&gt;</span>
    ServerName audit.sample.local
    RackBaseURI /
    RackAutoDetect on
    DocumentRoot /var/www/balancer/public

    LogLevel debug
    <span class="Keyword">&lt;</span>Location <span class="String"><span class="String">&quot;</span>/data_entry<span class="String">&quot;</span></span><span class="Keyword">&gt;</span>
        AuthBasicProvider ldap
        AuthType Basic
        AuthName <span class="String"><span class="String">&quot;</span>Sample Realm<span class="String">&quot;</span></span>
        AuthLDAPURL ldap://10.0.1.5:389/OU=MyBusiness,DC=sample,DC=local?sAMAccountName?sub?(objectClass=*)
        AuthzLDAPAuthoritative on

        AuthLDAPBindDN <span class="String"><span class="String">&quot;</span>AD_VIEWER@sample.local<span class="String">&quot;</span></span>
        AuthLDAPBindPassword bottom_secret_password

        AuthLDAPGroupAttributeIsDN on
        require ldap-group CN=Auditors,OU=Security Groups,OU=MyBusiness,DC=sample,DC=local
    <span class="Keyword">&lt;</span>/Location<span class="Keyword">&gt;</span>
<span class="Keyword">&lt;</span>/VirtualHost<span class="Keyword">&gt;</span>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.gibberishcode.net/archives/apache-22-and-active-directory-and-group-restrictions/36/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>macports is not darwinports</title>
		<link>http://ramblings.gibberishcode.net/archives/macports-is-not-darwinports/35</link>
		<comments>http://ramblings.gibberishcode.net/archives/macports-is-not-darwinports/35#comments</comments>
		<pubDate>Tue, 23 Jun 2009 00:36:06 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Macs]]></category>
		<category><![CDATA[Setups]]></category>
		<category><![CDATA[Systems]]></category>
		<category><![CDATA[darwinports]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[macports]]></category>

		<guid isPermaLink="false">http://ramblings.gibberishcode.net/?p=35</guid>
		<description><![CDATA[For those of you who don&#8217;t keep a close eye on the macports system that provides you with convenient builds of popular open source software, let me put you on guard:  macports supplanted darwinports a few years back to avoid continued confusion over the name.
I was having a good bit of trouble getting ports [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who don&#8217;t keep a close eye on the macports system that provides you with convenient builds of popular open source software, let me put you on guard:  macports supplanted darwinports a few years back to <a href="http://trac.macports.org/wiki/DarwinPorts">avoid continued confusion</a> over the name.</p>
<p>I was having a good bit of trouble getting ports to install ImageMagick and have had trouble many other times getting ports to install things.  As such, I often fell back on fink or compiling and installing from source rather than figuring out the root causes of my macports problems.  </p>
<p>Macports was surprisingly easy to fix up and get fully operational again, and this was on a fairly old machine that I am pretty certain I started with &#8220;Darwin Ports&#8221; roughly 3.5 years ago.  </p>
<h2>First Thing&#8217;s First</h2>
<p>First, know that the official macports website is: <a href="http://macports.org">trac.macports.org</a>.  Be wary of anything &#8220;darwinports&#8221; as name is officially retired in favor of &#8220;macports.&#8221;
</p>
<h2>Trouble a-brewing</h2>
<p>It all started innocently enough.  I wanted to install ImageMagick on my mac.  I&#8217;ve been through installing ImageMagick on Linux and knew it was not going to be a cakewalk to install from source.  ImageMagick simply has too many dependencies to relish the thought of an install from source route.  So I googled and found <a href="">instructions for ports</a> and began:
</p>
<pre class="twilight">sudo port install tiff -macosx imagemagick +q8 +gs +wmf
Warning: Group file could not be located.
---<span class="Keyword">&gt;</span>  Activating tiff 3.8.2_3
Error: Target org.macports.activate returned: Image error: Another version of this port (tiff @3.8.2_2+darwin_9+macosx) is already active.
</pre>
<p>Oh, ok, lets remove the old one&#8230;</p>
<pre class="twilight">
sudo port uninstall tiff -macosx imagemagick +q8 +gs +wmf
---<span class="Keyword">&gt;</span>  The following versions of tiff are currently installed:
---<span class="Keyword">&gt;</span>  	tiff @3.8.2_2+darwin_9+macosx (active)
---<span class="Keyword">&gt;</span>  	tiff @3.8.2_3
Error: port uninstall failed: Registry error: Please specify the full version as recorded <span class="Keyword">in</span> the port registry.
[mwlang@macdoze shared] sudo port uninstall tiff @3.8.2_2+darwin_9+macosx
---<span class="Keyword">&gt;</span>  Unable to uninstall tiff 3.8.2_2+darwin_9+macosx, the following ports depend on it:
---<span class="Keyword">&gt;</span>  	gtk2
---<span class="Keyword">&gt;</span>  	lcms
---<span class="Keyword">&gt;</span>  	sane-backends
---<span class="Keyword">&gt;</span>  	xsane
Error: port uninstall failed: Please uninstall the ports that depend on tiff first.
[mwlang@macdoze shared] sudo port uninstall tiff @3.8.2_2+darwin_9+macosx gtk2 lcms sane-backends xsane
---<span class="Keyword">&gt;</span>  Unable to uninstall tiff 3.8.2_2+darwin_9+macosx, the following ports depend on it:
---<span class="Keyword">&gt;</span>  	gtk2
---<span class="Keyword">&gt;</span>  	lcms
---<span class="Keyword">&gt;</span>  	sane-backends
---<span class="Keyword">&gt;</span>  	xsane
Error: port uninstall failed: Please uninstall the ports that depend on tiff first.
[mwlang@macdoze shared] sudo port uninstall gtk2 lcms sane-backends xsane
---<span class="Keyword">&gt;</span>  Unable to uninstall gtk2 2.12.9_0+x11, the following ports depend on it:
---<span class="Keyword">&gt;</span>  	gconf
---<span class="Keyword">&gt;</span>  	gnome-keyring
---<span class="Keyword">&gt;</span>  	libglade2
---<span class="Keyword">&gt;</span>  	gail
---<span class="Keyword">&gt;</span>  	libgnomecanvas
---<span class="Keyword">&gt;</span>  	libbonoboui
---<span class="Keyword">&gt;</span>  	poppler
---<span class="Keyword">&gt;</span>  	py25-gtk
---<span class="Keyword">&gt;</span>  	gtk-nodoka-engine
---<span class="Keyword">&gt;</span>  	xsane
Error: port uninstall failed: Please uninstall the ports that depend on gtk2 first.
</pre>
<p>Not a very auspicious start, is it?  Time to step back and think about this one and dig into the macports facility to learn how to properly manage things.  New strategy: Get an education.</p>
<h2>Discovering Deactivate/Activate</h2>
<p>So, looking at the above problem, I realized that there was almost certainly an easier route out of this dependency nightmare and I needed to learn how to upgrade those old, stale packages.  Going through the docs reveals activate and deactivate commands.  Sounds perfect, lets try:</p>
<pre class="twilight">sudo port activate tiff @3.8.2_3
---<span class="Keyword">&gt;</span>  Activating tiff @3.8.2_3
Error: port activate failed: Image error: Another version of this port (tiff @3.8.2_2+darwin_9+macosx) is already active.
[mwlang@macdoze shared] sudo port deactivate tiff @3.8.2_2+darwin_9+macosx
---<span class="Keyword">&gt;</span>  Deactivating tiff @3.8.2_2+darwin_9+macosx
[mwlang@macdoze shared] sudo port activate tiff @3.8.2_3
---<span class="Keyword">&gt;</span>  Activating tiff @3.8.2_3
</pre>
<p>So there&#8217;s the kicker.  First, deactivate the old version, <i>then</i> activate the new version.</p>
<h2>So Macports itself is out of date, you say?</h2>
<pre class="twilight">sudo port install tiff -macosx imagemagick +q8 +gs +wmf
Error: Unable to execute port: invalid command name <span class="String"><span class="String">&quot;</span>use_autoreconf<span class="String">&quot;</span></span>
</pre>
<p>I had no clue what this was.  Googling around was turning up precious little.  So I hopped over into the IRC #macports channel.  Right off the bat, Toby tells me to selfupdate.  I had made the mistake of thinking that &#8220;sudo port sync&#8221; was keeping macports packages all up to date in one fell swoop.  But the two are two distinct activities.  So remember to keep ports itself updated with this:</p>
<pre class="twilight">sudo port selfupdate
</pre>
<p>With that, port was upgraded from a very old version to a bright and shiny new version.  Time to try to install ImageMagick again.  And I&#8217;m happy to report that I got much further along this time.  But still hit a roadblock&#8230;</p>
<h2>Mysterious failure demystified</h2>
<p>A little down the chain of installing various xorg packages, I hit upon this one with the xorg-libx11 package:</p>
<pre class="twilight">checking <span class="Keyword">for</span> XPROTO... configure: error: Package requirements (xproto <span class="Keyword">&gt;</span>= 7.0.13) were not met.
Consider adjusting the PKG_CONFIG_PATH environment variable <span class="Keyword">if</span> you
installed software <span class="Keyword">in</span> a non-standard prefix.

Alternatively you may set the XPROTO_CFLAGS and XPROTO_LIBS environment variables
to avoid the need to call pkg-config.  See the pkg-config man page <span class="Keyword">for</span>
more details.

Error: The following dependencies failed to build: ghostscript xorg-libXext xorg-libX11 xorg-libXt xorg-libsm xorg-libice
Error: Status 1 encountered during processing.
[mwlang@macdoze shared] sudo port install ImageMagick
Error: Requested variants <span class="Keyword">do</span> not match original selection.
Please perform <span class="String"><span class="String">'</span>port clean ImageMagick<span class="String">'</span></span> or specify the force option.
Error: Status 1 encountered during processing.
</pre>
<p>Strange, what&#8217;s that <b>xproto >= 7.0.13</b>?  How odd that a dependency would fail!  I tried a <b>sudo port install xproto</b>, but that was a no-go (so don&#8217;t bother trying, it&#8217;ll fail for you, too).  but then I noticed the dependency list (which oddly is missing <b>xorg-xproto</b>) and most of the packages are prefixed with &#8220;xorg-&#8221;, and tried <b>sudo port install xorg-xproto</b> and thus, was on my way again.</p>
<p>I lie! <i>I lie!</i>  I had no clue.  I googled &#8220;xproto port install&#8221; and learned the truth for the real package name that way.  However, as it happens, I found the answer on darwinports dot com in a dependency list for xorg-libx11.  I casually mentioned this site in the IRC channel and the #macports tenants were very quick to point out was an imposter site, so be wary of anything you read and learn there.  Information is liable to be stale while the site owner attempts to lighten your wallet a bit for no good cause.  Little did I know!</p>
<h2>Final tidbit</h2>
<p>Once I got the ports system updated and the xproto package installed, it was a fair breeze to finish with the ImageMagick installation.  One last command I learned from the good folks in #macports is to run the following on a frequent basis to keep your macports installation in fair good shape:</p>
<pre class="twilight">sudo port selfupdate <span class="Keyword">&amp;&amp;</span> sudo port upgrade outdated
</pre>
<h2>Conclusion</h2>
<p>For years,  I struggled with ports, and for no good reason.  Once I took the time to learn the package management&#8217;s commands (along with the help of those in #macports, for which I&#8217;m very grateful to them for saving me a few hours of head-scratching), I am finding I&#8217;m able to install packages painlessly on the mac and have even tried a couple of others I had problems with in the past and they&#8217;re all installing without a hitch.  The lesson for me:  take the time to learn your tools.  It may be slow-going at first, but the rewards always seem to pay back big dividends down the road.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.gibberishcode.net/archives/macports-is-not-darwinports/35/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install Passenger on Ubuntu Intrepid 8.10</title>
		<link>http://ramblings.gibberishcode.net/archives/install-passenger-on-ubuntu-intrepid-810/30</link>
		<comments>http://ramblings.gibberishcode.net/archives/install-passenger-on-ubuntu-intrepid-810/30#comments</comments>
		<pubDate>Sat, 14 Feb 2009 15:03:16 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Setups]]></category>
		<category><![CDATA[Bootsrap]]></category>
		<category><![CDATA[enterprise ruby]]></category>
		<category><![CDATA[passenger]]></category>

		<guid isPermaLink="false">http://ramblings.gibberishcode.net/?p=30</guid>
		<description><![CDATA[Phusion Passenger is one of the easiest Rails and Rack environments to set up and configure with Apache2.  With my bootstrapping scripts, the ability to establish a Virtual machine image and have a working Rails application on it in minutes is a reality.  Here is how I do it.
Bootstrap Passenger
Begin by Bootstrapping Ubuntu. [...]]]></description>
			<content:encoded><![CDATA[<p>Phusion Passenger is one of the easiest Rails and Rack environments to set up and configure with Apache2.  With my bootstrapping scripts, the ability to establish a Virtual machine image and have a working Rails application on it in minutes is a reality.  Here is how I do it.</p>
<h2>Bootstrap Passenger</h2>
<p>Begin by <a href="http://ramblings.gibberishcode.net/archives/bootstrap-ubuntu-server-810-intrepid-64-bit/29">Bootstrapping Ubuntu</a>.  </p>
<p>The next step is to run the script for installing Passenger.  The standard passenger install against the standard Ruby 1.8.7 package managed libraries are installed with the following:</p>
<p>(assuming you&#8217;ve downloaded the bootstrap scripts and are in the ~/bootstrap-scripts/ubuntu/intrepid folder already, execute the following script:</p>
<pre class="twilight">
./bootstrap-passenger-std.sh
</pre>
<p>Passenger&#8217;s install prompts you two or three times.  Simply press <ENTER> and ignore the additional configuration instructions (the bootstrap script carries out these instructions for you).</p>
<h2>Set up a demo Rails project</h2>
<pre class="twilight">
cd /var/www
sudo mkdir rails
cd rails
sudo rails demo
cd ..
chown -R www-data:www-data rails
</pre>
<h2>Set up a Virtual Host Entry</h2>
<p>Apache2 on Ubuntu makes it fairly straightforward to set up a provider for the Rails application, simply create the following in /etc/apache2/sites-available/demo:</p>
<pre class="twilight">
<span class="MetaTagAll"><span class="MetaTagAll">&lt;</span><span class="MetaTagInline">VirtualHost</span> <span class="MetaTagAll">*:80</span><span class="MetaTagAll">&gt;</span></span>
  <span class="SupportConstant">ServerName</span> localhost
  <span class="SupportConstant">DocumentRoot</span> /var/www/rails/demo/public
<span class="MetaTagAll"><span class="MetaTagAll">&lt;/</span><span class="MetaTagInline">VirtualHost</span><span class="MetaTagAll">&gt;</span></span>
</pre>
<p>And then enable the site:</p>
<pre class="twilight">
sudo a2ensite demo
sudo /etc/init.d/apache2 reload
</pre>
<h2>End Result</h2>
<p>If all goes well, you should then be able to browse to http://localhost and see the rails greet page.  Your system will look something like this:</p>
<pre class="twilight"><span class="String"><span class="MetaTagInline">OS<span class="MetaTagInline">:</span></span> <span class="String">2.6.27-7-server x86_64 GNU/Linux</span></span>
<span class="String"><span class="MetaTagInline">Apache<span class="MetaTagInline">:</span></span> <span class="String">Server version: Apache/2.2.9 (Ubuntu)</span></span>
<span class="String"><span class="MetaTagInline">Passenger<span class="MetaTagInline">:</span></span> <span class="String">2.0.6</span></span>
<span class="String"><span class="MetaTagInline">Ruby<span class="MetaTagInline">:</span></span> <span class="String">ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]</span></span>
<span class="String"><span class="MetaTagInline">Rubygems<span class="MetaTagInline">:</span></span> <span class="String">1.3.1</span></span>
<span class="MetaTagAll"><span class="MetaTagInline">gems</span><span class="MetaTagAll">:</span></span>
 <span class="String"><span class="String">-</span> <span class="String">actionmailer (2.2.2)</span></span>
 <span class="String"><span class="String">-</span> <span class="String">actionpack (2.2.2)</span></span>
 <span class="String"><span class="String">-</span> <span class="String">activerecord (2.2.2)</span></span>
 <span class="String"><span class="String">-</span> <span class="String">activeresource (2.2.2)</span></span>
 <span class="String"><span class="String">-</span> <span class="String">activesupport (2.2.2)</span></span>
 <span class="String"><span class="String">-</span> <span class="String">fastthread (1.0.1)</span></span>
 <span class="String"><span class="String">-</span> <span class="String">passenger (2.0.6)</span></span>
 <span class="String"><span class="String">-</span> <span class="String">plist (3.0.0)</span></span>
 <span class="String"><span class="String">-</span> <span class="String">rack (0.9.1)</span></span>
 <span class="String"><span class="String">-</span> <span class="String">rails (2.2.2)</span></span>
 <span class="String"><span class="String">-</span> <span class="String">rake (0.8.3)</span></span>
</pre>
<h2>Where to go from here?</h2>
<p>After you have Passenger working, you may be interested in trying it with the so-called <a href="http://www.rubyenterpriseedition.com/">Enterprise version of Ruby</a> which claims 33% memory footprint reduction overall for a typical Rails application.  If so, you can flip over to the Enterprise version by running the following bootstrap script:</p>
<pre class="twilight">
./bootstrap-passenger-ent.sh
</pre>
<p>This script will download and compile Enterprise Ruby and install Passenger against this version of Ruby, disabling the standard passenger modules in Apache (if they&#8217;re installed as per above) in the process.  Does it make any real difference?  We shall see!  I am benchmarking performance of both standard and enterprise and will be reporting on my findings soon. </p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.gibberishcode.net/archives/install-passenger-on-ubuntu-intrepid-810/30/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bootstrap Ubuntu Server 8.10 Intrepid 64-bit</title>
		<link>http://ramblings.gibberishcode.net/archives/bootstrap-ubuntu-server-810-intrepid-64-bit/29</link>
		<comments>http://ramblings.gibberishcode.net/archives/bootstrap-ubuntu-server-810-intrepid-64-bit/29#comments</comments>
		<pubDate>Sat, 14 Feb 2009 12:46:05 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Bootsrap]]></category>
		<category><![CDATA[Setups]]></category>
		<category><![CDATA[intrepid]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://ramblings.gibberishcode.net/?p=29</guid>
		<description><![CDATA[This post covers getting the basic Ubuntu Server 8.10 Intrepid up and going and ready for further configuration (such as Ruby on Rails, or MySQL Server, or Bind 9, etc.).

Ubuntu Site:  http://www.ubuntu.com
ISO Image:  ubuntu-8.10-server-amd64.iso

If you&#8217;re new to my bootstrapping series, please see Bootstrapping my blog for some background information.
Install the OS
No need to [...]]]></description>
			<content:encoded><![CDATA[<p>This post covers getting the basic Ubuntu Server 8.10 Intrepid up and going and ready for further configuration (such as Ruby on Rails, or MySQL Server, or Bind 9, etc.).</p>
<ul>
<li>Ubuntu Site:  http://www.ubuntu.com</li>
<li>ISO Image:  ubuntu-8.10-server-amd64.iso</li>
</ul>
<p>If you&#8217;re new to my bootstrapping series, please see <a href="http://ramblings.gibberishcode.net/archives/bootstrapping-my-blogs/28">Bootstrapping my blog</a> for some background information.</p>
<h2>Install the OS</h2>
<p>No need to beat a dead horse to death.  If you need instructions for installing Ubuntu, then please follow Ubuntu&#8217;s most excellent guides for installing Ubuntu Server.  For my purposes, I install everything to default choices, only choosing to install OpenSSH Server (and no others).  Everything else is simply supplying the simple information requested at each prompt in order to get me to the bootstrapping stage most directly.</p>
<h2>Bootstrap!</h2>
<p>Once the OS is installed and boots for the first time, log in and run the following:</p>
<pre class="twilight">
<span class="line-numbers">   1 </span> sudo apt-get install git-core
<span class="line-numbers">   2 </span> git clone git://github.com/mwlang/bootstrap-scripts.git
<span class="line-numbers">   3 </span> cd bootstrap-scripts/ubuntu/intrepid
<span class="line-numbers">   4 </span> sh bootstrap.sh
</pre>
<p>This will install the prerequisite git commands and check out the <a>bootstrap-script repository</a> and then run through upgrading the Ubuntu server and install the build-essentials.</p>
<p>That&#8217;s it!  You can now return to the article that brought you here.</p>
<h2>Nice, but what is this all about?</h2>
<p>Bootstrapping is just that.  Getting the bare minimum components installed so that you can proceed to do more complicated tasks.  Rather than writing things over and over, I scripted them and checked them into git repository and then refer to them, hopefully much to your gain (as well as my sanity).</p>
<p>Depending on where you want to go with your server instance, you can run any of the other bootstrap scripts in the folder.  For example, to install Ruby 1.8.7 from packages (not source) and install Apache2 and Passenger and Rails, run the following script:</p>
<pre class="twilight">
<span class="line-numbers">   1 </span> sh bootstrap-passenger-std.sh
</pre>
<p>You&#8217;ll need to hit the  key a couple of times when passenger&#8217;s installer runs, but otherwise, should run start-to-finish, installing everything without any further action on your part to get a fully functioning Apache2 + Passenger + MRI Ruby 1.8.7 + Rails stack installed.</p>
<p>Be careful, though.  I didn&#8217;t put any dependency checks around these scripts.  Its fairly safe to run any of the bootstrap-XXX.sh scripts without running anything else (these scripts do call the main bootstrap.sh script listed above).  But several scripts, such as rails.sh do indeed have prerequisites and you <em>will</em> have issues running these out of order.  Also, bootstrapping is targeting specific outcomes.  Don&#8217;t expect to run one bootstrap-XXX.sh script and then run another.  They are very likely to collide with undesirable outcomes.</p>
<p>Documentation will be fairly sparse in the git repository, with the intent to spell things out in the accompanying blog articles.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.gibberishcode.net/archives/bootstrap-ubuntu-server-810-intrepid-64-bit/29/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Bootstrapping my Blogs</title>
		<link>http://ramblings.gibberishcode.net/archives/bootstrapping-my-blogs/28</link>
		<comments>http://ramblings.gibberishcode.net/archives/bootstrapping-my-blogs/28#comments</comments>
		<pubDate>Sat, 14 Feb 2009 12:42:14 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Setups]]></category>
		<category><![CDATA[bootstrapping]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[dry]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://ramblings.gibberishcode.net/?p=28</guid>
		<description><![CDATA[Ever notice that blogs that are tutorial in nature spend a lot of time providing instructions on installing things, but a whole lot depends on what the author already has installed that he&#8217;s forgotten to tell you about?  Or perhaps the author simply left out the details necessary for you to fully replicate his [...]]]></description>
			<content:encoded><![CDATA[<p>Ever notice that blogs that are tutorial in nature spend a lot of time providing instructions on installing things, but a whole lot depends on what the author already has installed that he&#8217;s forgotten to tell you about?  Or perhaps the author simply left out the details necessary for you to fully replicate his environment?</p>
<p>For me personally, I get downright tired of writing the same thing over and over.  Like my code, I want my blogging efforts to be efficient and DRY.  Since I work extensively with virtual machines to maintain an orderly environment in a known state, I figured it makes just as much sense to document by establishing a git repository that contains all my bootstrap scripts and configuration scripts needed to get things installed.  Whether you use bare metal or virtual machines, you are now empowered to fully recreate the environments I discuss in my posts.  </p>
<p>Now, rather than constantly regurgitating basic setups in a sort of preamble to the topic I wish to discuss, I will simply link to my Setup specific articles to get you going and then dive straight into the topic at hand.</p>
<p>It all begins with you establishing your basic out-of-box instance, installing git, then pulling the bootstrap scripts down from my <a href="http://github.com/mwlang/bootstrap-scripts/tree/master">bootstrap-scripts repository</a>.</p>
<p>The three environments I intend to discuss most (at this time) is Ubuntu 8.10 (Intrepid), CentOS 5.2, and Leopard OS X.  I will not give each of these equal coverage with respect to bootstrapping as I am presently only bootstrapping Ubuntu on a regular basis (and I haven&#8217;t reinstalled Leopard in ages).  However, when I do bring up any new environments, I will make a full effort to fully document bootstrapping that environment and push to git.  For now, you can expect Ubuntu Intrepid to be my most well-documented environment.</p>
<p>Please keep in mind:  These are very simple scripts, highly targeted at the environment they&#8217;re written for.  They&#8217;re not meant to do the job one might employ capistrano or puppet for.  I know what I want my target environment to be and I aim straight at it with these scripts.  Also, the repository will be organized atypically for preserving history rather than for merging commits into a well-maintained master branch.</p>
<p>All articles dealing with operating system and package installs will be filed under the Setups category and, if appropriate, the pertinent sub-category.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.gibberishcode.net/archives/bootstrapping-my-blogs/28/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
