how to install rails in home folder(/home/username) ?

Yes, you do it pretty much like you do with other packages: pass a
--prefix to configure:

  ./configure --prefix=/home/username

Then when you install rubygems and rails, everything will be placed
under that location (in lib, bin, and so forth).

Not sure why readline didn't get installed. Anyway, ask on the Ruby
list; it's a Ruby installation issue, not a Rails issue.