Check out the Latest Articles:
Ruby on Rails Installation Tutorial Part 2 – Installing Rails 2.0 on Windows (Advanced Setup)

In part 1 of this series we showed you the Easy way of setting up a Rails 2.0 development environment using InstantRails. Today we are going to cover a more advanced way of setting up a Rails 2.0 development environment on your Window machine.

Ruby on Rails on Windows the Advanced Way

Installing Ruby and Gems

Head over to the download page on rubyonrails.org and grab the newest stable version of the Windows installer (At present 1.8.6-26).

Once this downloads go a head and run the installer using all the defaults. This puts ruby in C:\ and installs ruby gems. This may take some time depending on your machine.

installer

Once this finishes we need to update gem. To do this open up a command prompt (Start -> Run -> cmd) and type:

gem update –system

updatesystem

Installing Rails

Once gem is updated we can start installing the other components of the environment. We will start with Rails. In the same command prompt we just used type:

gem install rails

installrails

This takes some time and at times looks like it might have frozen up, but it hasn’t. It just takes a little bit. Go grab a drink with all this free time.

Installing A Database

Once you’re done with your drink and rails has installed its time to install a database. There are two simple options for this, SQLite3 and MySQL. SQLite is the default database that Rails uses. MySQL is the database that most people hear about in the web world because of its inclusion in the LAMP (Linux, Apachy, MySQL, PHP) architecture. I would recommend using SQLite for the first time user. Its easier to use since Rails defaults to use it as I mentioned before.

Installing SQLite

To install SQLite head over to www.sqlite.org and navigate to the download page and grab the latest SQLite Command Line Tool and SQLite DLL (At present both are at version 3.6.11). Unzip both and put the contents into the ruby\bin folder.

sqlitefiles

Now we can use install the sqlite3-ruby gem. Using the command prompt again type:

gem install sqlite3-ruby -v 1.2.3

sqliteinstall

Installing MySQL

To install MySQL head over to www.mysql.com and navigate to the download page and get the latest version of MySQL Community Server (Presently at 6.0, but we’ll use 5.1)

Run the installer.

mysqlsetup

Once this is done we will use the command prompt one last time to make sure we have the MySQL adapter. To do this, in the command prompt, type:

gem install mysql

mysqlgem

Congratulations you are all set up and ready to start coding some Ruby on Rails!

Creative Commons License photo credit: MissTurner



  1. Tagnu on Friday 6, 2009

    Thank you for the tutorial. :)

    Please include how to integrate mysql with RoR in the tutorial.

    People would find it very helpful, I got errors initially about sqlite missing

    I found the following link useful.
    http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html?page=2

  2. Daniel on Friday 6, 2009

    Thanks for the kind words. We’re going to be sticking with installation for these tutorials to make sure everyone can follow along with our future Rails tutorials regardless of platform, but if your itching to start a project and want to use MySQL, first install it like I show above and then use the -d option when creating your project, like so:

    rails -d mysql ‘project name’

    You should be all set with your new project using MySQL now.

  3. Aqab Bin Talal on Friday 6, 2009

    For installing on win98 you’ll have to hack one line in ruby-gems and one line in rails, both lines ask windows to return the user-home-path; that works find in winXP but not in good-old win98.

    In “rubygems-update-1.3.2\lib\rubygems.rb” the command: File.expand_path(“~”) will not work. It should return “C:\” on a normal win98.

    Also define a HOME environment variable, add the following line to autoexec.bat:
    SET HOME=c:\

    There is a win32 library call to a function that doesn’t work in win98 but unfortunately I can’t find its location any more, all it does is ask for the user directory; replace it with “c:\” and it will work.

    I put my sqlite3.dll in c:\windows\system and sqlite3.exe in c:\windows\ works fine for me.


  4. PillSpot.org. Canadian Health&Care.No prescription online pharmacy.Best quality drugs.Special Internet Prices. No prescription pills. Buy drugs online

    Buy:Synthroid.Zovirax.Nexium.Prevacid.Arimidex.Zyban.Valtrex.Prednisolone.Retin-A.Human Growth Hormone.100% Pure Okinawan Coral Calcium.Actos.Petcam (Metacam) Oral Suspension.Lumigan.Accutane.Mega Hoodia….