Sunday, June 22, 2008

Setting Up RubyOnRails Development Environment on Ubuntu 8.04 Hardy

I started a new fresh installation of Ubuntu 8.04 (Hardy).. i needed to prepare my machine for RubyOnRails development. Below are the steps i need to make:

Installing Ruby, Rails, MySQL

Install MySQL

apt-get install mysql-server mysql-client 

Install Ruby (1.8.6) and gems

apt-get install build-essential ruby irb rdoc ri ruby1.8-dev libzlib-ruby libopenssl-ruby1.8 rubygems libmysql-ruby1.8

Update gem

gem update --system
rm /usr/bin/gem
ln -s /usr/bin/gem1.8 /usr/bin/gem

Install Rails & Mongrels

gem install rails mongrel mongrel_cluster

Installing rails 1.2.5 (needed in my project)

gem install rails -v 1.2.5 --include-dependencies

Move the mongrel_rails, rails and rake to the /bin directory

ln -s /var/lib/gems/1.8/bin/mongrel_rails /bin/
ln -s /var/lib/gems/1.8/bin/rake /bin/
ln -s /var/lib/gems/1.8/bin/rails /bin/

This makes us done with the basic ruby and rails installation.

Installing RMagick

Rmagick is an image processing library that is needed by some rails projects (including mine). Remove conflicting packages in case there were previously installed, install the right version of the libraries and then get rmagick through gem

sudo apt-get remove --purge librmagick-ruby-doc librmagick-ruby1.8
sudo apt-get install libmagick9-dev ruby1.8-dev
sudo gem install rmagick

Downloading and Installing Aptana Studio

download the compressed distribution of Aptana for Linux from aptana download page

Aptana is an eclipse based IDE. We need to install JRE in order to run aptana

sudo apt-get install sun-java6-jdk
sudo update-java-alternatives -s java-6-sun
sudo update-java-alternatives -s java-6-sun

sudo vim /etc/jvm

add this line at the top of the file


sudo vim /etc/profile

and this line at the beginning of the file

export JAVA_HOME=/usr/lib/jvm/java-6-sun

Installing RadRails

  • start aptana studio
  • navigate to "help" > "software update" > "find and install"
  • select "search for new features to install" and hit "Next"
  • select "Aptana: RadRails Development Environment and click Next
  • follow the wizard to the end of the installation then restart aptana studio

upon restart, if you get the "unable to detect ruby install" error, you need to setup the ruby interpreter in aptana

  • Open "Window" > "Preferences"
  • goto "Ruby" > "Installed Interpreters"
  • click "add"
  • set the "RubyVM home directory" to "/usr/bin" and the name to anything ("ruby1.8" would be fine)
  • click "ok" and select the new added interpreter

This should make the machine ready for developers to start being productive.

No comments: