Install
1. Yum install PostgreSQL postgresql-Server
2. initialize the database and start the service
Service PostgreSQL initdb
Service PostgreSQL start
3. When PostgreSQL port 5432 has a firewall, it must be enabled.
Configuration
The installation path of Yum after PostgreSQL is/var/lib/pgsql. The main configuration file is in its data folder and enters the data folder.
1. Modify the PostgreSQL. conf file
If you want PostgreSQL to listen to the entire network, remove the # Before listen_addresses and change listen_addresses = 'localhost' to listen_addresses = '*'
2. Modify pg_cmd.conf.
This file has a list at the end, which determines the permissions assigned to each user and the authentication method. The format is "type Database User address method". Note that it is best to write MD5 to method.
Append a line after the list: Host All all 192.168.1.0/24 Password
3. Modify Postgres User Password: passwd Postgres
4. Change the local Authentication Mode in pg_hba.conf to "trust", and change the current user to "Postgres: su Postgres ".
5. Use Psql to log on to the PostgreSQL system and "select * From pg_shadow;". We found that the Postgres user in this table does not have a storage password. Therefore, then, "alter User Login s password 'its password ';
6. Restart the service/etc/init. d/PostgreSQL restart. The connection is successful.
Remote connection to Psql-h ip-P 5432-D luoyun-u Postgres
Problem
Psql. Bin: Fatal: password authentication failed for user "s"
I have added the Postgres user, and the password is too simple to remember correctly. How can I not even connect to it?
Check the Internet. Some people say they modify pg_mirror.conf and change the MD5 of the local line to trust. A try.
Later, the same problem occurred when the client was remotely logged on. As a result, the MD5 was changed to trust, and the login was successful,
As long as you obtain the trust of the other party, the problem is really not a problem.
Reference
Http://zxggmail.iteye.com/blog/1481278
Http://www.2cto.com/database/201204/126854.html
Http://www.postgresql.org/docs/8.1/interactive/client-authentication.html