CentOS & PostgreSQL: install postgresql(9.3) on centos(6.5) example

Trabla: CentOS & PostgreSQL: install postgresql ( 9.3 ) on centos ( 6.5 ) example


Solving:

This tutorial explain how to install postgresql 9.3 on centos 6.5 x64

Before we start setup pico editor for CentOS:
http://codingtrabla.blogspot.com/2015/07/centos-install-pico-editor.html

How to check CentOS version:
http://codingtrabla.blogspot.com/2015/07/centos-how-to-check-centos-version.html


1. Configure YUM repository 
- open file CentOS-Base.repo
- add exclude=postgresql*  into [base] and [updates] sections
- Save file

sudo pico  /etc/yum.repos.d/CentOS-Base.repo

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#


[base]
name=CentOS-$releasever - Base - ......
failovermethod=priority
baseurl=......

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&re$
gpgcheck=1
gpgkey=.......
exclude=postgresql*


#released updates
[updates]
name=CentOS-$releasever - Updates - ....
failovermethod=priority
baseurl=...
#mirrorlist=.....
gpgcheck=1
gpgkey=......
exclude=postgresql*


...




2. Install PGDG RPM file
Browse http://yum.postgresql.org/
Find your correct RPM
This example i needed CentOS 6.5 x64 and PostgreSQL 9.3
So i've copied link  http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
and executed command

CentOS & PostgreSQL: install postgresql ( 9.3 ) on centos ( 6.5 ) example




sudo yum localinstall http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm




3. Install PostgreSQL
First list available packages
sudo yum list postgres*

Install PostgreSQL 9.3 server
sudo yum install postgresql93-server


4. Initialize database
sudo service postgresql-9.3 initdb



5. Make PostgreSQL to start automatically when CentOS starts:
sudo chkconfig postgresql-9.3 on

6. Start PostgreSQL service ( use control service + commands - start|stop|restart|reload)
sudo service postgresql-9.3 start

Hooray!!! :)

This tutorial is based on official documentation tutorial:
https://wiki.postgresql.org/wiki/YUM_Installation







No comments:

Post a Comment