<?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>For the attention of last week &#187; install</title>
	<atom:link href="http://www.tokumine.com/tag/install/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tokumine.com</link>
	<description>Things I wished I'd known a while ago</description>
	<lastBuildDate>Mon, 25 Jul 2011 16:29:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Install Django, GeoDjango, PostgreSQL &amp; PostGIS on OSX Leopard</title>
		<link>http://www.tokumine.com/2009/06/01/install-django-geodjango-postgresql-postgis-on-osx-leopard/</link>
		<comments>http://www.tokumine.com/2009/06/01/install-django-geodjango-postgresql-postgis-on-osx-leopard/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 23:47:33 +0000</pubDate>
		<dc:creator>simon</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[geodjango]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[postgis]]></category>
		<category><![CDATA[postgres]]></category>

		<guid isPermaLink="false">http://www.tokumine.com/?p=55</guid>
		<description><![CDATA[
This procedure will loosely follow the directions in the following locations:

http://www.djangobook.com/en/2.0/chapter02/
http://geodjango.org/docs/install.html#mac-os-x
http://code.google.com/p/geodjango-basic-apps/wiki/GeographicAdminQuickStart

I&#8217;ll assume you are using the terminal. You are also using OSX 10.5.6 (or later)
1) Install Django
Make a temporary directory to house the install files and enter that directory
mkdir django_install &#38;&#38; cd django_install
Download the latest stable version of Django.
wget http://media.djangoproject.com/releases/1.1/Django-1.1-beta-1.tar.gz
Untar it into a temporary directory [...]]]></description>
			<content:encoded><![CDATA[<h1><img class="aligncenter size-medium wp-image-57" title="p230_02" src="http://www.tokumine.com/wp-content/uploads/2009/06/p230_02-300x290.jpg" alt="p230_02" width="300" height="290" /></h1>
<p>This procedure will loosely follow the directions in the following locations:</p>
<ul>
<li><a href="http://www.djangobook.com/en/2.0/chapter02/">http://www.djangobook.com/en/2.0/chapter02/</a></li>
<li><a href="http://geodjango.org/docs/install.html#mac-os-x">http://geodjango.org/docs/install.html#mac-os-x</a></li>
<li><a href="http://code.google.com/p/geodjango-basic-apps/wiki/GeographicAdminQuickStart">http://code.google.com/p/geodjango-basic-apps/wiki/GeographicAdminQuickStart</a></li>
</ul>
<p>I&#8217;ll assume you are using the terminal. You are also using OSX 10.5.6 (or later)</p>
<h2>1) Install Django</h2>
<p>Make a temporary directory to house the install files and enter that directory<br />
<code class="prettyprint">mkdir django_install &amp;&amp; cd django_install</code></p>
<p>Download the latest stable version of Django.<br />
<code class="prettyprint">wget http://media.djangoproject.com/releases/1.1/Django-1.1-beta-1.tar.gz</code></p>
<p>Untar it into a temporary directory and cd into the directory<br />
<code class="prettyprint">tar zxvf Django-1.1-beta-1.tar.gz &amp;&amp; cd Django-1.1-beta-1</code></p>
<p>run the installer<br />
<code class="prettyprint">sudo python setup.py install </code></p>
<p>These commands will install Django in your Python installation&#8217;s <code class="prettyprint">site-packages</code> directory.</p>
<h2>2) Install GeoDjango prerequisites</h2>
<p>This section is from a web browser and the finder. It&#8217;s just easier that way.</p>
<p>Download the following drive image files, double click them to mount them as a drive, and run the mpkg installer inside each one. The order is important, so do them one by one:</p>
<ul>
<li><a href="http://www.kyngchaos.com/files/software/unixport/UnixImageIO_Framework-1.0.30.dmg">UnixImageIO_Framework-1.0.30.dmg</a></li>
<li><a href="http://www.kyngchaos.com/files/software/unixport/PROJ_Framework-4.6.1-3.dmg">PROJ_Framework-4.6.1-3.dmg</a></li>
<li><a href="http://www.kyngchaos.com/files/software/unixport/GEOS_Framework-3.1.0-1.dmg">GEOS_Framework-3.1.0-1.dmg</a></li>
<li><a href="http://www.kyngchaos.com/files/software/unixport/SQLite3_Framework-3.6.12-2.dmg">SQLite3_Framework-3.6.12-2.dmg</a></li>
<li><a href="http://www.kyngchaos.com/files/software/unixport/GDAL_Framework-1.6.1-3.dmg">GDAL_Framework-1.6.1-3.dmg</a></li>
</ul>
<p>These all setup your system with the right unix GIS libraries to support GeoDjango</p>
<h2>3) Install OSX developer Tools</h2>
<p>This bit is a total pain, but you only have to do it once. Break open the CD&#8217;s that came with your Mac, and find the one that says XCode or Developer tools or something.</p>
<p>Browse to the installer, and just install it all.</p>
<h2>4) Install PostgreSQL &amp; PostGIS</h2>
<p>This section is from a web browser and the finder. It&#8217;s just easier that way.</p>
<p>Download the following drive image files, double click them to mount them as a drive, and run the mpkg installer inside each one. The order is important, so do them one by one:</p>
<ul>
<li><a href="http://www.kyngchaos.com/files/software/unixport/PostgreSQL-8.3.7-1.dmg">PostgreSQL-8.3.7-1.dmg</a></li>
<li><a href="http://www.kyngchaos.com/files/software/unixport/PostGIS-1.3.6-1.dmg">PostGIS-1.3.6-1.dmg</a></li>
</ul>
<h2>5) Install pgAdmin3</h2>
<p>This is the MSSQL enterprise manager of postgres. Download it and drag it to your applications folder. It won&#8217;t be able to connect to postgres yet, so don&#8217;t even both trying.</p>
<p><a href="http://wwwmaster.postgresql.org/redir/170/h/pgadmin3/release/v1.8.4/osx/pgadmin3-1.8.4.dmg">pgadmin3-1.8.4.dmg</a></p>
<h2>6) Setup some paths</h2>
<p>Back to the console now go to your home directory<br />
<code class="prettyprint">cd $home</code></p>
<p>Add postgres binary path to your bash profile<br />
<code class="prettyprint">echo "export PATH=$PATH:/usr/local/pgsql/bin" &gt;&gt; .bash_profile</code></p>
<p>Add a postgres data directory variable to your environment<br />
<code class="prettyprint">echo "export PGDATA=/usr/local/pgsql/data" &gt;&gt; .bash_profile</code></p>
<p><b>quit the terminal and restart it </b></p>
<h2>6) Install the Python PostgreSQL library</h2>
<p>Back into the console now. Install the binding using the python <code class="prettyprint">easy_install</code> command<br />
<code class="prettyprint">sudo easy_install psycopg2</code></p>
<h4>This may not work&#8230;</h4>
<p>If for some reason, this install fails (and it failed on one box I installed), you&#8217;ll need to download the source, unpack and cd into it, edit setup.cfg with include dir and librarydir set to /usr/local/pgsql/include and /usr/local/pgsql/lib, and then run <code class="prettyprint">python setup.py build &#038;&#038; python setup.py install</code></p>
<h2>7) Create postgres user</h2>
<blockquote><p>Note, this may not be neccessary for some of you. I&#8217;d installed postgres before, and had somehow managed to mess up my box &#8211; hence the manual setup of postres user and rights. As Dane mentions in the comments below, this step shouldn&#8217;t really be needed. What can I say &#8211; I&#8217;m a linux hacker at heart, so permissions issues are always surmountable <img src='http://www.tokumine.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . YMMV</p></blockquote>
<p>Open system preferences &gt; accounts and delete the postgres user. </p>
<p>click the + button and add a new user called postgreSQL, with a short name of &#8220;postgres&#8221;. Set the password to whatever you&#8217;d like. This is not necessary if the user already exists</p>
<h2>8 ) Set permissions on postgres data directory</h2>
<p>Go to your postgres data directory and sort permissions/ownership. Again, this may not be neccessary for you, but it was for me.</p>
<p><code class="prettyprint">cd /usr/local/pgsql/</code><br />
<code class="prettyprint">chmod -R 0700 data</code><br />
<code class="prettyprint">chown -R postgres data </code></p>
<h2>9) Create scripts to start and stop Postgres</h2>
<p>For some reason, it&#8217;s not clear how to stop and start postgres from OSX, and using the kyngchaos binaries doesn&#8217;t seem to properly start them (or at least it didn&#8217;t on my machine). I think this was due to the permissions not being set properly on the data directory.</p>
<p>Go to your home directory<br />
<code class="prettyprint">cd $home</code></p>
<p>create scripts to start/stop postgres &amp;&amp; set permissions on them<br />
<code class="prettyprint">echo "sudo launchctl load /Library/LaunchDaemons/org.postgresql.postgres.plist" &gt;&gt; start_pg.sh</code></p>
<p><code class="prettyprint">echo "sudo launchctl unload /Library/LaunchDaemons/org.postgresql.postgres.plist" &gt;&gt; stop_pg.sh</code><br />
<code class="prettyprint">chmod 755 start_pg.sh</code><br />
<code class="prettyprint">chmod 755 stop_pg.sh</code></p>
<p><b><i>Finally</i></b>, you should be able to start and stop postgres (check the activity monitor for postgres processes, making sure to view &#8220;all processes&#8221;) by running:</p>
<p><code class="prettyprint">./start_pg.sh</code></p>
<p>and to stop:<br />
<code class="prettyprint">./stop_pg.sh</code</p>
<p>from your home directory. If you can't see the postgres process in your activity monitor, let me know!)</p>
<h2>9) initialise database</h2>
<p>Ok, assuming we have postgres up and running and all the bindings sorted, we are ready to initialise our DB for our first project. At this point, I recommend following along from step 2 of <a href=" http://code.google.com/p/geodjango-basic-apps/wiki/GeographicAdminQuickStart">the official geoDjango guide</a>.</p>
<p>Make sure you read the code comments for the tutorial - in my case, the postgres shared directory was: /usr/local/pgsql/share, not /usr/share as in the docs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tokumine.com/2009/06/01/install-django-geodjango-postgresql-postgis-on-osx-leopard/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

