Installing Ruby on Rails (RoR) 4.0 requires the following steps.

  1. Install updated version of bundler
  2. Installing rails 4.0
  3. Creating a new project
  4. Create .htaccess
  5. Create symlink
  6. Modify group/permissions

Via PHP Shell

Install updated version of bundler

Rails 4.0 requires a newer version of bundler than the one that comes with the Web Hosting Ruby.

% gem install --no-rdoc --no-ri bundler
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
1 gem installed

Install RoR

Install a copy of the rails 4.0 gem files.

gem install --no-rdoc --no-ri rails

Create new project

Create a new project outside of the htdocs area that will be used for development.

% ~/bin/rails new /www/myrailsapp/myrailsapp --database=mysql
...
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!

Create a .htaccess file

Create an .htaccess file that contains the necessary configuration.

% cat /www/myrailsapp/myrailsapp/public/.htaccess
PassengerAppRoot /www/myrailsapp/myrailsapp
RackEnv development
Options -MultiViews

Create a symlink from virtual host DocumentRoot

If you have a site myrailsappdev.hosting.cornell.edu that has a document root of "myrailsappdev" you will want to create a symlink from the htdocs folder to your rails app. You can do this to create separate dev/test that run under the same instance or create separate instances for each.

% cd /www/myrailsapp/htdocs/
% ln -s /www/myrailsapp/myrailsapp/public myrailsappdev

Configure mysql database

Configure the database name/username/password.

% cat /www/myrailsapp/myrailsapp/config/database.yml
...
development:
  adapter: mysql2
  encoding: utf8
  database: myrailsapp_development
  pool: 5
  username: myrailsapp
  password: [password]
  socket: /var/lib/mysql/mysql.sock
...

Configure permissions

If you installed using "lamp" you will need to make the "log" and "tmp" directory writable by the web server.

% cd /www/myrailsapp/myrailsapp
% chgrp lampgrp tmp log
% chmod g+s tmp log