Tag: WEBrick

  • Ruby on Rails – Installation using RVM

    Ruby Version Manager (RVM) is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.

    Steps for Installation
    Open terminal and run following commands.

    • Step 1
      $ sudo apt-get install build-essential git-core curl
    • Step 2
      RVM Installation
      $ curl -L get.rvm.io | bash -s stable
    • Step 3
      $ echo ‘[[ -s “$HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/rvm”‘ >> ~/.bashrc
    • Step 4
      $ ~/.bashrc
    • Step 5
      $ . ~/.bashrc
    • Step 6
      Check requirements for Ruby
      $ rvm requirements
    • Step 7
      Install requirements of Ruby by RVM
      $ sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
    • Step 8
      Install Ruby with 1.9.3 version
      $ rvm install 1.9.3
    • Step 9
      Check Rubygems version. Its installed with Ruby.
      $ gem -v
      1.8.24
    • Step 9
      Install Rails latest version
      $ rvm gem install rails
    • Step 10
      Check version of Ruby, Rails and Rubygems
      $ ruby -v
      ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
      $ gem -v
      1.8.24
      $ rails -v
      Rails 3.2.8

    Installation is complete. Now try RoR Apps.
    If you find any error between steps then share it as comments.
    Thanks for using this post.

  • Installation Steps for Ruby on Rails

    Steps to install Ruby on Rails

    1) Setting up the Rails development environment

    Ruby, rubygems, rails and other required packages can be installed by :

    1. sudo apt-get install build-essential
    2. $ sudo apt-get install ruby-full
    3. $ cd Downloads
    4. $ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
    5. $ tar xzvf rubygems-1.8.24.tgz
    6. $ sudo mv rubygems-1.8.24 /usr/local/src
    7. $ cd 
    8. $ cd /usr/local/src
    9. $ cd rubygems-1.8.24
    10. $ sudo ruby setup.rb
    11. $ sudo update-alternatives –install /usr/bin/gem gem /usr/bin/gem1.8 1 
      If you got error in this step (ERROR: update-alterntives:error: unknown argument ‘–install’),   then retype ‘–‘ (Two Hyphens) before install
    12. $ sudo gem install rails

    2) Setting up MySQL Database

    If you have already installed Mysql then ignore this step.

    $ sudo apt-get install mysql-server

    Well you have now install Ruby on Rails ,Now its time to test it. So Create a Rails’s application .Here name of Rails application is new ,you can give your own name.

    Go to place where you want to create Ruby on Rails application and run these commands in terminal :

    rails new
    cd new
    rails server

    The rails server command launches a small web server named WEBrick which comes bundled with Ruby. You’ll use this any time you want to view your work through a web browser.
    This command will give you the following output in terminal

    => Booting WEBrick => Rails 3.0.0 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server [2010-04-18 03:20:33] INFO WEBrick 1.3.1 [2010-04-18 03:20:33] INFO ruby 1.8.7 (2010-01-10) [x86_64-linux] [2010-04-18 03:20:33] INFO WEBrick::HTTPServer#start: pid=26086 port=3000

    With just three commands we whipped up a Rails server listening on port 3000. Go to your browser and open http://localhost:3000, you will see a basic rails app running.
    Congratulations ,You are now running Ruby on Rails.
    If you want to stop server then Press Ctrl+C in terminal

    Continue to Configuring the Database in Ruby on Rails.