Windows XP Installing Ruby on Rails

After trying several times go get Ruby on Rails working on XP easily, i’ve finally cracked it.

All the code you should type is highlighted for quick reference in bold/italic

First of all, you simply run the Ruby installer from the website, then you download ruby gems setup, extract all of the files, and run setup.rb - this installs gems. now that they’re both installed, the core as such I’d recommend rebooting. now this is where the documentation tends to let you down, it simply says open up a ruby console, and the default one never seems to work (Interactive Ruby Console).

So we go to our start menu, and then Ruby&gt;RubyGems and open up the Ruby Gems Console, this gets us into a working console, we can then run

gem update –system (this checks the core ruby and gems for an update as far as i’m aware)

gem install rake (not sure what rake is, but it seems to be required for ruby on rails further down the line, though no-one seems to mention that ;)

gem install rails (hopefully no need to explain why :P )

gem install mongrel (mongrel is a local testing server - similar to apache)

Now I think we should be ready to start our application.

So I type in at this console

rails myapp (change myapp to the name of your application/site)

now the command prompt shows it has installed a few default files and since I ran at C:\Ruby, the files are located in C:\Ruby\myapp

now i’m going to start mongrel

so at the prompt I type cd myapp (since i’m already in the ruby folder)

and now the command

mongrel_rails start -d

of course being on XP I get a firewall dialogue, so I choose to allow it.

the last line when you run this command gives us the details of the server


 * Mongrel 1.1.5 available at 0.0.0.0:3000

so to access our server we simply type in http://localhost:3000

and you should see your ruby on rails enviroment all ready to use! (you need to keep that console open unless you install the mongrel service) To run mongrel as a service gem install mongrel_service

then :

mongrel_rails service::install -N MyAppsServiceName -c c:\Ruby\myapp\ -p 4000 -e production

the -N gives the service a custom name, so if you needed to ctrl-alt-del that’s the name that would appear

the -c is the change to directory - basically where you want your scripts to start from, aka the myapp folder

the -p is the portand the -e is the mode you want to run it in.

assuming this has worked correctly you can click start&gt;run type “services.msc” scroll down the list and find your app, right click it and start the service, you can now open up the port you specified in your browser and all should be swell

Not quite as easy as the initial documentation suggested but I got there in the end..