Manual Installation
This is the best approach for daily work with Rails and is the method that is the most similar to other operating systems.
Despite popular rumours, you do not need Apache or MySQL to develop Rails applications. Rails comes bundled with a development web server and defaults to using SQLite3, a file-based database.
- First, grab the One-Click Ruby Installer from http://rubyforge.org/frs/download.php/29263/ruby186-26.exe and install it. This package installs Ruby, RubyGems, and many other important libraries
Open a new command prompt and upgrade Rubygems by typing
gem update --system
Next, install Rails
gem install rails
Next, install Mongrel
gem install mongrel
SQLite3
Install SQLite3, a simple file-based database which is the default database in Rails 2.x. Rails can use MySQL, but SQLite3 is simple and great for initial development of projects because you don’t need to have a database server running on your laptop or desktop in order to start playing with Rails.
Grab http://www.sqlite.org/sqlitedll-3_6_1.zip and unzip the contents to a location on your path. I use c:/ruby/bin
.
Next, install the SQlite3 gem:
gem install sqlite3-ruby
Note, as of 30/08/2008 this can fail because the latest sqlite3-ruby gem does not have a windows version. To get around this, install as so:
gem install --version 1.2.3 sqlite3-ruby
At this point, you’re ready to start working with Rails.
Installing MySQL
Installing MySQL is really out of scope for this. MySQL installation is simple when you use the provided installer at http://dev.mysql.com/downloads/mysql/5.0.html#win32
Once it’s installed, start it when you need it and stop it when you’re done.
Other installation methods
InstantRails
InstantRais is an all-in-one package (similar to LAMP), contains Apache, MySQL, Ruby and Rails, all preconfigured and ready to run. (see InstantRails for more info). Best option for beginning Rails developers. Note that the database used is MySQL — for non-beginners who wish to use another database (Oracle, Microsoft SQL Server, PostgreSQL, etc.), you will want to manually install Ruby and Rails.
RubyStack
A preconfigured, ready to run installer for Apache, MySQL, Rails and a number of extensions such as Mongrel and ImageMagick. It runs on Windows, OS X and most Linux versions.
Issues with Rails on Windows
Rails does not run as fast as it does on other platforms, but it works well enough that beginners will have no problem following tutorials and developing basic applications. Those developing in a Microsoft environment should have a reasonably successful time building Rails applications.
Unfortunately, many features of the Ruby language are just not supported on Windows, and many gems and libraries simply do not work.
Issues with Ruby 1.8.4 on Windows
Bugs and segfaults plagued Ruby 1.8.4 on many Windows machines. Be sure to install the latest version of Ruby.
Internet connectivity
If you need to use a proxy, add ‘-p http://proxy:port’ to all gem install commands
Note: Some Windows XP users have complained about connectivity problems on initial installations, i.e. TCPServer errors and gem install—remote failures. Most often, the problems are caused by extra spyware and/or corrupted firewall settings and may require you to restore your winsock2. Before you change anything, you should try c:/netstat -ano; this will indicate port/service conflicts. See this link for more help.
To install Rails and other dependencies as individual gem packages see the following tutorial
Install Rails on a Windows PC not connected to the internet
Setup with Apache – out of date and really not necessary for Rails 2.x development on Windows)
Installing the Software
- Apache webserver
- Database server
- Ruby programming environment
- RubyGems
- Rails
Apache Webserver
This instructional is based on the use of windows as a development environment for Apache2 and Ruby on Rails. You may install Apache2 on windows or you may use any of the Apache2 install packages.
Apache2 install packages
Install the Apache2 webserver according to the instructions in your choice of webserver package. In most cases this is just a single click on the installer icon and setting the paths to where you want things.
Using fastcgi with Apache (optional)
The use of FastCGI to deliver Rails applications can increase speed through in-memory caching.
Important Note for Windows: As of April 23, 2007, fastcgi is still not available for apache 2.2, but only for apache 2.0. When loading the Module, apache 2.2 will complain that it “cannot load module fastcgi into server: module not found”, while it works flawlessly with apache 2.0
Update for Windows: Since November 13, 2007, FastCGI is available for apache 2.2 as mod_fastcgi-2.4.6-AP22.dll.
Note for other OS: Don’t expect fastcgi to work with apache 2.2, but please try and report it back here.
Manual installation
You can get the fastcgi module from fastcgi.com , make sure to get the .dll for the version you’re using. Place the fast CGI dll in the folder used for Apache modules in your webserver installation (check the software docs) and configure httpd.conf
by adding this line to the module section:
LoadModule fastcgi_module [path to the dll file]mod_fastcgi-2.4.2-AP20.dll
Here’s an example of what you should see in your httpd.conf
file:
LoadModule php5_module "i:/wamp/php/php5apache.dll"
LoadModule fastcgi_module "i:/wamp/fastcgi/mod_fastcgi-2.4.2-AP20.dll"
If you were looking just to get fastCGI support for your present installation the you can stop here. This section of instruction is purely informative as we will use another easier method for installing fastCGI by using Ruby For Apache.
Install FastCGI from Ruby For Apache
RubyForApache is an installer package for FastCGI