I've been exploring web app frameworks lately in hopes of starting work on a new site. I first looked at some PHP implementations, namely CodeIgniter and CakePHP. I mostly looked at those thanks to all the cheap and easy hosting available for PHP. I also thought some about a Java framework like Spring or Struts but I mostly write Java these days so I wanted to branch out. What I finally decided on was Ruby on Rails. I have dabbled with Rails a little in the past and have started working on a few real projects recently that are also using Rails so I will be learning it anyway.
So far all my development in Rails has been on Windows. Rails is rather Mac centric and I am a little unsure of the Linux support. I know that the one other project I am working on is deployed on Ubuntu 8.04 server so surely I can develop on it too.
First thing is first. Install ruby:
$ sudo apt-get install rubyAnd then ruby doc:
$ sudo apt-get install rdoc(If you don't install ruby doc, you are going to get an error later when installing ruby gems.)
Now you could at this point install rails and ruby gems using apt-get or synaptic but you don't want to. Rails is currently at version 2.1.1 and ruby gems is version 1.2.0 but the Ubuntu repositories only have versions 2.0.2 and 1.1.1 respectively. If Ubuntu backports had newer versions we would be set but I don't see rails in the mix. Having a package manager built into the OS is not something that Windows and Mac have available to them natively so ruby has gems as a package manager. Unfortunately this can conflict with the OS package manager so that is why we aren't going to install ruby gems or rails with apt-get.
So now you want to download ruby gems here. Extract it (anywhere), fire up a terminal, change to the directory you just extracted and run:
$ sudo ruby setup.rbIf you happen to get the error message:
./lib/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- rdoc/rdoc (LoadError)then you skipped over my point to install ruby doc above. Go back and install that and you will be caught up again.
After a minute or so you will have ruby gems installed. To install rails run:
$ sudo /usr/bin/gem1.8 install railsAfter a few minutes more, you are ready to start developing with rails. You may also want to consider using Eclipse and Aptana.
Also, if after this when trying to fire up WEBrick you get the error:
/usr/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/initializer.rb:229:in `require_frameworks': no such file to load -- openssl (RuntimeError)You will need to install libopenssl-ruby:
$ sudo apt-get install libopenssl-rubyYou may need to install mysql too even if you are only accessing a remote database so keep that in mind too.