<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Enjoying Rails &#187; Ubuntu</title>
	<atom:link href="http://blog.erichsen.net/tag/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.erichsen.net</link>
	<description>I really do...</description>
	<lastBuildDate>Sun, 08 May 2011 07:35:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.erichsen.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Enjoying Rails &#187; Ubuntu</title>
		<link>http://blog.erichsen.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.erichsen.net/osd.xml" title="Enjoying Rails" />
	<atom:link rel='hub' href='http://blog.erichsen.net/?pushpress=hub'/>
		<item>
		<title>Automatic Rails on Ubuntu 8.04 LTS</title>
		<link>http://blog.erichsen.net/2008/10/16/automatic-rails-on-ubuntu-804-lts/</link>
		<comments>http://blog.erichsen.net/2008/10/16/automatic-rails-on-ubuntu-804-lts/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 20:32:11 +0000</pubDate>
		<dc:creator>enjoyingrails</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://enjoyingrails.wordpress.com/?p=17</guid>
		<description><![CDATA[A couple of weeks ago there was a post on the FiveRuns blog about automatically installing the Rails stack on an Ubuntu 8.04 VPS. I prefer to use Passenger and Ruby Enterprise Edition when running my Rails app, so inspired by the FiveRuns script I wrote my own version &#8211; here is the gist on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=17&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago there was a <a href="http://blog.fiveruns.com/2008/9/24/rails-automation-at-slicehost">post</a> on the FiveRuns blog about automatically installing the Rails stack on an Ubuntu 8.04 VPS.</p>
<p>I prefer to use Passenger and Ruby Enterprise Edition when running my Rails app, so inspired by the FiveRuns script I wrote my own version &#8211; here is the <a href="http://gist.github.com/16225">gist on github</a>.</p>
<p><code><br />
#!/bin/bash<br />
# Inspired by http://blog.fiveruns.com/2008/9/24/rails-automation-at-slicehost</p>
<p>apt-get update<br />
apt-get upgrade -y<br />
apt-get -y install build-essential libssl-dev libreadline5-dev zlib1g-dev<br />
apt-get -y install mysql-server libmysqlclient15-dev mysql-client<br />
apt-get -y install ruby ruby1.8-dev irb ri rdoc libopenssl-ruby1.8 </p>
<p>RUBYGEMS="rubygems-1.3.0"<br />
wget http://rubyforge.org/frs/download.php/43985/$RUBYGEMS.tgz<br />
tar xzf $RUBYGEMS.tgz<br />
cd $RUBYGEMS<br />
ruby setup.rb<br />
cd ..</p>
<p># Install Ruby Enterprise Edition<br />
wget http://rubyforge.org/frs/download.php/41040/ruby-enterprise-1.8.6-20080810.tar.gz<br />
tar xvzf ruby-enterprise-1.8.6-20080810.tar.gz<br />
yes '' | ./ruby-enterprise-1.8.6-20080810/installer</p>
<p># Install Passenger<br />
/usr/bin/gem1.8 install -v=2.0.3 passenger --no-rdoc --no-ri<br />
apt-get -y install apache2-mpm-prefork apache2-prefork-dev<br />
yes '' | passenger-install-apache2-module </p>
<p># Create sample Rails app<br />
/usr/bin/gem1.8 install rails --no-rdoc --no-ri<br />
cd /var/www<br />
rails -d mysql hello<br />
cd hello<br />
./script/generate controller welcome hello<br />
echo "Hello World" &gt; app/views/welcome/hello.html.erb<br />
rake db:create RAILS_ENV=production</p>
<p># Create the Apache2 Passenger module files<br />
cat &gt;&gt; /etc/apache2/mods-available/passenger.load &lt;&gt; /etc/apache2/mods-available/passenger.conf &lt;&lt;-EOF</p>
<p>  PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3<br />
  PassengerRuby /opt/ruby-enterprise-1.8.6-20080810/bin/ruby</p>
<p>EOF<br />
a2enmod passenger</p>
<p># Create a site file for the sample Rails app<br />
IP_ADDRESS=`ifconfig eth0 | sed -n 's/.*dr:\(.*\)  Bc.*/\1/p'`<br />
cat &gt;&gt; /etc/apache2/sites-available/hello &lt;&lt;-EOF</p>
<p>      ServerName www.yourhost.com<br />
      DocumentRoot /var/www/hello/public</p>
<p>EOF<br />
a2ensite hello</p>
<p># That's it!<br />
reboot<br />
</code></p>
<p>The script assumes that you have ssh access as root to a clean Ubuntu 8.04 install.</p>
<p>The script will install</p>
<ul>
<li>Ruby 1.8.6</li>
<li>RubyGems 1.3.0</li>
<li>Passenger 2.0.3</li>
<li>Ruby Enterprise Edition 20080810</li>
<li>Apache 2.2.8</li>
<li>MySQL 5.0.51a</li>
<li>A sample Rails app</li>
</ul>
<p>Note that the Passenger installer will install the latest Rails (2.1.1) and a bunch of other useful gems.</p>
<p>Assuming that your server IP address is 192.168.185.128 you can run it like this:<br />
<code><br />
ssh root@192.168.185.128 "wget -O - http://gist.github.com/raw/16225/a6a16b3a38cd3486679b96fa0f3446e58f3b8423 | sed -e s/$'\r'//g &gt; install.sh; /bin/bash install.sh; rm install.sh"<br />
</code><br />
Sit back and enjoy &#8211; in less than ten minutes you will have the full Rails stack and a sample Rails app running. Take a look at it on <a href="http://192.168.185.128/welcome/hello">http://192.168.185.128/welcome/hello</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/enjoyingrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/enjoyingrails.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/enjoyingrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/enjoyingrails.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/enjoyingrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/enjoyingrails.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/enjoyingrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/enjoyingrails.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/enjoyingrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/enjoyingrails.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/enjoyingrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/enjoyingrails.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/enjoyingrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/enjoyingrails.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=17&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.erichsen.net/2008/10/16/automatic-rails-on-ubuntu-804-lts/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2047f0076ea63c7d1a35373bac6f9841?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">enjoyingrails</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating an Amazon EC2 Ubuntu 6.06 LTS server edition image</title>
		<link>http://blog.erichsen.net/2007/11/04/creating-an-amazon-ec2-ubuntu-606-lts-server-edition-image/</link>
		<comments>http://blog.erichsen.net/2007/11/04/creating-an-amazon-ec2-ubuntu-606-lts-server-edition-image/#comments</comments>
		<pubDate>Sun, 04 Nov 2007 16:04:39 +0000</pubDate>
		<dc:creator>enjoyingrails</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Amazon EC2]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.erichsen.net/2007/11/04/creating-an-amazon-ec2-ubuntu-606-lts-server-edition-image/</guid>
		<description><![CDATA[Last week I decided to try out Amazon EC2 mainly for running and testing Rails applications and so far it has been great fun! This blog posting describes how I created an Ubuntu 6.06 LTS server edition image for use with Amazon EC2. Download and install the EC2 command line tools curl -O http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip mkdir [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=11&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last week I decided to try out Amazon EC2 mainly for running and testing Rails applications and so far it has been great fun!</p>
<p>This blog posting describes how I created an Ubuntu 6.06 LTS server edition image for use with Amazon EC2.</p>
<p>Download and install the EC2 command line tools<br />
<code><br />
curl -O http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip<br />
mkdir ~/.ec2<br />
cd ~/.ec2<br />
unzip ec2-api-tools.zip<br />
ln -s ec2-api-tools-1.2-13740 ec2-api-tools</code></p>
<p>Set the environment variables necessary to run the tools<br />
<code><br />
export EC2_HOME=~/.ec2/ec2-api-tools<br />
export PATH=$PATH:$EC2_HOME/bin<br />
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home/<br />
</code><br />
Download your private key and certificate from your Amazon Web Services account to the ~/.ec2 folder.</p>
<p>Generate a key pair<br />
<code><br />
export EC2_PRIVATE_KEY=~/.ec2/pk-8WU9XGOPO65IKA7O96M2KEKVOS5288KU.pem<br />
export EC2_CERT=~/.ec2/cert-8WU9XGOPO65IKA7O96M2KEKVOS5288KU.pem<br />
mkdir ~/.ec2<br />
ec2-add-keypair gsg-keypair &gt; ~/.ec2/id_rsa-gsg-keypair<br />
chmod 600 ~..ec2/id_rsa-gsg-keypair<br />
</code></p>
<p>Launch a <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=517&amp;categoryID=101">Fedora Core 4: Base</a> instance.<br />
<code><br />
ec2-run-instances ami-20b65349 -k gsg-keypair<br />
</code><br />
This returns an instance number like i-9536dcfc.</p>
<p>Try running<br />
<code><br />
ec2-describe-instances i-9536dcfc<br />
</code><br />
until the status returned is no longer &#8216;pending&#8217; but &#8216;running&#8217;.</p>
<p>Allow ssh access and log in<br />
<code><br />
ec2-authorize default -p 22<br />
ssh -i ~/.ec2/id_rsa-gsg-keypair root@ec2-67-202-21-218.compute-1.amazonaws.com<br />
</code></p>
<p>On the EC2 instance run<br />
<code><br />
wget http://erichsen.net/blog/fc4-base<br />
chmod 755 fc4-base<br />
./fc4-base<br />
</code><br />
fc4-base is a script found in this forum <a href="http://developer.amazonwebservices.com/connect/thread.jspa?messageID=48741">posting</a>. I adapted it to create an Ubuntu 6.06 image instead of 6.10.</p>
<p>After the script has finished execution copy the private key and certificate from the local machine to the EC2 instance<br />
<code><br />
scp -i ~/.ec2/id_rsa-gsg-keypair ~/.ec2/pk-8WU9XGOPO65IKA7O96M2KEKVOS5288KU.pem root@ec2-67-202-21-218.compute-1.amazonaws.com:/root/<br />
scp -i ~/.ec2/id_rsa-gsg-keypair ~/.ec2/cert-8WU9XGOPO65IKA7O96M2KEKVOS5288KU.pem  root@ec2-67-202-21-218.compute-1.amazonaws.com:/root/<br />
</code></p>
<p>Create an image and sign it with the private key<br />
<code><br />
ec2-bundle-image -i /mnt/ubuntu606base.img -k /root/pk-8WU9XGOPO65IKA7O96M2KEKVOS5288KU.pem -c cert-8WU9XGOPO65IKA7O96M2KEKVOS5288KU.pem -u '5171-9220-6573'<br />
</code></p>
<p>The image must be stored on S3 so I create a bucket (from my local Mac)<br />
<code><br />
sudo gem i aws-s3 -y<br />
export AMAZON_ACCESS_KEY_ID="1IQ8AHOAWNRDMQOI91ZK"<br />
export AMAZON_SECRET_ACCESS_KEY="VCddmbA9C4D8w/mw6aLZjzCkMoEyx5EUvouJdY/4"<br />
s3sh<br />
Bucket.create('erichsen.net')</code></p>
<p>On the EC2 instance I upload the image<br />
<code><br />
ec2-upload-bundle -b erichsen.net -m /tmp/ubuntu606base.img.manifest.xml -a '1IQ8AHOAWNRDMQOI91ZK' -s 'VCddmbA9C4D8w/mw6aLZjzCkMoEyx5EUvouJdY/4'<br />
</code></p>
<p>From my local Mac I register the instance and that&#8217;s it!<br />
<code><br />
ec2-register erichsen.net/ubuntu606base.img.manifest.xml<br />
</code></p>
<p>The ec2-register returns an AMI id &#8211; in this case ami-4acd2823. Let&#8217;s try it out<br />
<code><br />
ec2-run-instances ami-4acd2823 -k gsg-keypair<br />
ec2-describe-instances i-9536dcfc<br />
ssh -i ~/.ec2/id_rsa-gsg-keypair root@ec2-67-202-24-151.compute-1.amazonaws.com<br />
</code></p>
<p>YES! I was able to ssh into an EC2 instance running my Ubuntu 6.06 image! Note that the ssh configuration of the image is not the best &#8211; it allows root logins which is not in general a good idea.</p>
<p>Hope this helps someone else wanting to play with Ubuntu on EC2.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/enjoyingrails.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/enjoyingrails.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/enjoyingrails.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/enjoyingrails.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/enjoyingrails.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/enjoyingrails.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/enjoyingrails.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/enjoyingrails.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/enjoyingrails.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/enjoyingrails.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.erichsen.net&amp;blog=1936559&amp;post=11&amp;subd=enjoyingrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.erichsen.net/2007/11/04/creating-an-amazon-ec2-ubuntu-606-lts-server-edition-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2047f0076ea63c7d1a35373bac6f9841?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">enjoyingrails</media:title>
		</media:content>
	</item>
	</channel>
</rss>
