#1. Add Postgres Yum Repository
First step is to install PostgreSQL repository in your system, Use one of below commands as per your system architecture and operating system.For more details visit PostgreSQL repositories link page where you can get repository package rpm for various operating systems.CentOS/RHEL 7 # rpm -Uvh https://yum.postgresql.org/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpmCentOS/RHEL 6 # rpm -Uvh http://yum.postgresql.org/9.6/redhat/rhel-6-x86_64/pgdg-redhat96-9.6-3.noarch.rpmCentOS/RHEL 5 # rpm -Uvh http://yum.postgresql.org/9.6/redhat/rhel-5-x86_64/pgdg-redhat96-9.6-3.noarch.rpmFedora 25: # rpm -Uvh http://yum.postgresql.org/9.6/fedora/fedora-25-x86_64/pgdg-fedora96-9.6-3.noarch.rpmFedora 24 # rpm -Uvh https://yum.postgresql.org/9.6/fedora/fedora-24-x86_64/pgdg-fedora96-9.6-3.noarch.rpmFedora 23 # rpm -Uvh https://yum.postgresql.org/9.6/fedora/fedora-23-x86_64/pgdg-fedora96-9.6-3.noarch.rpm
#2. Install PostgreSQL Server
After enabling PostgreSQL yum repository in your system use following command to install PostgreSQL 9.6 on your system with yum package manager.# yuminstall postgresql96-server postgresql96
#3. Initialize PGDATA
After installing PostgreSQL server, It’s required to initialize it before using first time. To initialize database use below command.# /usr/pgsql-9.6/bin/postgresql96-setupAbove command will take some time to initialize PostgreSQL first time. PGDATA environment variable contains the path of data directory.initdb
PostgreSQL data directory Path:
#4. Start PostgreSQL Server
To start PostgreSQL service using following command as per your operating systems. Also enable PostgreSQL service to auto start on system boot.For CentOS/RHEL 7 and Fedora
# systemctl start postgresql-9.6 # systemctl enable postgresql-9.6For CentOS/RHEL 6/5
# service postgresql-9.6 start # chkconfig postgresql-9.6 on
#5. Verify PostgreSQL Setup
After completing above steps, you have installed PostgreSQL 9.5 on your server, Let’s login to postfix to verify that installation completed successfully.# su - postgresUse
$You may create password for user postgres for security purpose.psql psql (9.6.0) Type "help" for help. postgres=#
postgres=#\password postgres
How to Install phpPgAdmin on CentOS using Yum
Thanks for using this tutorial for installing PostgreSQL 9.6 on CentOS/RHEL 7/6/5 and Fedora 25/24/23 systems.
Comments
Post a Comment