Sunday, October 2, 2011

Setting up your first Rails project on Ubuntu 11.04

Installing  from Terminal
sudo apt-get install ruby-full
wget production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
tar -xvf rubygems-1.3.7.tgz
cd rubygems-1.3.7/
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
sudo gem install rdoc
sudo gem install rails

Looking for Ruby 1.9.2
I recommended above version 1.8 but if anybody looking for 1.92 you install following :) yeah  

$ sudo apt-get install curl bison build-essential autoconf zlib1g-dev \
    libssl-dev libxml2-dev libreadline6-dev git-core subversion
$ rvm package install openssl
$ rvm package install readline
$ rvm install 1.9.2 -C --with-openssl-dir=$HOME/.rvm/usr,--with-readline-dir=$HOME/.rvm/usr


Installing MySQL Server from Terminal
sudo apt-get install mysql-server libmysqlclient-dev libmysql-ruby
Setting up your first Rails project
It seems that Rails 3 depends on sqlite3 even if you don’t intend to use it as the backend for your application. We’ll create an example rails project  to make sure everything is working.
sudo apt-get install libsqlite3-dev build-essential
rails new vikas
cd vikas/
 sudo bundle install
sudo rake db:create
rails s
while
you go to rake db:create you have such kind problem that i face

 sudo rake db:create
rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.

So no need to worry just install node.js using Terminal
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

same kind problem also with "heroku with ruby"so Just need to install node.js
like above
Now fire up your browser, and go to http://localhost:3000 and you should be greeted with a nice little rails homepage