<?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>the codem web development blog - Surry Hills, Sydney, Australia &#187; mongo</title>
	<atom:link href="http://www.codem.com.au/streams/tag/mongo/feed" rel="self" type="application/rss+xml" />
	<link>http://www.codem.com.au/streams</link>
	<description>web development, architecture and server management</description>
	<lastBuildDate>Wed, 30 Nov 2011 23:22:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Building mongodb on Ubuntu</title>
		<link>http://www.codem.com.au/streams/2009/testing/building-mongodb-on-ubuntu.html</link>
		<comments>http://www.codem.com.au/streams/2009/testing/building-mongodb-on-ubuntu.html#comments</comments>
		<pubDate>Thu, 20 Aug 2009 13:38:37 +0000</pubDate>
		<dc:creator>James Ellis</dc:creator>
				<category><![CDATA[testing]]></category>
		<category><![CDATA[couchdb]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[kubuntu]]></category>
		<category><![CDATA[mongo]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rdbms]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[ububtu]]></category>

		<guid isPermaLink="false">http://www.customr.net/streams/?p=50</guid>
		<description><![CDATA[The basics of installing MongoDB on Ubuntu, for some testing.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking at mongodb as a solution for some projects. It looks like a decent solution that sits between a standard RDBMS like MySQL or Postgres and schema-less solutions like CouchDB. Result: I need to do some testing&#8230;</p>
<p>As the <a href="http://mongodb.org">mongodb website says</a>: <cite>A key goal of MongoDB is to bridge the gap between key/value stores (which are fast and highly scalable) and traditional RDBMS systems (which are deep in functionality).</cite></p>
<p>It&#8217;s also <a title="warning: nerd alert" href="http://en.wikipedia.org/wiki/Mongo_(planet)">the name of the planet in <em>Flash Gordon</em></a>, the big guy&#8217;s name in <em>Blazing Saddles</em> and the name of the giant Gingerbread man in <em>Shrek</em>, in case you were wondering.<br />
According to the mongodb site, it draws it&#8217;s name from &#8220;hu<strong>mongo</strong>us&#8221; &#8211; although I always thought that was spelt hum<strong>u</strong>ngous but then we&#8217;d have ended up with MungoDB which doesn&#8217;t have the same pop culture links. Digression.</p>
<h4>Update for 10.10</h4>
<p>For users of Ubuntu + derivatives 10.10 and up, mongodb is available via APT, the Ubuntu package management system.<br />
Simply:</p>
<pre>sudo aptitude install mongodb</pre>
<p>Which will install the core and any dependencies, along with setting up a mongodb user and providing an <code>upstart</code> job to manage mongod. To stop, start and restart mongodb, issue the commands <code>sudo service mongodb stop|start|restart</code> or alternatively <code>sudo stop|start|restart mongodb</code>.<br />
On Ubuntu, the mongodb config file lives at /etc/mongodb.conf. Unfortunately it doesn&#8217;t look like we have a conf.d system to allow core config overrides just yet.</p>
<p>For those using older versions of Ubuntu, read on. If you have 10.10+ installed, then skip to the <a href="#install-a-php-driver">Install a PHP Driver</a> part below.</p>
<h4>10.04 and earlier&#8230;</h4>
<p>I do most testing on a Kubuntu (9.04) system, so <a href="http://www.mongodb.org/display/DOCS/Building+for+Linux#BuildingforLinux-Ubuntu9.04">the instructions for building on Ubuntu can be used</a>. (Kubuntu is just Ubuntu with KDE as the desktop environment).</p>
<p>Here&#8217;s the process (with some changes based on some problems I encountered):</p>
<h4>Install the related packages</h4>
<p>You can substitute aptitude for apt-get if you want. I  prefer aptitude as it covers all the APT commands.</p>
<pre>sudo aptitude install tcsh git-core <a href="http://www.scons.org/">scons</a> g++
sudo aptitude install libpcre++-dev libboost1.37-dev libreadline-dev</pre>
<p>There are two changes here from the instructions:</p>
<ol>
<li>libmozjs-dev in Ubuntu 9.04 conflicts with xulrunner-1.9. This means the package manager will try to remove anything that depends on xulrunner-1.9, namely Firefox 3.5. In my case aptitude tried to downgrade Firefox to 3.5b4. To work around this install it from source (see below). This won&#8217;t be a problem if you don&#8217;t need xulrunner-1.9 or its dependencies (or if you aren&#8217;t installing in a desktop environment that uses Firefox 3.5)</li>
<li>You will need libboost1.37-dev rather than libboost-dev, otherwise the mongodb install process will complain about an old version of libboost.</li>
</ol>
<p>Finally, I&#8217;m not sure why tcsh is needed given it&#8217;s just a shell and I have bash installed &#8211; maybe scons needs it?</p>
<h4>SpiderMonkey</h4>
<p>This process will install SpiderMonkey in place of the libmozjs-dev packages, which MongoDB uses to parse data reduction functions. The <a href="http://www.mongodb.org/display/DOCS/Building+Spider+Monkey">MongoDB site provides the background to this</a>.<br />
I&#8217;m installing in a tmp directory in my home directory</p>
<pre>cd ~
mkdir tmp &amp;&amp; cd tmp
wget ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz
tar -zxvf js-1.7.0.tar.gz
cd js/src
export CFLAGS="-DJS_C_STRINGS_ARE_UTF8"
make -f Makefile.ref
sudo JS_DIST=/usr make -f Makefile.ref export</pre>
<h4>Download and install MongoDB</h4>
<p>Finally, get MongoDB using Git and install it using scons:</p>
<pre>cd ~/tmp
git clone git://github.com/mongodb/mongo.git
cd mongo
scons all
sudo scons --prefix=/opt/mongo install</pre>
<p>If all goes well, MongoDB should install to /opt/mongo. In /opt/mongo/bin you&#8217;ll see a mongod executable, which when executed starts the mongo daemon.</p>
<p>Create a location to store the mongodb database(s). I&#8217;m just testing so I created it in my home directory. You can create it anywhere you want, providing the user starting mongod can read and write to it.</p>
<pre>mkdir -p ~/testing/mongo/data/db</pre>
<p>Start mongo, as your user</p>
<pre>/opt/mongo/bin/mongod --dbpath ~/testing/mongo/data/db</pre>
<p>Mongodb should spit out some startup information, telling you there is a web interface listening on port 28017 (browse to http://localhost:28017, or the IP of the system, for the results). Hit Ctrl-c to kill mongod when done.</p>
<h4>Help and keeping up-to-date</h4>
<p>To get some basic mongod help:</p>
<pre>/opt/mongo/bin/mongod --help</pre>
<p>To keep up to date, switch to your mongo source directory (~/tmp/mongo in my case) and:</p>
<pre>git pull</pre>
<p>Then rebuild.</p>
<h4 id="install-a-php-driver">Install a PHP driver</h4>
<p>The <a href="http://php.net/mongo">PHP Mongo driver</a> can be installed using PECL:</p>
<pre>sudo pecl install mongo</pre>
<p>and follow the instructions.</p>
<p>Now for some testing!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codem.com.au/streams/2009/testing/building-mongodb-on-ubuntu.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

