Environment: centos 6.3 minimizes the default installation and configures the NIC.
Before installing PostgreSQL, check that the Internet connection is normal to download the installation file.
Use the Yum-y update command to upgrade the system to the latest version.
# Modify firewall settings and open port 5432
VI/etc/sysconfig/iptables
-A input-M state -- state new-m tcp-p tcp -- dport 5432-J accept
# Restart the firewall to make the new settings take effect
Service iptables restart
# Visit the http://yum.pgrpms.org/repopackages.php page to find the URL of the latest PostgreSQL Yum configuration.
# Select the desired RPM based on the version and run the following command:
Rpm-uvh http://yum.pgrpms.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm
# Modifying the original Yum repository Configuration
VI/etc/yum. Repos. d/CentOS-Base.repo
Append exclude = PostgreSQL * at the end of the [base] and [updates] sections to cancel the installation and update of postgresql from the default repository.
# Installing PostgreSQL
Yum-y install postgresql-Server
# Execute the database Initialization Script
Service postgresql-9.2 initdb
# Start the service
Service postgresql-9.2 start
# Change logon user
Su-Postgres
# Log on to the database and modify the Postgres user's Database Password
Psql
S = # alter user Postgres password '123 ';
Postgres = # \ q
# Exit change Logon
Exit
# Edit the configuration file to configure the network address for database access
(Do not forget to remove # listen_addresses = previous #)
VI/var/lib/pgsql/9.2/data/PostgreSQL. conf
Listen_addresses = '*'
# Edit the configuration file and set the password for MD5 Verification
VI/var/lib/pgsql/9.2/data/pg_assist.conf
# "Local" is for Unix domain socket connections only
Local all MD5
# IPv4 local connections:
# Host all 127.0.0.1/32 ident
Host All all 0.0.0.0/0 MD5
# Restart the Database Service
Service postgresql-9.2 restart
# Set automatic start of service upon startup
Chkconfig postgresql-9.2 on