Installing and configuring PostgreSQL in Ubuntu is relatively simple, but you need to pay attention to some details. The installation steps are as follows:
You need to pay special attention.
1-$ sudo apt-get install postgresql-8.1 #
Apt-get install postgresql will install PostgreSQL version 7.4.
2-$ sudo nano/etc/postgresql/8.1/main/postgresql. conf # if it is not used on a single machine, you need to modify "# listen_addresses = 'localhost'" to "listen_addresses = '*'" in the connection and authentication segments (remove the annotator "#", allow network access instead of localhost only ).
3-$ sudo-u postgres createuser-P # Enter the username and password to be created in sequence, whether the user is a Super User, whether the user has the permission to create a database, and whether the user/role has the permission to be added.
We recommend that you use the-P option to create a password on the spot to avoid future connection configuration problems.
4-$ sudo-u postgres createdb [databasename] # create a database.
5-$ psql-U [username] [databasename] # normally, you can go to the PostgreSQL interactive command interface and see the PostgreSQL version number, such as 8.1.4.
Case Sensitive
6-install your favorite client. The official recommendation is pgadminIII. The installation method is $ apt-get install pgadmin3. or other clients, such as Eclipse + QuantumDB (you need to download the JDBC driver separately ).