I am trying to install PostgreSQL in Ubuntu.
I followed the instruction from:
/opt/PostgreSQL/9.0/doc/postgresql/html/installation.html
and seem to have successfully installed PostgreSQL but as Post-Installation setup, it asked me to do the following:
To do this, add the following to your shell start-up file, such as ~/.bash_profile
(or /etc/profile
, if you want it to affect all users):
PATH=/usr/local/pgsql/bin:$PATH
export PATH
but I have no idea where .bash_profile is. It said this is not required, so I just skipped it and when I was trying to create database (createdb mydb), it gives me
Error:
You must install at least one postgresql-client-<version> package.
I have no idea what that is. Could anyone explain why I am getting this error and how I can install postgresql-client?
Do you really need 9.0 right now? Otherwise use the excellent pre-built packages eg
sudo apt-get install postgresql-8.4 postgresql-client-8.4
is what I have under Ubuntu 10.10.
If it has to be 9.0, you are probably best off rebuilding from the Debian package sources.
You are getting the "You must install at least one..." error because you are on a Debian based system (Ubuntu) and have the postgresql-client-common package installed but do not have the binary-providing versioned package, eg postgresql-client-8.4, installed.
You could just install the postgresql-client package which automatically installs the currently supported database client package version for PostgreSQL.
I don't know what Ubuntu release you are using or what PostgreSQL version it comes with by default, but you may be better off not using client programs from the Ubuntu/Debian version of Ubuntu and instead modifying your PATH to use the installed version.
The .bash_profile is similar to .bashrc. They are both commonly in your home directory if they have been created.
You can try adding this to ~/.bashrc (i.e. /home/youruser/.bashrc).
Or run:
gedit ~/.bashrc
from the terminal. The file should already contain some code, but you can add at the end of the file, then save the file and you should be good to go.
Oh.. and relog after doing this so that $PATH can be set up and exported or just run
PATH=/usr/local/pgsql/bin:$PATH
export PATH
from the terminal without relogging. Should work... :)