Installing Ruby on Rails on Debian Lenny
Last night i severely messed up my computer trying to install the latest version of CouchDB. I ran into dependency troubles, and then i uninstalled some kind of essential packages that ended up removing all sorts of things that i rather wanted! But this is okay because i needed a push to move up to the new Debian. And i'm glad i did … Lenny looks nice so far! :)
So i am currently going through the process of installing Ruby on Rails. I've never managed to do this right first time, but i always learn a little bit more every time i try. Let's see if i can nail it this time.
Essential things
I totally wiped the hard drive because it was in such a mess, so i'm going to need some basic stuff like the GNU C Compiler and the 'make' tool.
sudo apt-get install gcc make
OpenSSL
In my experience, you must have OpenSSL installed. Other peoples experiences may vary. I download the source code from openssl.org/source and build it like this:
./configure make make test sudo make install
The 'make test' is well worth running – it performs loads of checks!
Ruby
Always check rubyonrails.org/down for the recommended version of Ruby. Never install Ruby via apt-get … you may get an incompatible version, and it will likely install it to a weird place. It just makes things messy. Download it, unzip and install like this:
./configure make make test sudo make install
Test that you got it successfully:
ruby --version ruby 1.8.6 (2008-08-08 patchlevel 286) [i686-linux]
Zlib
Bogdan advises me that the following Zlib steps may be necessary. I have not tested these, but i know i've had problems with Zlib in the past, so i think it's likely that this is a good tip:
Install the development libraries:
apt-get install zlib1g-dev
Install Zlib for Ruby:
wget http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz tar zxf ruby-zlib-0.6.0.tar.gz cd ruby-zlib-0.6.0 ruby extconf.rb make sudo make install
Gems
Similarly, check the Rails download page to see where to download Gems. I think it's okay to just get the latest version. Unzip, go into the directory, and use Ruby to install Rubygems.
sudo ruby setup.rbAgain, it's sensible to check:
gem --version
1.2.0More than anything, this reassures me that 'gem' got into the classpath.
Rails
If Ruby and Gems successfully installed, this bit should be easy.
sudo gem install rails
And that's it! Oh yeah, of course you could check the install with
rails --version
Rails 2.1.1Woohoo! And also useful:
gem list *** LOCAL GEMS *** actionmailer (2.1.1) actionpack (2.1.1) activerecord (2.1.1) activeresource (2.1.1) activesupport (2.1.1) rails (2.1.1) rake (0.8.2)
SQLite3
Update to add: i just figured out how to get SQLite going on Debian. Download the source from here, compile and install, then:
sudo gem install sqlite3-ruby
Related posts (automatically calculated)