Rails Installation and Setup
In order to have a fully working development environment, you will need:
- Ruby - the language
- A Text Editor
- Ruby Gems - the plug-in manager for Ruby
- The Rails Framework itself
- A Web Server
- A Database
- A GUI Database Admin Tool
There are a number of blogs and sites around covering Rails installation on many different environments. At this point we have chosen this one:
- Windows 7
- Ruby 1.9.1
- Ruby Gems 1.3.5
- Rails 2.3.5 -> 2.3.6
- Mongrel 1.1.6 (beta)
This is not an endorsement of any kind concerning this environment, you must in fact know that all them are the most recent versions on the field. So, not necessarily the best option for production environment.
In fact, for production environment, as suggested by one of the most important Rails hosting provider (up to April, 2010) you should try this set:
| Category | Component | Version |
|---|---|---|
| Ruby Interpreters | MRI | 1.8.7.p174 |
| Frameworks | Rails | 2.3.5 |
| Web/App | nginx | 0.6.35-r25 (patched) |
| mongrel | 1.1.5.1 | |
| unicorn | 0.97.1 | |
| haproxy | 1.4.2 | |
| nginx/psgr | 0.6.35/2.2.8 | |
| rack | 1.0.1 | |
| Databases | MySQL | 5.0.77 |
| Postgres | 8.4.1 | |
| MongoDB | 1.2.4 |
I believe You can do the same using a slightly different, more often used, environment with: Windows XP; Ruby 1.8.6; Rails 2.3.5 and Mongrel 1.1.5
Stop the press but not the work! I have just seen (today is May 23, 2010 @ 10:31 pm GMT) that people from Rails Core released Rails 2.3.6 (probably the last before Rails 3.0).
- Update: May 24, 2010 - due to a XSS support bug, they have launched the 2.3.7 version.
- Update: May 25, 2010 - another bug found, another version launched: 2.3.8
I think You can follow the instructions bellow changing it accordingly, at least while Rails 3.0 is not released.
Step by Step Install:
Ruby - the language
I'm assuming you have Ruby and a companion editor already installed.
If don't, you can find how to get it here.
After that you must check your environment with a few commands:
D:\Ruby19>ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]
D:\Ruby19>gem list
*** LOCAL GEMS ***
A Text Editor
You can use the SciTE editor installed with Ruby, but when using Rails, You will be much more productive with a text editor that deals with "projects" based on folders and sub-folders structure. The one I have been using for a while is Intype.

Ruby Gems
You can check your current Ruby Gems plugin version:
D:\Ruby19>gem -v
1.3.5
If you get a version different from the desired one, you can easily update it:
D:\Ruby19>gem update system
The Rails Framework itself
We can say Ruby on Rails is a big but regular Ruby application with some associated gems.
Rails and all it's gems (libraries) get installed in the sub-folders of your Ruby installed folder.
To get Rails installed, you just need to open a command window and type out the following:
D:\Ruby19>gem install rails
Since we are using Windows, it may be necessary a few more parameters:
D:\Ruby19>gem install rails --platform x86-mingw32

If you already have an older Rails version, You just need to update it:
D:\Ruby19>gem update rails
When a new gem version is installed the previous is kept. If you just need the last one, you can clear the older versions this way:
D:\Ruby19>gem cleanup
A Web Server
When installed Rails provides a functional and adequate Web server called Webrick, which we will be using by now. So, let's see how it works.
First checking the current gems set: gem list

Starting the Web server: ruby script/server

Asking the Browser: http://localhost:3000/

Clicking the "About your application's environment" link:

Well, something went wrong...
Something concerning the database environment. You may confirm that, looking into the "development.log" at the "log" directory of your application.
You will see something like this:
# Logfile created on 2010-06-06 20:26:54.....
Status: 500 Internal Server Error
no such file to load -- sqlite3
D:/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.6...
.
.
.
So, Let's fix it.
A Database
Currently Rails comes configured by default for a simple (but handy) full functional database:
- SQLite -
Installing any full database stack, requires 3 steps:
- Install the Database application itself (an EXE or in this case, a DLL)
- Install the associated Database gem (nothing new)
- Install a GUI Admin Tool for the database (piece of cake)
1 - The SQLite Database
You can find the binaries in SQLite's site, here.
In our case, you will need to find the "Precompiled Binaries For Windows", and download the "sqlitedll-3_x_xx_x.zip" file, and unzip it.
Having the dll in hand, you will need to copy it to the Windows "system" folder:
- The "system32" folder in Windows XP
- The "SysWOW64" folder in Windows 7
In this last case, you will need to register the DLL also.

Using the command: regsvr32 sqlite3

2 - The SQLite gem
Next, install the SQLite gem with: gem install sqlite3-ruby

That it is a good chance to test them all:
Starting the Web server: ruby script/server --port=80

Notice: We have specified the 80 default port when starting the Web server, that way you don't need to specify any port in the URL.

Clicking the "About your application's environment" link again:

Now, we are ready for the final step.
3 - SQLite Expert Personal
I have tried a few options in this field along these years. We are looking for a free Admin Tool for SQLite, and SQLite Expert Personal fits our needs.

At this point, you must have at least these installed gems:

And everything is working so far.

