Installing Rails on Ubuntu Dapper / Edgy
Installing Ruby on Rails on your Ubuntu box is not always as easy as it seems. Here’s a comprehensive overview of the steps you need to take. Mostly you’ll be using apt-get and gems, so it’s not all that hard after all.
This method was tested on both Dapper and Edgy systems. It may work on other Ubuntu releases as well. It’s also possible that it works on Debian.
Besides Rails, I’ll also be install mysql and sqlite3 support.
1. Install Ruby
Before putting anything on Rails, install Ruby.
$ sudo apt-get install irb1.8 libreadline-ruby1.8 libruby libruby1.8 rdoc1.8 ruby ruby1.8 ruby1.8-dev
You may now check what version of Ruby you have by running `ruby -v`. It’s just for your information.
2. Install Ruby Gems
Surf to http://rubyforge.org/frs/?group_id=126 and download the latest available gems pacakge in tgz format. (You may also use the zip if you feel comfortable.)
$ wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz $ tar zxf rubygems-0.9.0.tgz $ cd rubygems-0.9.0 $ sudo ruby setup.rb
3. Install Rails!
You may now install Rails now!
$ sudo gem install rails --include-dependencies
That’s it! Well, almost. You probably want some other things as well.
4. Install development tools
Before you continue, stop a moment to install some development tools. These tools are probably needed to compile and install the gems we are going to install next.
$ sudo apt-get install gcc make libc6-dev g++ automake autoconf
MySQL Support
You probably want MySQL Ruby support. The MySQL code in Rails sucks (no offence), but the Ruby code is much better. You should install it. Rails will notice that it’s available and use it.
First, install MySQL.
$ sudo apt-get install mysql-server mysql-client
Next, install development files for MySQL. We’ll need these in order to make Ruby understand.
$ sudo apt-get install libmysqlclient14 libmysqlclient14-dev
Then, you may install the gem
$ sudo gem install mysql
You have to choose what version you want to install. Enter the number corresponding with the latest version that is tagged ‘ruby’. Installing win32 stuff on linux is generally not a good thing.
SQLite 3
For SQLite 3 you need to install some packages before installing the gem.
$ sudo apt-get install sqlite3 libsqlite3-dev $ sudo gem install sqlite3-ruby
If things go wrong
If things go wrong, make sure you installed all recommended packages mentioned above. Also , check any log files that the error message refers to.
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.
Comments
Can you post about how to get a rails app running on apache2 with fastcgi on Ubuntu?
To install the development tools, I use
sudo apt-get install build-essential
to take care of it.
Also I recommend to install mongrel, its said to be better than webrick
sudo gem install mongrel –include-dependencies
@Gabriel: I don’t currently use apache2 with fastcgi. I do use Apache 2.2 with mongrel_cluster, however.
I’ll make a nice write-up about that soon! (Grab the RSS feed or get an email subscription to stay up-to-date)
[...] Install ROR on Ubuntu Installing Ruby + Rails on Dapper and Edgy. I was missing bits using just the obvious packages. [...]
[...] Screenshots- Wardriving Using A Ubuntu Notebook With Garmin Etrex, Kismet, And GPSDrive (Breezy)- Instaling Ruby on Rails- Basic and Advanced Networking- Network Traffic Analyzer- Enabling WPA access Point- Sharing [...]
[...] Screenshots- Wardriving Using A Ubuntu Notebook With Garmin Etrex, Kismet, And GPSDrive (Breezy)- Instaling Ruby on Rails- Basic and Advanced Networking- Network Traffic Analyzer- Enabling WPA access Point- Sharing [...]
[...] Screenshots - Wardriving Using A Ubuntu Notebook With Garmin Etrex, Kismet, And GPSDrive (Breezy) - Instaling Ruby on Rails - Basic and Advanced Networking - Network Traffic Analyzer - Enabling WPA access Point - Sharing [...]






Works like charm. Very nice tutorial!