PostgreSQL is a database management system relational database and object-oriented free, released under the BSD license.
To install from Ubuntu to run in console the following line:
sudo apt-get install postgresql postgresql-client pgadmin3This installs the engine and pgadmin3 client, a graphical tool to manage databases.
The next thing is to change the administrator password system PostgreSQL:
sudo passwd postgresNow we must change the password of "user postgres" on the engine, it first entered with the following line:
psql -h localhost -U postgres -W template1and then enter the following command:
ALTER USER postgres WITH PASSWORD 'password';Finally out of postgres, enter the following command:
\qWith this we have installed PostgreSQL. Settings
We set up remote access to our motor. This step is optional, only if you want to allow access to our server from other hosts.
First we edit the file postgresql.conf:
sudo gedit /etc/postgresql/8.4/main/postgresql.confLook for the line:
# Listen_addresses = 'localhost'and change it to:
listen_addresses = '*'We also look for the following line:
# Password_encryption = onand change it to:
password_encryption = onNow we edit the file "pg_hba.conf"
sudo gedit /etc/postgresql/8.4/main/pg_hba.conf
Modify the lines:
# Database administrative login by UNIX sockets
local all postgres ident
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all ident
# IPv4 remote connections:
host all all 22.214.171.124/0 md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
We do this to use MD5 authentication with the user postgres.
Finally sent to restart:
sudo /etc/init.d/postgresql-8.4 restartMore information about the configuration: http://www.linux-es.org/node/660
The following video shows how to connect to PostgreSQL pgadmin3 and how to use: