|
Linux installation PostgreSQL 9.4 process notes, we hope to be useful.
I. Introduction
PostgreSQL is also commonly referred to as Postgres, is a relational database management system for a variety of Linux operating systems, Windows, Solaris, BSD and Mac OS X. PostgreSQL is an open source software that is licensed under PostgreSQL. PostgreSQL was developed by the PostgreSQL Global Development Group, which is composed and managed by a handful of companies, including Red Hat, EnterpriseDB, and others.
PostgreSQL's popularity is growing, and it's justified: it's so reliable and efficient. Compared with the traditional enterprise-level relational database, PostgreSQL is completely based on community-driven, has a wealth of tools and documentation, forming a complete ecosystem.
Most of the current CentOS installation is used for Centos6.X part of the command has changed a lot, this article mainly records in the Linux Centos 7.1 to install PostgreSQL process.
Second, install the PostgreSQL source
CentOS 6.x 32bit
Rpm - Uvh http://yum.postgresql.org/9.4/redhat/rhel-6-i386/pgdg-centos94-9.4-1.noarch.rpm
CentOS 6.x 64bit
Rpm -Uvh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm
CentOS 7 64bit
Rpm -Uvh http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-1.noarch.rpm
In the steps of adding the source and not too many differences, mainly the source address of a certain change.
Third, the implementation of the installation command
Yum update
Yum install postgresql94-server postgresql94-contrib
Fourth, verify whether the installation is successful
Rpm -aq | grep postgres
The results are as follows:
Postgresql94-libs-9.4.1-1PGDG.rhel7.x86_64
Postgresql94-server-9.4.1-1PGDG.rhel7.x86_64
Postgresql94-9.4.1-1PGDG.rhel7.x86_64
Postgresql94-contrib-9.4.1-1PGDG.rhel7.x86_64
Fifth, initialize the database
CentOS 6.x system
Service postgresql-9.4 initdb
CentOS 7 system
/usr/pgsql-9.4/bin/postgresql94-setup initdb
If I am in the implementation of service postgresql-CentOS 7 initdb will report the following questions
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
6, start the service and set to boot
CentOS 6.x system
Service postgresql-9.4 start
Chkconfig postgresql-9.4 on
CentOS 7 system
Systemctl enable postgresql-9.4
Systemctl start postgresql-9.4
7, open the firewall port
CentOS 6.x system
Vi / etc / sysconfig / iptables
Press I to enter the input mode, add some statements in 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 the edit mode after entering, and enter: wq to exit the VI editing interface.
Restart the firewall service
Service iptables restart
CentOS 7 system
Firewall-cmd --permanent --add-port = 5432 / tcp
Firewall-cmd --permanent --add-port = 80 / tcp
Firewall-cmd --reload
Visit PostgreSQL
Su - postgres
The output is as follows:
Last Login: 1 May 18 15:17:29 CST 2015pts / 0 on
-bash-4.2 $
Enter the command psql will see the version of PostgrSQL information.
Psql (9.4.1)
Enter "help" for help.
9. Set the postgres user password
Postgres = # password postgres |
|
|
|