PostgreSQL is an object-relational database management system (ORDBMS) available for many platforms including Linux, FreeBSD, Solaris, Microsoft Windows and Mac OS X. It is released under the PostgreSQL License, which is a MIT-style license and is thus free and open source software.
PostgreSQL is developed by the PostgreSQL Global Development Group, consisting of a handful of community volunteers employed and supervised by companies such as Red Hat and EnterpriseDB. It implements the majority of the SQL:2008 standard, is ACID-compliant, is fully transactional (including all DDL statements), has extensible data types, operators, and indexes, and has a large number of extensions written by third parties.
The vast majority of Linux distributions have PostgreSQL available in supplied packages. Mac OS X starting with Lion has PostgreSQL server as its standard default database in the server edition and PostgreSQL client tools in the desktop edition.
Here is the tutorial about installing PostgreSQL 10 on CentOS 6 / RHEL 6.
Open Terminal ( Applications —> System Tools —> Terminal).
Switch to the root user.
$ su -
Install PostgreSQL 10
PostgreSQL publishes rpm packages for all Linux platforms, and their packages are fresher than those in the other repository. We need to add the repository on our machine by installing repo rpm.
### 32 Bit ### # rpm -Uvh https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-i386/pgdg-centos10-10-1.noarch.rpm ### 64 Bit ### # rpm -Uvh https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/pgdg-centos10-10-1.noarch.rpm
Install PostgreSQL 10.
# yum install postgresql10 postgresql10-server
Configure PostgreSQL 10
Initialize the PostgreSQL.
# service postgresql-10 initdb
PostgreSQL normally listens on the localhosts only, if would you like to enable the PostgreSQL to listen on all ip addresses; edit the /var/lib/pgsql/10/data/postgresql.conf .
# vi /var/lib/pgsql/10/data/postgresql.conf
Go to Connections and Communications section, find the “listen_address” variable. Uncomment the “listen_addresses” and place “*” instead of “localhost”
#listen_addresses = "localhost"
listen_addresses = "*"
Add your network to access database remotely; Edit /var/lib/pgsql/9.1/data/pg_hba.conf .
# vi /var/lib/pgsql/9.1/data/pg_hba.conf
Add the following line according to your network configuration with md5 password authentication (Enable remote access of database).
# Local networks host all all xx.xx.xx.xx/xx md5 # Example host all all 192.168.0.0/24 md5 host all all 127.0.0.1/32 md5
Restart the PostgreSQL server.
# service postgresql-10 restart # chkconfig postgresql-10 on
Confirm the PostgreSQL listening.
# netstat -ant | grep 5432 tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN tcp6 0 0 :::5432 :::* LISTEN
Login as postgres user.
# su -l postgres
Create the database called “test”
-bash-4.2$ createdb test
Login into the database.
-bash-4.2$ psql test
Create a new user called “raj” to manage the databases.
test=# CREATE USER raj WITH SUPERUSER LOGIN PASSWORD 'raj';
Login with the superuser.
$ psql -h dbserver -d test -U raj