devroom.io/content/posts/2006-12-03-installing-rails-on-ubuntu-dapper-edgy.md
2019-06-05 14:32:16 +02:00

96 lines
3.1 KiB
Markdown

+++
date = "2006-12-03"
title = "Installing Rails on Ubuntu Dapper / Edgy"
tags = ["General", "Everything", "RubyOnRails", "Features"]
slug = "installing-rails-on-ubuntu-dapper-edgy"
description = "How to install Ruby on Rails on your Ubuntu server"
+++
<em>Update 2010-03-25: Bumped to RubyGems version 1.3.6.</em>
<em>Update 2009-02-19: Bumped to RubyGems version 1.3.1 and MySQL 5 libraries. This guide now works for all recent version of Ubuntu and Debian. Enjoy!</em>
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.
<h3>1. Install Ruby</h3>
Before putting anything on Rails, install Ruby.
``` shell
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.
<h3>2. Install Ruby Gems</h3>
Surf to <a href="http://rubyforge.org/frs/?group_id=126">http://rubyforge.org/frs/?group_id=126</a> and download the latest available gems pacakge in tgz format. (You may also use the zip if you feel comfortable.)
``` shell
wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
tar zxf rubygems-1.3.6.tgz
cd rubygems-1.3.6
sudo ruby setup.rb
sudo ln -sf /usr/bin/gem1.8 /usr/bin/gem
```
<h3>3. Install Rails!</h3>
You may now install Rails now!
``` shell
sudo gem install rails
```
That's it! Well, almost. You probably want some other things as well.
<h3>4. Install development tools</h3>
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.
``` shell
sudo apt-get install build-essential
```
<h3>MySQL Support</h3>
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.
``` shell
sudo apt-get install mysql-server mysql-client
```
Next, install development files for MySQL. We'll need these in order to make Ruby understand.
``` shell
sudo apt-get install libmysqlclient15-dev
```
Then, you may install the gem
``` shell
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.
<h3>SQLite 3</h3>
For SQLite 3 you need to install some packages before installing the gem.
``` shell
sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby
```
<h3>If things go wrong</h3>
If things go wrong, make sure you installed all recommended packages mentioned above. Also , check any log files that the error message refers to.