For those who don’t understand the title don’t worry, this is a “technical” post: installing Ruby on Rails (ROR) over an existing XAMPP (Apache, PHP, MySQL, …) installation in Windows. For all of those who have somehow a Windows “server” used to test websites and want to install Ruby and the fantastic Ruby on Rails framework.

Prerequisites: a working installation of XAMPP, in my example installed under: C:\xampp.

  1. Install ROR via the “one click installer” which can be found on the ROR site: installers list. To have everything in one “web-development directory” when prompted by the installer choose C:\xampp\ruby
  2. Open the dreaded DOS-prompt or cmd: Start->Run->cmd
  3. First off update gem, The version installed will stop whenever an update fails, to solve this update gem first. Let’s navigate to the ruby bin directory:
    cd C:\xampp\ruby\bin
    and then the command:
    gem update --system
  4. Now all the gems are updated, install rails with this command:
    gem install rails --include-dependencies
    This will take a while especially for generating the whole documentation, don’t worry, everything is going all right, wait and be patient
  5. Create a test application with the command:
    rails C:/xampp/htdocs/testapp
    If all went fine you will see some output saying that some files have been created. Rails is installed all fine
  6. Now it’s time to create a Virtual Host in apache to test out our installation. Edit the file: C:xamppapacheconfextrahttpd-vhosts.conf with your favourite good editor. I always have installed Notepad++ and at the end add the following lines:
    ## ROR
    Listen 3000
    <VirtualHost *:3000>
    	ServerName ROR
    	DocumentRoot "C:\xampp\htdocs"
    	<Directory "C:\xampp\htdocs">
    		Options ExecCGI FollowSymLinks
    		AllowOverride all
    		Allow from all
    		Order allow,deny
    		AddHandler cgi-script .cgi
    		AddHandler fastcgi-script .fcgi
    	</Directory>
    </VirtualHost>
    ## END-ROR
    
  7. Restart apache from the XAMPP control panel and then go, on your favorite browser to:
    http://localhost:3000/testapp/public
    To see if everything went fine, the page should look like this screenshot
    ROR installed on XAMPP in Windows

    ROR installed on XAMPP in Windows

Versions

At the moment of this writing this is the list of version numbers for the installed applications running and working as configured in this post:

  • XAMPP: 1.6.6a
  • ruby -v: ruby 1.8.6 <2008-08-11 patchlevel 287> [i386-mswin32]
  • gem -v: 1.3.3
  • rails -v: Rails 2.3.2

I would like to thank the author of this post which is the starting point of my post. I just did some minor changes to remove some errors, especially when updating gems. Also I changed the file to edit to add the Virtual Host to keep things more clean in the http.conf file.

For any trouble don’t hesitate to contact me!