At last I found some time to write about my current endeavor: learning and setting up a working web application using Ruby on Rails or more commonly know as RoR or rails.
I’m using Ubuntu Feisty Fawn as of this writing
$ cat /etc/issue Ubuntu 7.04 n l
I haven’t upgraded yet to the latest realease (Gutsy Gibbon ver. 7.10) since I’m waiting for the stability of almost the whole thing to settle down. I’ll probably have a
dist-upgrade
sometime in December, before the holiday break, and before I take a break from development (for a while).
Anyway, this post will be mostly about installation of ruby and of RoR in Ubuntu Feisty Fawn, since I’m just going through ruby and RoR themselves as I write this.
At first I used
synaptic
to install all the necessary components to have a running MVC framework on ruby. I used
synaptic
to install
ruby, gem and rails
. All got into my machine fine.
Apparently, when I got into the code samples using mysql, I ran into code samples which should be very easy but were having errors (inside the ruby console). I’ll probably detail the error and the code some other time when I have more time for weblogging.
But the whole point of this specific post is to swerve you to the (in my opinion) better way of installing rails on Ubuntu (and I think generally on any Linux distribution).
So here it is:
Once you’ve successfully installed ruby (shouldn’t be a problem. You can go ahead and use synaptic with this one), check the version to check further:
$ ruby -v ruby 1.8.5 (2006-08-25) [i486-linux]
That’s okay and done.
Next, download rubygems from http://rubyforge.org/projects/rubygems.
Once you’ve extracted the tar.gz file,
cd rubygems
to get into the new directory.
Enter
sudo ruby setup.rb
which will automatically setup and install rubygems for you. Rubygems will be used to install rail itself.
The output should look something similar to this one:
[root@bbs rubygems-0.9.4]# ruby setup.rb ---> bin lib ---> lib/rbconfig lib/rubygems ---> lib/rubygems/commands lib/rubygems/digest <--- lib/rubygems/digest <--- lib/rubygems bin updating shebang: index_gem_repository.rb updating shebang: gemwhich updating shebang: gem_mirror updating shebang: gem updating shebang: gemlock updating shebang: update_rubygems updating shebang: gemri updating shebang: gem_server lib ---> lib/rbconfig lib/rubygems ---> lib/rubygems/commands lib/rubygems/digest <--- lib/rubygems/digest <--- lib/rubygems bin mkdir -p /usr/bin/ install index_gem_repository.rb /usr/bin/ install gemwhich /usr/bin/ install gem_mirror /usr/bin/ install gem /usr/bin/ install gemlock /usr/bin/ install update_rubygems /usr/bin/ install gemri /usr/bin/ install gem_server /usr/bin/ lib mkdir -p /usr/lib/ruby/site_ruby/1.8/ install gemconfigure.rb /usr/lib/ruby/site_ruby/1.8/ install rubygems.rb /usr/lib/ruby/site_ruby/1.8/ install ubygems.rb /usr/lib/ruby/site_ruby/1.8/ ---> lib/rbconfig mkdir -p /usr/lib/ruby/site_ruby/1.8/rbconfig install datadir.rb /usr/lib/ruby/site_ruby/1.8/rbconfig lib/rubygems mkdir -p /usr/lib/ruby/site_ruby/1.8/rubygems install custom_require.rb /usr/lib/ruby/site_ruby/1.8/rubygems install gem_openssl.rb /usr/lib/ruby/site_ruby/1.8/rubygems install config_file.rb /usr/lib/ruby/site_ruby/1.8/rubygems install dependency_list.rb /usr/lib/ruby/site_ruby/1.8/rubygems install package.rb /usr/lib/ruby/site_ruby/1.8/rubygems install source_info_cache.rb /usr/lib/ruby/site_ruby/1.8/rubygems install rubygems_version.rb /usr/lib/ruby/site_ruby/1.8/rubygems install specification.rb /usr/lib/ruby/site_ruby/1.8/rubygems install version.rb /usr/lib/ruby/site_ruby/1.8/rubygems install remote_fetcher.rb /usr/lib/ruby/site_ruby/1.8/rubygems install gem_runner.rb /usr/lib/ruby/site_ruby/1.8/rubygems install user_interaction.rb /usr/lib/ruby/site_ruby/1.8/rubygems install timer.rb /usr/lib/ruby/site_ruby/1.8/rubygems install remote_installer.rb /usr/lib/ruby/site_ruby/1.8/rubygems install gem_open_uri.rb /usr/lib/ruby/site_ruby/1.8/rubygems install doc_manager.rb /usr/lib/ruby/site_ruby/1.8/rubygems install validator.rb /usr/lib/ruby/site_ruby/1.8/rubygems install installer.rb /usr/lib/ruby/site_ruby/1.8/rubygems install gem_commands.rb /usr/lib/ruby/site_ruby/1.8/rubygems install builder.rb /usr/lib/ruby/site_ruby/1.8/rubygems install command_manager.rb /usr/lib/ruby/site_ruby/1.8/rubygems install open-uri.rb /usr/lib/ruby/site_ruby/1.8/rubygems install old_format.rb /usr/lib/ruby/site_ruby/1.8/rubygems install security.rb /usr/lib/ruby/site_ruby/1.8/rubygems install server.rb /usr/lib/ruby/site_ruby/1.8/rubygems install command.rb /usr/lib/ruby/site_ruby/1.8/rubygems install format.rb /usr/lib/ruby/site_ruby/1.8/rubygems install source_index.rb /usr/lib/ruby/site_ruby/1.8/rubygems install source_info_cache_entry.rb /usr/lib/ruby/site_ruby/1.8/rubygems ---> lib/rubygems/commands mkdir -p /usr/lib/ruby/site_ruby/1.8/rubygems/commands install sources_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install dependency_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install rdoc_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install cert_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install build_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install query_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install search_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install specification_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install check_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install install_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install environment_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install unpack_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install list_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install contents_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install outdated_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install uninstall_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install update_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install cleanup_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install help_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands install pristine_command.rb /usr/lib/ruby/site_ruby/1.8/rubygems/commands lib/rubygems/digest mkdir -p /usr/lib/ruby/site_ruby/1.8/rubygems/digest install sha1.rb /usr/lib/ruby/site_ruby/1.8/rubygems/digest install sha2.rb /usr/lib/ruby/site_ruby/1.8/rubygems/digest install digest_adapter.rb /usr/lib/ruby/site_ruby/1.8/rubygems/digest install md5.rb /usr/lib/ruby/site_ruby/1.8/rubygems/digest <--- lib/rubygems/digest <--- lib/rubygems <--- lib Successfully built RubyGem Name: sources Version: 0.0.1 File: sources-0.0.1.gem Removing old RubyGems RDoc and ri... Installing rubygems-0.9.4 ri... Installing rubygems-0.9.4 rdoc... As of RubyGems 0.8.0, library stubs are no longer needed. Searching $LOAD_PATH for stubs to optionally delete (may take a while)... ...done. No library stubs found. [root@bbs rubygems-0.9.4]#
Then check the gem version
#gem -v 0.9.4
Finally, to easily install rails type
sudo gem install rails --include-dependencies
This will fetch and install rails from the Internet, so be patient depending on your Internet download speeds.
The output should be similar to the one below:
# gem install rails --include-dependencies Successfully installed rails-1.2.5 Successfully installed activesupport-1.4.4 Successfully installed activerecord-1.15.5 Successfully installed actionpack-1.13.5 Successfully installed actionmailer-1.3.5 Successfully installed actionwebservice-1.2.5 Installing ri documentation for activesupport-1.4.4... Installing ri documentation for activerecord-1.15.5... Installing ri documentation for actionpack-1.13.5... Installing ri documentation for actionmailer-1.3.5... Installing ri documentation for actionwebservice-1.2.5... Installing RDoc documentation for activesupport-1.4.4... Installing RDoc documentation for activerecord-1.15.5... Installing RDoc documentation for actionpack-1.13.5... Installing RDoc documentation for actionmailer-1.3.5... Installing RDoc documentation for actionwebservice-1.2.5...
And that’s it! You can now start development on the famous RoR framework!
Plus, if you want to update your rails version, all you need to do is type the gem command given above again. It’s that easy!
To further check the installation type
#rails -v Rails 1.2.5
Feedbacks on this installation method plus other ones (or problems with them) are welcome. Feedbacks on RoR are very welcome as well!