Monday, February 20, 2012

Ruby on Rails, Part 1: Installation

Installing Ruby on Rails in Ubuntu 11.10 involves basically these things:

  1. Install Ruby:
    • sudo apt-get install ruby
    • After this, you should be able to use "irb", interactive ruby.
  2. Install RubyGems:
    • sudo apt-get install rubygems
    • This will make it easier to work with ruby, um, gems.
  3. Install Rails:
    • gem install rails
    • The version of rails I've installed (3.1) seems to assume sqlite will also be installed, so:
    • sudo apt-get install libsqlite3-dev
    • Then, rails server wouldn't run because it "could not find javascript runtime", so:
    • sudo apt-get install nodejs

Because I wanted to use mysql, git, and vim:

  1. Install MySQL:
    • sudo apt-get install mysql-server
    • sudo apt-get install libmysqlclient-dev
  2. Install git:
    • sudo apt-get install git
  3. Install the rails extension for vim:
    • sudo apt-get install vim-rails

After all this, I was able to run initialize a new project named foo:

rails new foo

And create a database in mysql:

$ mysql -u root
mysql> create database test;
mysql> show databases;
mysql> exit

No comments:

Post a Comment