To setup web2py on a Debian based machine (like Ubuntu for example) you do
sudo apt-get -y install python
sudo apt-get -y install postgresql8.1
sudo apt-get -y install python-psycopg2
sudo apt-get -y install unzip
wget http://mdp.cti.depaul.edu/examples/static/web2py_src.zip
unzip web2py_src.zip
cd web2py
python web2py.py -a yourpassword -i 127.0.0.1 -p 8000
then open a browser and visit 127.0.0.1:8000
At this point you are still using sqlite but postgresql is running in background. To use postgresql:
sudo -u postgres createuser -P -s -e [yourusername]
createdb [yourdbname]
and in your web2py models replace
db=SQLDB('sqlite://db.db')
with
db=SQLDB('postgres://[yourusername]:[yourpassword]@localhost:5432/[yourdbname]')
and everything should work. Mind that some table names and field names are allowed in sqlite but not in postgresql and vice versa.