<?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>Paul Moser &#187; Ruby-on-Rails</title>
	<atom:link href="http://blog.paulmoser.co.uk/index.php/category/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.paulmoser.co.uk</link>
	<description>So much to learn but so little time</description>
	<lastBuildDate>Thu, 17 Sep 2009 21:28:01 +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>Ruby-on-Rails on Ubuntu 8.04</title>
		<link>http://blog.paulmoser.co.uk/index.php/2008/10/31/ruby-on-rails-on-ubuntu-804/</link>
		<comments>http://blog.paulmoser.co.uk/index.php/2008/10/31/ruby-on-rails-on-ubuntu-804/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 12:59:56 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby-on-Rails]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.paulmoser.co.uk/index.php/2008/10/31/ruby-on-rails-on-ubuntu-804/</guid>
		<description><![CDATA[Every time I build an Ubuntu machine I have to figure out all over again how to get it to work &#8211; so this time I&#8217;ll write the steps down!
Install the packages: postgresql, rake, ruby, rubygems, rcov, git-core
Update the RubgyGems distribution by running

sudo gem update --system

If you run gem now  you&#8217;ll get the nasty [...]]]></description>
			<content:encoded><![CDATA[<p>Every time I build an Ubuntu machine I have to figure out all over again how to get it to work &#8211; so this time I&#8217;ll write the steps down!</p>
<p>Install the packages: postgresql, rake, ruby, rubygems, rcov, git-core</p>
<p>Update the RubgyGems distribution by running<br />
<code><br />
sudo gem update --system<br />
</code></p>
<p>If you run gem now  you&#8217;ll get the nasty looking error:<br />
<code><br />
/usr/bin/gem:10:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009<br />
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)<br />
</code></p>
<p>You need to edit /usr/bin/gem and add an extra require:<br />
<code><br />
require 'rubygems/gem_runner'<br />
</code></p>
<p>Install the Postgres driver:<br />
<code><br />
sudo gem install postgres-pr<br />
</code></p>
<p>You&#8217;ll need to change where  Postgres writes it&#8217;s socket file, if you leave things unchanged you&#8217;ll see the error:<br />
<code><br />
No such file or directory - /tmp/.s.PGSQL.5432<br />
</code></p>
<p>when attempting to connect to the database. </p>
<p>Edit <code>/etc/postgresql/8.3/main/postgresql.conf</code> and alter the unix_socket_directory parameter:<br />
<code><br />
unix_socket_directory = '/tmp'<br />
</code></p>
<p>Restart Postgres using the init script /etc/init.d/postgresql-8.3</p>
<p>You should be able to leave your pg_hba.conf file unchanged &#8211; it should already look like:</p>
<p><code><br />
# Database administrative login by UNIX sockets<br />
local    all         postgres                          ident sameuser<br />
# "local" is for Unix domain socket connections only<br />
local    all         all                               ident sameuser<br />
# IPv4 local connections:<br />
host    all         all         127.0.0.1/32          md5<br />
# IPv6 local connections:<br />
host    all         all         ::1/128               md5<br />
</code></p>
<p>You need to create a database user, and give that user a password and create a database. As the postgres user:<br />
<code><br />
createuser  -lqs db_username<br />
createdb -O db_username db_name<br />
psql -c "alter user db_username with password 'db_password';"<br />
</code><br />
In the last command above make sure you don&#8217;t miss the &#8216;;&#8217; character, if you miss it the statement isn&#8217;t actually executed, you should see the command confirmed with ALTER ROLE.</p>
<p>In you Rails application database.yml you need to specify the database name, database username and password and the host (even if it&#8217;s localhost)<br />
<code><br />
development:<br />
  adapter: postgresql<br />
  encoding: unicode<br />
  database: db_name<br />
  host: localhost<br />
  username: db_username<br />
  password: db_password<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.paulmoser.co.uk/index.php/2008/10/31/ruby-on-rails-on-ubuntu-804/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
