CentOS와 RedHat은 기본적으로 MySQL과 PostgreSQL 같은 RDBMS의 온라인 설치를 지원한다. CentOS와 RedHat이 설치된 서버가 인터넷에 연결되어 있다면 바로 yum 명령을 이용하여 MySQL이나 PostgreSQL을 설치할 수 있다.
그런데 CentOS 6.6 Final DVD를 이용해 CentOS를 설치하고 yum을 이용해 postgreSQL을 설치하게 되면 기본적으로 8.x 버전의 postgreSQL이 설치된다. 하지만 최신은 아니더라도 비교적 최근의 버전을 설치할 일이 생겨버렸다.
그래서 구글링을 해본 결과 다음과 같은 방법으로 상위버전의 postgreSQL의 설치가 가능했다.
CentOS 6.6 Final에 PostgreSQL 9.3 설치하기
먼저 리눅스의 버전확인. 커널버전 2.6.32-504가 6.6 Final 이다. 그리고 64bit 커널이다.
[root@localhost lib]# uname -aLinux localhost.localdomain 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
다음과 같이 postgresql 사이트에서 yum의 리포지토리를 업그레이드하는 rpm을 다운받아 설치한다.
http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm(을)를 복구합니다경고: /var/tmp/rpm-tmp.jMiE5n: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY준비 중…
########################################### [100%] 1:pgdg-redhat93 ########################################### [100%][root@localhost lib]#
정상적으로 완료되었다면 yum을 이용해 postgreSQL 패키지를 다운 받는다.
[root@localhost lib]# yum install postgresql93-server postgresql93
Loaded plugins: fastestmirrorSetting up Install
ProcessLoading mirror speeds from cached hostfile * base: centos.mirror.cdnetworks.com * extras: centos.mirror.cdnetworks.com *
updates: centos.mirror.cdnetworks.com
pgdg93 | 3.7 kB 00:00 pgdg93/primary_db
| 126 kB 00:00 Resolving
Dependencies–> Running
transaction check—> Package postgresql93.x86_64 0:9.3.10-1PGDG.rhel6 will be installed–> Processing Dependency: postgresql93-libs = 9.3.10-1PGDG.rhel6 for package: postgresql93-9.3.10-1PGDG.rhel6.x86_64–> Processing Dependency: libpq.so.5()(64bit) for package: postgresql93-9.3.10-1PGDG.rhel6.x86_64—> Package postgresql93-server.x86_64 0:9.3.10-1PGDG.rhel6 will be installed–> Running transaction check—> Package postgresql93-libs.x86_64 0:9.3.10-1PGDG.rhel6 will be installed–> Finished Dependency ResolutionDependencies
Resolved
===================================================================================
Package Arch Version Repository size
===================================================================================
Installing:
postgresql93 x86_64 9.3.10-1PGDG.rhel6 pgdg93 1.0 M
postgresql93-server x86_64 9.3.10-1PGDG.rhel6 pgdg93 4.1 M
Installing for dependencies:
postgresql93-libs x86_64 9.3.10-1PGDG.rhel6 pgdg93 193 kTransaction Summary
====================================================================================
Install 3 Package(s)Total download size: 5.3 MI
nstalled size: 21 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): postgresql93-9.3.10-1PGDG.rhel6.x86_64.rpm | 1.0 MB 00:03
(2/3): postgresql93-libs-9.3.10-1PGDG.rhel6.x86_64.rpm | 193 kB 00:00
(3/3): postgresql93-server-9.3.10-1PGDG.rhel6.x86_64.rpm | 4.1 MB 00:07
———————————————————————————–
Total 451 kB/s | 5.3 MB 00:12
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.** Found 1 pre-existing rpmdb problem(s), ‘yum check’ output follows: edcastle-4.0.3-1.x86_64 has missing requires of /usr/lib/librclog.so()(64bit)
Installing : postgresql93-libs-9.3.10-1PGDG.rhel6.x86_64 1/3
Installing : postgresql93-9.3.10-1PGDG.rhel6.x86_64 2/3
Installing : postgresql93-server-9.3.10-1PGDG.rhel6.x86_64 3/3
Verifying : postgresql93-9.3.10-1PGDG.rhel6.x86_64 1/3
Verifying : postgresql93-server-9.3.10-1PGDG.rhel6.x86_64 2/3
Verifying : postgresql93-libs-9.3.10-1PGDG.rhel6.x86_64 3/3
Installed: postgresql93.x86_64 0:9.3.10-1PGDG.rhel6 postgresql93-server.x86_64 0:9.3.10-1PGDG.rhel6
Dependency Installed: postgresql93-libs.x86_64 0:9.3.10-1PGDG.rhel6Complete!
[root@localhost lib]#
디펜던시까지 알아서 체크하고 libs도 자동으로 다운받아 설치해준다.
설치된 패키지 확인. (postfix는 아니다.)
[root@localhost lib]# rpm -qa | grep postpostfix-2.6.6-6.el6_5.x86_64postgresql93-9.3.10-1PGDG.rhel6.x86_64postgresql93-libs-9.3.10-1PGDG.rhel6.x86_64postgresql93-server-9.3.10-1PGDG.rhel6.x86_64[root@localhost lib]#
postgreSQL의 데이터베이스를 초기화한다. 초기 데이터베이스와 시스템카다로그가 생성된다.
[root@localhost lib]# [root@localhost lib]# /etc/init.d/postgresql-9.3 initdb데이타베이스를 초기함: [ OK ][root@localhost lib]#
이제 완료다. PostgreSQL을 구동한다.
[root@localhost bin]#
설치되고 구동된 PostgreSQL의 상태와 버전을 체크한다.
여기까지 정상이라면 OK..!!