Installing Rails on Windows
Installing Ruby
First things first, we need to get ruby and gems setup on your development machine.
1. Download the Ruby 1.8.7 RubyInstaller for Windows (http://rubyforge.org/projects/rubyinstaller/)
The RubyInstaller replaces the original OneClick Installer. We are using 1.8.7 instead of 1.9.1 because ruby 1.9 is not fully compatible with all libraries we might want to use at this time. The most current installer is http://rubyforge.org/frs/download.php/69034/rubyinstaller-1.8.7-p249-rc2.exe
When installing, use the default installation path of “C:\Ruby” and make sure you explicitly check:
* ”Add Ruby Executables to your PATH” – YES
* ”Associate .rb and .rbw files with this Ruby Installation” – YES
2. Install 7-zip (http://www.7-zip.org/)
7-zip is a compression client, we need to install it to complete later steps. You can choose to uninstall it after we are done if you wish.
3. Download the RubyDev Kit (http://rubyforge.org/frs/download.php/66888/devkit-3.4.5r3-20091110.7z)
The ruby devkit allows you to compile gems on your windows environment that depend on C libraries not part of ruby. After downloading, extract the files to complete the following steps:
* Move gcc.bat in the bin folder to C:\Ruby\bin
* Move make.bat in the bin folder to C:\Ruby\bin
* Move sh.bat in the bin folder to C:\Ruby\bin
* Move the devkit folder to C:\Ruby
4. Update rubygems
Gems are another name for ruby libraries that others have built that you may want to use in the future. The gem command allows us to install these libraries simply through the command line. To ensure we are on the latest version of ruby gems, complete the following steps.
* Open up the command line window (Start -> Run -> cmd -> hit: Enter)
* Type: gem update –system
Installing MySQL 5.1
1. Download the opensource MySQL database, note that you will need to register prior to downloading. We are going to download the latest 5.1 mysql essentials windows installer.
For 32-bit machines => http://dev.mysql.com/downloads/mirror.php?id=385516
For 64-bit machines => http://dev.mysql.com/downloads/mirror.php?id=385517
2. Install MySQL 5.1, make sure you select the “Complete” setup type prior to selecting Install. After MySQL installs you will be prompted with a message box where you can select to “Configure MySQL Now” to continue with the next steps.
3. Select “Detailed Configuration”
4. Choose “Developer Machine”
5. Choose “Multifunctional Database”
6. Leave the next screen unchanged
7. Choose “Decision Support / OLAP”
6. Check “Enable TCP/IP Networking” for now and leave “Strict mode” checked.
7. Choose “Best Support for Multilingualism” Rails expects to use UTF8 by default.
8. Have both options checked.
9. Uncheck “Modify Security Settings”
10. Select “Execute” to configure MySQL
11. Test MySQL by opening a command window and type ‘mysql’, you should see something similar to what is below: (if you don’t see the output below, try opening a new command window (Start -> Run -> “cmd”) and try again)
Install Sqlite
Sqlite is a simple database that rails uses as a default for development. Even though we will be using mysql its good to install sqlite so that any tutorials work as expected.
1. Download the sqlitedll for windows (http://www.sqlite.org/download.html). The current version is: http://www.sqlite.org/sqlitedll-3_6_23_1.zip
2. Unzip the download and move .dll file to the already existing folder C:\Windows\system32
What if I don’t have that folder? This dll can be in any folder in your PATH, to check or modify your path: Right Click My Computer -> Properties -> Advanced -> Environment Variables -> System Variables
Install Subversion for version control
1. Download and follow installation of command line tool from from silksvn (http://www.sliksvn.com/en/download). Ensure you select the “Complete” option during installation.
For 32-bit machines => http://www.sliksvn.com/pub/Slik-Subversion-1.6.9-win32.msi
For 64-bit machines => http://www.sliksvn.com/pub/Slik-Subversion-1.6.9-x64.msi
2 Install TortoiseSVN, an excellent windows GUI tool to svn (http://tortoisesvn.net/downloads)
For 32-bit machines => http://downloads.sourceforge.net/tortoisesvn/TortoiseSVN-1.6.7.18415-win32-svn-1.6.9.msi?download
For 64-bit machines => http://downloads.sourceforge.net/tortoisesvn/TortoiseSVN-1.6.7.18415-x64-svn-1.6.9.msi?download
Install Rails
1. Open up the command window (Start -> Run… -> Type: cmd -> Hit: Enter)
2. To install the default rails 2.3, type: gem install rails installs
3. Type: gem install sqlite3-ruby -v 1.2.5
4. Type: gem install mongrel
Done
Your windows environment is now ready for developing and testing rails applications. You will next want to install an IDE for ruby, a popular opensource IDE at the moment is NetBeans (http://netbeans.org/kb/61/ruby/setting-up.html#native).
Ruby on Rails Tutorial
To create your first rails application and complete the pre-training material, visit http://www.railstutorial.org, since you already have an environment setup, you can begin with the following lessons:
1. Starting a sample application: http://www.railstutorial.org/chapters/beginning#sec:the_sample_application
2. Then continue chapters 2 through 9