Ruby on Rails Quick Start

Installing ruby on rails requires a few steps, the first of which is installing the ruby framework. Ruby is a programming language that can be downloaded and installed from the ruby website. We recommend compiling from source, since it will tailor the installation to your system’s specifications. Or, you can install the copy from your local machine’s package manager. Below is an example of a seource install

wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
tar –xzvf ruby-1.9.3-p0.tar.gz
cd ruby-1.9.3-p0
./configure --prefix=/usr/local
make
make install

Next you will need to install the rubygems application. Ruby gems is the package manager for the ruby platform, and can be easily used to install various ruby packages. This would be similar to the perl CPAN, but ruby’s implementation of it. After you download and unzip rubygems install it in the following manner

ruby setup.rb

Now you should be able to invoke the “gem” command. If you installed your ruby into /usr/local, then it should already be in your path

[root@computer rubygems-1.8.17]# which gem
/usr/local/bin/gem

Next we will need to install the rails framework, hence ruby on rails. Rails is easily installed via the gem package manage we installed previously. Install rails as follows

gem install rails

All gems needed for the rails framework will be installed accordingly.

...
Successfully installed mail-2.4.1
Successfully installed actionmailer-3.2.1
Successfully installed thor-0.14.6
Successfully installed rack-ssl-1.3.2
Successfully installed railties-3.2.1
Successfully installed bundler-1.0.22
Successfully installed rails-3.2.1
28 gems installed

Now we can create our first rails project using the “rails new” command as follows

rails new /var/www/rails-test
      create
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/images/rails.png
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/mailers
...

Any dependencies that are needed for the project will be installed at this time. And from here on out, your rails project can be developed upon.

At this point you are ready to start your project. Enjoy the ruby on rails fun.

Be the first to comment

Leave a Reply