Click to find out more about our Work
July 9th, 2008

Tutorial : Installing Ruby on Rails 2 in Windows Vista/XP

23 Comments

Greetings,

Most of you must have heard of “Ruby on Rails (RoR)”. It being touted as the next best thing (apart from php :P ). Well lemme give you a lowdown of what Ruby on Rails is…

I`ll try to explain the power of RoR in the simplest of words,

If PHP can do something after typing 75 lines of code, RoR can do the same thing in typing mearly 3 lines of code !!!!
Thats as simple is it gets ! But then again, there is a catch to it, RoR is equally complex. So Today, I`ll just give you the basic idea of what Ruby on Rails is, and how to set up a developer environment for RoR, So next time we can directly start creating applications. woohoo !

But Firstly the basics.
If you are aware of the basics then Click Here to jump below, else read on.

Ruby is a dynamic, reflective, general purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby was initially developed and designed by Yukihiro “Matz” Matsumoto.”

  • Ruby is very similar to our native object-oriented programming languages (eg: C++,Java).
  • You can define variables using ‘@’ symbol.
  • You can define functions, more commonly known as methods using
    def method_name
    ....
    end

Ruby on Rails is framework developed particularly for web applications. The framework is coded using Ruby. It basically makes our lives easier by generating code automatically on execution of a single piece of code.

  • It uses the MVC Architecture. (Model-View-Controller, I`ll be explainin this in the next tutorial, which will be ‘Creating Your First RoR Application’)

I like to tell you that, its not easy deploying a RoR application (Thats right, its an application, not a script or a piece of code, but a combination of lots of directories & files).
Its not anything like the php scripts we upload to the server and run the script by pointing to the right address, there are various modes on how a RoR application is executed (Eg. developer, test, production).

Enough of the technical mumbo-jumbo, lets get down business.

Pre-Requisites :

  1. Webserver + MySQL installed
  2. Ruby (1.8.6) : We need to install the basic ruby binaries and extensions to execute RoR applications.
    Download ruby186-26.exe

Basically you must have a normal php/mysql developer environment already installed, if not, you can refer to my earlier tutorial i.e
Tutorial : Installing Apache, PHP5, MySQL5, PhpMyAdmin 2.11 in Windows Vista/XP

Pages : 1 2

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

23 Responses to “Tutorial : Installing Ruby on Rails 2 in Windows Vista/XP”

  1. securians
    January 31, 2010 at 5:09 am

    Ruby on Rails or RoR, is an open source web application framework for the Ruby programming language.

    We build quality Ruby On Rails web applications for start-ups and established businesses since early 2006. We focus on the core idea, perfect the interface, suggest innovative features and deliver; we help your company succeed faster by using the best technologies available.

    Secure Next is a software technology corporation that develops, manufactures, and supports a wide range of software and web development projects. Headquartered in Fresno, California, USA, and its offshore in Chennai, India, we rock on every single projects we develop and venture into upcoming technology with a vision of agile web development & customer satisfaction. Thus, we want to make people feel informed and involved, committing quality and timeliness and ready to flourish using latest technology.

    ref: http://www.rordevelopers.com & http://www.securenext.com

  2. Michael
    October 3, 2008 at 7:20 pm

    Hey Moses,

    if u r getting teh starting page, ur ror is fine. after installing mysql, webrick shuld open as usual. i dun thnk u hv missd anythin in frm the tutorial.

    u can try installing ruby once again if u r still having a problem

    regards

  3. Moses
    October 3, 2008 at 5:40 am

    Your WAMP tutorial was excellent so I tried to set up RoR as per your tutorial. Everything worked until I clicked on “About your applications environment” and I get the error:

    MissingSourceFile in Rails/infoController#properties
    no such file to load — sqlite3
    RAILS_ROOT: C:/ruby/bin/test
    This error occurred while loading the following files:
    sqlite3

    I followed your WAMP tutorial so I have MySQL installed instead of sqlite. The DOS Window hangs after WEBrick loads.

    Is there a step I missed not in your tutorial?

    Thanks in advance!

  4. promosyon
    September 26, 2008 at 8:36 am

    Your post is very valuable, thanks

  5. thavaht
    September 23, 2008 at 3:56 pm

    I came to your tutorial looking for a way to tell RoR to use apache instead of webrick. The tutorials I found on the web are not up-to-date. Can you help with this? Thanks in advance.

    Regards

  6. Michael
    September 21, 2008 at 10:07 pm

    Hello Thavaht,

    The thing is, RoR has its own small time web server called WEBrick, but it is normally only used during development phase. When you move to Production environment, WEBrick won`t be able to handle the traffic. We have to use other webservers for that, btw ‘fastcgi’ is a module used along with apache enabling it to execute RoR.

    But the prime reason is, A database is very important for any RoR applications. Thats why I have made references to MySQL, its for people who don`t know how to install MySQL.

    Regards

  7. thavaht
    September 21, 2008 at 3:18 pm

    Hi Michael,

    I don’t understand why you make reference to Apache and Mysql in your tutorial.
    As you stated on your point 10. “C:\ruby\bin\test>ruby script/server” will start WEBrick (may be Mongrel or Lighttpd if available).
    What about apache?

    Regards,
    thavaht – Maputo, Mozambique

  8. Michael
    September 6, 2008 at 8:43 pm

    Hey Rupert,

    I think ruby has not been installed properly. Try uninstalling ruby and try reinstalling it.
    Also please verify whether the path to ruby bin folder is defined i.e
    Control Panel->System->Advanced->Environmental Variable-> Search for Path in System Variables. Check whether C:\Server\rubybin; is present or not.

    Also I hope you have Apache environment working ?

    Regards

  9. Rupert
    September 6, 2008 at 3:41 pm

    Hey Michael,
    Actually I’m getting the error before the end of your tutorial, before I’ve gotten to the stage of creating my own apps yet. On page 2 of this tutorial at step 10 you write: “Now finally to test our application ‘test’ what we have created. type
    C:\ruby\bin\test>ruby script/server
    in the command prompt to start RoR’s built in *mini* webserve.”
    However, when I enter that command, I get the following message:
    “ruby is not recognized as an internal or external command, operable program or batch file. ”

    I’m sure that up until that point, I have followed every step of your tutorial to the letter.

  10. Kevin Suttle
    September 6, 2008 at 3:05 am

    I had this same problem. System environment variables were there. I typed “ruby –version;” (note the semi-colon) and it threw an error. Just on a hunch I typed the same thing again without the semi-colon and it worked! What a weird bug.

  11. Michael
    September 5, 2008 at 7:26 pm

    Hello Rupert,

    Once you have set up Ruby on Rails, you can create application folders anywhere in your system. It is not necessary that you must create your application inside ruby/binn

    BTW if you can temme what error you are getting, I may be able to help you with ease.

    The following are possible for any kindof error

    1. Haven`t defined database.yml
    2. Not executing the code in the proper directory. (It should be inside the application directory)

  12. Rupert
    September 5, 2008 at 5:30 pm

    Heya,
    Thanks for your fantastic tutorial. I followed everything through but I’m getting an error thrown when I type “ruby script/server”. I’ve checked that I am executing it in the right folder (i.e. the test folder) and also that ruby/bin is present in system variables but I’m still getting the error.

    Any ideas?

    P.S. Your other tutorial on setting up WAMP was equally easy to follow and useful. Thanks so much!

  13. Aj
    August 18, 2008 at 5:18 am

    ror is equally nice as php. great job!! when do i expect the coding tutorials??
    thank u!

  14. Aj
    August 18, 2008 at 5:10 am

    hey mikel nice installation guide it has helped me thru out without problems.
    thank you.

  15. KEHT
    August 8, 2008 at 6:22 am

    Great tutorial! Keep ‘em coming!

  16. Michael
    August 4, 2008 at 7:53 pm

    Thanks Steve for your precious comment.

  17. Steve
    August 4, 2008 at 10:45 am

    This was very useful. I’m looking forward to your future tutorials. Thanks. -S

  18. Michael
    July 21, 2008 at 5:55 pm

    hello tyler
    first thanks for posting in.

    You can check a couple of things.
    Firstly did you execute “ruby script/server” inside the folder of your application. i.e
    if you app name is demo then
    C:\ruby\bin\demo>ruby script/server

    Second, please goto Control Panel -> System ->Advanced System Settings -> Environmental variables,
    then in ‘System Variables’ scroll down till you find “path” select path and click on ‘edit’, then see whether the folder where you have installed ruby is present or not. (If you have installed ruby in c:\ruby then “C:\ruby\bin;” must be present in it.

    Please check in and lemme know
    Regards

  19. tyler
    July 21, 2008 at 10:56 am

    Hi, everything installed fine and I got to the test app created fine. When I went to run : “ruby script/server” i got an error saying, “ruby is not recognized as an internal or external command, operable program or batch file.”

    -any ideas?

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code lang=""> <del datetime=""> <em> <i> <p> <q cite=""> <strike> <strong>