You need to install the following packages as prerequisites for readline package. Choose the prerequisites according to the Ubuntu version.
If you are using ubuntu 11.10 and rvm 1.10.0 then try using rvm requirements command to find all the dependencies. For readline we require only the two packages which are listed below.
Common for both Ubuntu 11.10 and Ubuntu 11.04
ncurses-dev package is common for both Ubuntu 11.04 and 11.10.
Now the prerequisites are over. Now we can install the readline package
Use the following commands to configure readline. The directory may change accordingly to which ruby version you are configuring readline.