Translate

August 29, 2012

How to install Ruby on rails in Windows 7

Introduction:
This is a step by step tutorial that will let you install Ruby on rails 3 in your Windows 7. These steps ease the installation process.

Steps:
  • Download Ruby Windows installer from ruby-lang.org
  • Select version 1.9.3, which is the most recommended and stable release for Windows. 
    When installing this software, make sure to check "Add Ruby to PATH".
  • After installing Ruby, open CMD and check if you Ruby is accessible by executing the following command:
  • ruby -v

    If it works fine you should see the version number of Ruby
  • Then check if you can access gem command by executing:
  • gem -v
  • As you will see, probably the gem version installed by default if this is not the latest, you need to update gem like this:
  • gem update --system
  • Now you are ready to install Ruby on rails, without rdoc and ri documents. By executing following command
  • gem install rails --no-ri --no-rdoc

    Ruby on rails works with SQLite by default but we will use MySQL.
  • In order to let you use both, let us download SQLite and then configure MySQL.  Download SQLite dlls from sqlite.org, unzip them and copy them to:
  • c:\<your_ruby_dir>\bin
  • Now you should install SQLite gem:
  • gem install sqlite3-ruby
  • Now it is time for MySQL. Go to the MySQL website and download the community edition and after installing it in your OS, download this libMySQL.dll and copy it into the same location you put the SQLite dlls
  • c:\<your_ruby_dir>\bin
  • Now install the MySQL gem. To install the mysql gem execute:
  • gem install mysql
  • Now we are ready to create a testing project in rails. Since we are going to use MySQL as DB, we should then execute:  
  • rails new my_first_project -d mysql
Post a Comment