In the previous post of RoR, we have studied about what is ruby on rails. In
this post we will see, how to install ruby on rails on localhost on windows machine.
Following are the steps required for ror installation -
1. Install Ruby & Gems
2. Install Rails
3. Install appropriate Database Engine
That’s it.
Lets see each installation in detail.
1. Install Ruby: You need to download latest version of Ruby installer. For windows there is an RubyInstaller.exe file and for linux chm file is also available to download.
Click on the download Link -
Download
This will install Ruby under C:\ruby, and install RubyGems for you. The README at the end of the installation will show you all the versions of each piece that it installed.
Now you can check to see that c:\ruby\bin is in your PATH by typing “path” at a command prompt. This will ensure that you can run ruby.exe from anywhere (which you’ll need to run from your project root).
2. Install Rails: Rails installation is easy and simple. Rails provide gems that can be direct install from command prompt.
C:\>gem install rails
Rails installation takes some time. After few min you can see this message on your command prompt.
“Successfully installed rails-2.3.8″
This will install all the code, test code, ri documentation, and RDoc documentation for Rails.
3. Install Database Engine:
Rails is completely DB-agnostic, it supports SQLite and MySQL both. We’ll see how to install two of the more popular Database Engines: SQLite and MySQL.
SQLite is the default database type that Rails looks for.
Installation of SQLite3 -
You need two files from the SQLite download page:
1. SQLite Command Line Tool
2. SQLite DLL
Unzip them and put the three extracted files in your ruby\bin directory (usually at C:\ruby\bin). Now install the sqlite3-ruby gem:
C:\>gem install sqlite3-ruby -v 1.2.3
Installation of MySQL -
Download MySQL Community Server and install it. If you also do PHP programming, check out WAMP for an easy installation as well.
To use MySQL in Rails versions greater than 2.1, you’ll also need the MySQL adapter:
C:\> gem install mysql
Since mysql is not a default database setup in rails so we need to change in database.yml file.
Create First Application :
Its quite easy to setup. Type following in command prompt.
C:\> rails myappname
This will build a directory, in which it will build the entire blank Rails project skeleton. To see your fresh project in action, navigate to your project root and run script\server:
C:\> cd myappname C:\> ruby script\server
Then, navigate to http://localhost:3000/ in your browser, and you should see the default Rails “Welcome Aboard” page.
Rails uses the SQLite3 adapter and creates the DB in the db directory. If you look at your database.yml file (in \config), you’ll see a database entry for your development, test, and production databases.
development: adapter: mysql encoding: utf8 reconnect: false database: ruby pool: 5 username: root password: host: localhost
Set to mysql if you are using mysql database.
This was the complete installation of ruby on rails on windows. RoR is not difficult language, its tricky. Hope this tutorial steps help you in ror installation.
Cheers









July 26th, 2010 at 5:38 am
Thank you amit for sharing such a wonderful and useful information with us, I was struggling for installing ROR on my windows 7 pc and your post helps me a lot.
It is working now and I can now start working on the ROR project.
Thanks again
keep rocking
Vaibhav
July 26th, 2010 at 5:44 am
Thank U Sir..
Soon I’ll post demo application of ror development.
Keep Visiting.