Archive for Guides

Setting up Ruby on Rails Database Connection using SQLite (version 2 and 3) on Ubuntu Feisty Fawn

SQLite is good for development and testing, and depending on your needs production even. By default Typo uses SQLite for production. The greatest advantage is that it’s light. (like duh), and very easy to deploy.

Note: There are two versions of SQLite, version 2 and 3. They produce databases which are incompatible with each other.

Version 2

Enter into the Terminal:

sudo apt-get install ruby1.8-dev libsqlite0-dev
sudo gem install sqlite-ruby

If you see this, select 1 (enter it in).

Select which gem to install for your platform (i486-linux)
 1. sqlite-ruby 2.2.3 (ruby)
 2. sqlite-ruby 2.2.3 (mswin32)
 3. sqlite-ruby 2.2.2 (ruby)
 4. sqlite-ruby 2.2.2 (mswin32)
 5. Skip this gem
 6. Cancel installation
>

Edit the file File RAILS_ROOT/config/database.yml. For now we are using the Database development environment. The environment you are deploying your database should look like so.

development:
  adapter: sqlite
  dbfile: db/development.sql

Version 3

Enter into the Terminal:

sudo apt-get install ruby1.8-dev libsqlite3-dev
sudo gem install sqlite3-ruby

If you see this, select 1 (enter it in).

Select which gem to install for your platform (i486-linux)
 1. sqlite3-ruby 1.2.1 (ruby)
 2. sqlite3-ruby 1.2.1 (mswin32)
 3. sqlite3-ruby 1.2.0 (mswin32)
 4. sqlite3-ruby 1.2.0 (ruby)
 5. Skip this gem
 6. Cancel installation
>

Edit the file File RAILS_ROOT/config/database.yml. For now we are using the Database development environment. The environment you are deploying your database should look like so.

development:
  adapter: sqlite3
  dbfile: db/development.sql

Conclusion

There you have it, your database is now set up!

Comments (2)

Installing Ruby on Rails on Ubuntu Feisty Fawn via RubyGems

Note:

Plan of attack:

This is a quick down and dirty guide to setting up Ruby on Rails in Ubuntu Feisty Fawn. You may notice this is installed into /tmp, I do this so because its universal on all Ubuntu and Linux distributions.

  • Install Ruby
  • Install RubyGems via source
  • Install Ruby on Rails using RubyGems
  • Test Rails installation

Install Ruby

Enter into the Terminal:

sudo apt-get install ruby ri irb

Install RubyGems via source

Note: Latest RubyGems (v0.9.2) as of 25th April 2007
Enter into the Terminal:

cd /tmp
wget http://rubyforge.org/frs/download.php/17190/rubygems-0.9.2.tgz
tar -zxvf rubygems-0.9.2.tgz
cd rubygems-0.9.2
sudo ruby setup.rb

Install Ruby on Rails using RubyGems

Enter into the Terminal:

sudo gem install -y rails


Note: If it fails, try executing sudo gem update Terminal and then execute the command above again.

Test Rails installation

Enter into the Terminal:

rails /tmp/railstest
cd /tmp/railstest
./script/server

Open up Firefox and go to http://localhost:3000, a page should show up indicating a successful installation. Your basically good to go with the minor exception of a database connection.

After…

Generally you’d want some sort of database connection, with the three standards choices being.

  • SQLite:
    If you just want to experiment with Ruby on Rails, I’d recommend using SQLite.
  • MySQL
  • PostgreSQL

Stay tuned!

Comments (8)

Next entries »