This is how I installed iPython on a CentOS 5 machine.
Install the readline development package:
sudo yum install readline-devel
Rebuild python, building in readline capability (automatically detected during configure):
cd /usr/local/src/Python-2.5.4; ./configure; make; sudo make install
Install iPython:
sudo -E easy_install ipython
To run web2py shell with iPython:
cd /var/local/web2py
sudo -u apache -H python2.5 web2py.py -S welcome -M
When iPython starts up it tries to access $HOME/.ipython/ and creates that directory and some default files in it if it doesn't already exist. I had trouble when the apache user didn't have permission to create directories in its own $HOME, /var/www. Creating an empty writable directory there doesn't suffice because ipython seems to want to create the directory and populate it itself, and gets confused by an empty .ipython directory.