Download the Ubuntu 10.04.3 LTS 64 bit Server ISO from here and install it. Install the "LAMP Server" and "OpenSSH Server" packages when prompted.
Install prerequisites
sudo apt-get install build-essential libyaml-dev zlib1g-dev libcurl4-openssl-dev libssl-dev libopenssl-ruby apache2-prefork-dev libapr1-dev libaprutil1-dev
Download the Ruby source code and compile it
cd ~
mkdir ruby_src
cd ruby_src
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
tar -zxvf ruby-1.9.3-p0.tar.gz
cd ruby-1.9.3-p0
./configure
make
sudo make install
mkdir ruby_src
cd ruby_src
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
tar -zxvf ruby-1.9.3-p0.tar.gz
cd ruby-1.9.3-p0
./configure
make
sudo make install
Verify Ruby installed correctly
ruby -v
Expected output is "ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]"
Download the RubyGems source code and compile it
cd ~
mkdir rubygems_src
cd rubygems_src
wget http://rubyforge.org/frs/download.php/75573/rubygems-1.8.12.tgz
tar -zxvf rubygems-1.8.12.tgz
cd rubygems-1.8.12
sudo ruby setup.rb
mkdir rubygems_src
cd rubygems_src
wget http://rubyforge.org/frs/download.php/75573/rubygems-1.8.12.tgz
tar -zxvf rubygems-1.8.12.tgz
cd rubygems-1.8.12
sudo ruby setup.rb
Verify RubyGems installed correctly
gem -v
Expected output is "1.8.12"
Install Rails
sudo gem install rails
Verify Rails installed correctly
rails -v
Expected output is "Rails 3.1.3"
Install Phusion Passenger
sudo gem install passenger
sudo passenger-install-apache2-module
sudo passenger-install-apache2-module
Configure Apache by adding these lines to /etc/apache2/apache2.conf
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11
PassengerRuby /usr/local/bin/ruby
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11
PassengerRuby /usr/local/bin/ruby
Configure your rails application by adding these lines to /etc/apache2/apache2.conf, assuming the name of your app is Mytest. Make sure to change the ServerName to the name of the server.
<VirtualHost *:80> ServerName www.yourhost.com DocumentRoot /usr/local/mytest/public <Directory /usr/local/mytest/public> AllowOverride all Options -MultiViews </Directory> </VirtualHost>
Restart Apache
sudo /etc/init.d/apache2 restart
Modify the Gemfile to include execjs and therubyracer if needed. Then run "sudo bundle install"
Rails application housekeeping
sudo bundle update
RAILS_ENV=production rake db:create db:schema:load
rake assets:precompile
sudo /etc/init.d/apache2 restart
RAILS_ENV=production rake db:create db:schema:load
rake assets:precompile
sudo /etc/init.d/apache2 restart