Installing ruby
sudo apt-get install ruby rubygems
To get access to the ruby documentation and to enable "./script/console" you have to install ri and interactive ruby.
sudo apt-get install ri irb
Installing rails
As Rails version 3 caused some problems I explicitly installed v2.3.8.
sudo gem install rails -v 2.3.8 -V
I prefer to use the verbose option "-V" as the installation is sometimes just sitting around seemingly not responding anymore. In verbose mode however after a few seconds you should see what URLs are queried. So give it some time and be patient.
Installing MySQL
sudo apt-get install libmysql-ruby libmysqlclient-dev
sudo apt-get install ruby1.8-dev
sudo gem install mysql
Preparing the environment
Ok, the previous steps installed some gems but the executables are not yet accessible. So we have to add their path to our shell.
For this we first check where the binaries were installed, just call:
gem env
Which provides the following output on my computer.
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.5
- RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /var/lib/gems/1.8
- /home/georg/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://gems.rubyforge.org/
We then take the executable path and add it to our shells path.
cd ~
gedit .bashrc
And in the just opened editor we add the following lines and save the file again.
# Ruby environment
export PATH=${PATH}:/var/lib/gems/1.8/bin
Calling the "which" command should then produce the following output, given your gems path is identical to mine.
which ruby gem rails rake mongrel_rails
/usr/bin/ruby
/usr/bin/gem
/var/lib/gems/1.8/bin/rails
/var/lib/gems/1.8/bin/rake
/var/lib/gems/1.8/bin/mongrel_rails