1. Installing the PostgreSQL source
# yum Install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm
There is not much difference in the step of adding the source, mainly the source address has a certain change
Execute the Install command
# yum Install Postgresql94-server Postgresql94-contrib
Verify that the installation is successful
# rpm-aq| grep postgres
Execution results are as follows
Postgresql94-libs-9.4.1-1pgdg.rhel7.x86_64postgresql94-server-9.4.1-1pgdg.rhel7.x86_ 64postgresql94-9.4.1-1pgdg.rhel7.x86_64postgresql94-contrib-9.4.1-1pgdg.rhel7.x86_64
2. Initializing the database
# service postgresql-9.4 Initdb
3. Start the service and set it to boot
# service postgresql-9.4 Start
# chkconfig postgresql-9.4--level
4. Open firewall port
Vi/etc/sysconfig/iptables
Press I to enter input mode and add a statement to the file
-A input-m state--state new-m tcp-p TCP--dport 5432-j accept-a input-m State--state new-m tcp-p TCP--dport 80- J ACCEPT
Press ESC to exit edit mode and enter: Wq to exit the VI editing interface.
Restart Firewall service
# Service Iptables Restart
5. Accessing PostgreSQL
# Su-postgres
-bash-4.2$
-bash-4.2$ Psql
postgres=#
Set Postgres user Password
postgres=# \password Postgres
Password with default Postgres
CentOS Installation PostgreSQL 9.4