Ubuntu 12.04 Precise Pangolin Ruby on Rails Server Configuration

note from Thu Aug 30, 2012

Here are the notes for configuring my Ubuntu 12.04 installations for Ruby on Rails + MySql + Passenger + Apache. It is a base installation plus a few other things that I find always necessary for my projects. This was current as of the date the notes were made, so version numbers of things like rubygems might be different now, but I kept the notes as-is because these were known the compatible versions at that time. If there any issues when using the current versions of some of the gems, I would recommend specifying specific version numbers of those gems that were current as of August 2012.

# update apt-get list
sudo apt-get update

# all packages at once, will still have to enter mysql root pw
sudo apt-get install emacs23-nox ruby ri rdoc irb ruby-dev apache2.2-common apache2-mpm-prefork apache2-prefork-dev apache2-utils libapr1-dev mysql-common mysql-server mysql-client libmysql-ruby libmysqlclient15-dev build-essential manpages-dev git-core libopenssl-ruby imagemagick libmagickcore-dev libmagickwand-dev libxml2 libxml2-dev libxslt1.1 libxslt1-dev -y

# rubygems
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz; tar zxvf rubygems-1.8.24.tgz; cd rubygems-1.8.24; sudo ruby setup.rb; cd ..; sudo ln -s /usr/bin/gem1.8 /usr/bin/gem; sudo gem update --system

# rails 2: gems (rails separately if specific version is needed)
# sudo gem install rails -v 2.3.5; sudo gem install mysql passenger rmagick aws-s3 will_paginate

# rails 3: use bundler
sudo gem install bundler
sudo gem install rake
# sudo gem install rails

# rails 3 asset pipe requires a supported JS engine
sudo gem install therubyracer

# deploy, then
sudo bundle install

# passenger
sudo gem install passenger

# passenger apache module
sudo passenger-install-apache2-module

# capture the following from above and add to apache.conf
# LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.15/ext/apache2/mod_passenger.so
# PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.15
# PassengerRuby /usr/bin/ruby1.8

# add virtual host block similar to the one below
# <VirtualHost *:80>
#    ServerName www.yourhost.com
#    # !!! Be sure to point DocumentRoot to 'public'!
#    DocumentRoot /somewhere/public    
#    <Directory /somewhere/public>
#       # This relaxes Apache security settings.
#       AllowOverride all
#       # MultiViews must be turned off.
#       Options -MultiViews
#    </Directory>
# </VirtualHost>

# config apache
# enable sites
# disable default site
# enable rewrite mod with a2enmod rewrite

# java, if necessary
sudo apt-get install openjdk-7-jre

# solr-jetty (requires java)
sudo apt-get install solr-jetty
# copy schema.xml to /etc/solr/conf
# edit /etc/default/jetty

# install postfix if necessary
# remember to change smtpd_use_tls=no in /etc/postfix/main.cf
sudo apt-get install postfix
tags: #linux #ubuntu #server #config #passenger #apache

What I'm reading now

A friend recommended "The Little Schemer." The book sets out to teach good recursive thinking through the Scheme programming language. It's slow reading for me, but I am quite enjoying it. I'm learning quite a lot from it. Here's a link to it on Amazon where you can read more about it.

Rails books

This is the grandaddy of the Ruby on Rails books. Most Rails developers I know (including myself) started with this one.

I also like the Rails Recipes book from the same publisher, as it gives real world problems that I can relate to and then sample solutions. There doesn't seem to be a Rails 4 edition yet. Here is the most recent one that I've found.