Feb 5
Installing Ruby and Rails 1.9.1 on Ubuntu 9.x
One would think that installing Ruby & Rails on Ubuntu 9.X would be cake, right? WRONG. It is a lot of unexpected work and package additions. It no longer works “out of the box”.
Important Note: Install as many packages as you can before trying to run your Rails project. Once you type “ruby script/server” , the weaknesses of your configuration will be exposed, and who knows how the system will behave. Fill in the missing packages before this happens.
From the beginning
Your best bet for getting started is to use Synaptics Package Manager to install this package that supposedly contains everything you need:
ruby1.9.1-full
While you are at it, get the following dependencies that WILL come back to haunt you later:
rubygems1.9.1
libopenssl-ruby1.9.1
libruby1.9.1
sqlite3 (omit if you’re using MySQL)
libsqlite3-dev (omit if you’re using MySQL)
Accept all of the dependencies that Synaptics asks you for. More is better!
Symbolic Links
Do you want to type “ruby1.9.1″ each time? Nah i don’t think so. Make some symbolic links to help you out.
sudo ln -s /usr/bin/ruby1.9.1 /usr/bin/ruby sudo ln -s /usr/bin/gem1.9.1 /usr/bin/gem sudo ln -s /usr/bin/rake1.9.1 /usr/bin/rake
ln makes symbolic links. Check out the man page on it. You can delete the symbolic links when Ruby1.9.2 or whatever comes out.
Rails
Why doesn’t this come standard? Boggles my mind.
sudo gem install rails
Sqlite3
Status: 500 Internal Server Error no such file to load -- sqlite3
Use Synaptics and install : libsqlite3-dev to get sqlite3.h header file
Then:
sudo gem install sqlite3-ruby
Scrapers
If you use hpricot or any kind of scraper, use Synaptics package manager to get:
libxml2 libxml2-dev libxslt1-dev sudo gem install hpricot sudo gem install mechanize
Random Stuff
Problem: NameError (uninitialized constant ApplicationController) Fix: sudo rake rails:update Problem: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n' when "rated" : @movies = Movie.paginate(:al... Fix: In Ruby 1.9, colons in a case statement are disallowed. Replace them with a "then" statement.
Turns out that the new rails renames app/controllers/application.rb to application_controller.rb. This cute rake task will take care of it for you.
sudo gem install hpricot
No Comments
Leave a comment