Learning Rails: Installing Rails, Part 2 – Windows

Table of Contents

Last time, I installed Rails on the Debian box and had some trouble, but I got through it. This time, I’m going to install Rails on the Windows box.  This is my laptop that I have with me most often, so I need to develop from it, too.

Installing Ruby and RubyGems

To begin, I need Ruby on the machine, and luckily there is a Windows installer available. The RubyInstaller project is:

…a self-contained Windows-based installer that includes the Ruby language, an execution environment, important documentation, and more.

That’s handy. I download the latest RubyInstaller from here and run it.  I make sure to check Add Ruby executables to your PATH so I can use ruby and gem from the command line.

When it finishes, I open a command prompt to make sure it installed correctly.

C:\Users\Miller>ruby --version
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]

RubyInstaller also installs RubyGems automatically, but it’s an older version.

C:\Users\Miller>gem --version
1.7.2

I update to the latest version using the gem update --system command.

C:\Users\Miller>gem update --system
Updating rubygems-update
...snip...

C:\Users\Miller>gem --version
1.8.10

Installing Rails

The easiest way to install Rails is with RubyGems.

Read the rest of this entry »

Learning Rails: Installing Rails, Part 1 – Debian

Table of Contents

Before I can write code, I need to install Rails.  The best place to get started is the Ruby on Rails Download page. I work on both a Windows box and a Debian box, so I’ll need to install Rails on both machines. This time, I’m going to focus on installing Rails on the Debian box, which is actually the server where this project will eventually run. When I’m doing a lot of command line work, I prefer to work on the Debian box.

Installing Ruby and RubyGems

Note: I’m running a clean install of Debian Squeeze for this project. If you aren’t, your steps might differ. Follow the instructions at the Rails download page.

First, I install ruby.

$ sudo apt-get install ruby
Reading package lists... Done
...snip...
Setting up ruby1.8 (1.8.7.302-2squeeze1) ...
Setting up ruby (4.5) ...

$ ruby --version
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]

That looks good. Now I need RubyGems.

RubyGems is the standard package manager for ruby.  If you need a Ruby library, like Rails, there’s a good chance it’s available as a gem. So, I download and install the latest version.

$ wget http://rubyforge.org/frs/download.php/75309/rubygems-1.8.10.tgz
...snip...
2011-10-19 21:49:25 (351 KB/s) - `rubygems-1.8.10.tgz' saved [249683/249683]

$ tar -xzvf rubygems-1.8.10.tgz
...snip...

$ cd rubygems-1.8.10

$ sudo ruby setup.rb
RubyGems 1.8.10 installed
...snip...
RubyGems installed the following executables:
        /usr/bin/gem1.8

That was pretty easy.

Read the rest of this entry »