วันพุธที่ 19 สิงหาคม พ.ศ. 2558

Install Postgresql with yum on CentOS

Download the latest production release for your distro here: http://yum.pgrpms.org/repopackages.php

The repo rpms are 32 and 64 bit specific.

I am installing on CentOS 6 x64, I will need:
# wget http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
or
# wget http://yum.pgrpms.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
or
# wget http://yum.pgrpms.org/8.4/redhat/rhel-6-x86_64/pgdg-centos-8.4-3.noarch.rpm

# rpm -i pgdg-centos91-9.1-4.noarch.rpm 
# cd /etc/yum.repos.d 
# nano CentOS-Base.repo 
----------------------
[base] 
name=CentOS-$releasever - Base 
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os 
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ 
gpgcheck=1 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 
exclude=postgresql* 

#released updates 
[updates] 
name=CentOS-$releasever - Updates 
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates 
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ 
gpgcheck=1 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 
exclude=postgresql* 
------------------------------
# yum list postgres*
# yum install postgresql93 postgresql93-devel postgresql93-server postgresql93-libs postgresql93-contrib
# service postgresql-9.3 initdb
# service postgresql-9.3 start

4. Set PostgreSQL 9 Environment
# nano /var/lib/pgsql/bash_profile
------------------------------------
[ -f /etc/profile ] && source /etc/profile 
PGDATA=/var/lib/pgsql/9.1/data 
export PGDATA 
PATH=$PATH:$HOME/bin:/usr/pgsql-9.1/bin 
export PATH
------------------------------------

5. Set postgres Password
# su - postgres
-bash-4.1$ psql template1
postgres=# alter user postgres with password 'grespost';

6. Configure PostgreSQL 9 pg_hba.conf File
# nano /var/lib/pgsql/9.1/data/pg_hba.conf

7. Configure PostgreSQL 9 postgresql.conf File
# nano /var/lib/pgsql/9.1/data/ postgresql.conf.conf

ไม่มีความคิดเห็น:

แสดงความคิดเห็น