검색결과 리스트
database에 해당되는 글 1건
- 2012.03.29 PostgerSQL 9.1 Install on CentOS 5.x 1
글
PostgerSQL 9.1 Install on CentOS 5.x
카테고리 없음
2012. 3. 29. 13:50
본 문서는 외부에서 특정 사용자로 접속이 가능한 상태까지를 가이드 합니다.
이후의 작업은 pgAdmin III으로 작업하는 것을 상정합니다.
[root@localhost ~]# wget http://yum.pgrpms.org/reporpms/9.1/pgdg-centos91-9.1-4.noarch.rpm
--2012-03-29 02:58:42-- http://yum.pgrpms.org/reporpms/9.1/pgdg-centos91-9.1-4.noarch.rpm
Resolving yum.pgrpms.org... failed: name resolution에서 일시적인 실패.
wget: unable to resolve host address `yum.pgrpms.org'
[root@localhost ~]# vi /etc/resolv.conf
--2012-03-29 02:58:42-- http://yum.pgrpms.org/reporpms/9.1/pgdg-centos91-9.1-4.noarch.rpm
Resolving yum.pgrpms.org... failed: name resolution에서 일시적인 실패.
wget: unable to resolve host address `yum.pgrpms.org'
[root@localhost ~]# vi /etc/resolv.conf
....
search localdomain
nameserver 164.124.101.2
nameserver 203.248.252.2
nameserver 164.124.101.2
nameserver 203.248.252.2
....
[root@localhost ~]# wget http://yum.pgrpms.org/reporpms/9.1/pgdg-centos91-9.1-4.noarch.rpm
--2012-03-29 02:19:26-- http://yum.pgrpms.org/reporpms/9.1/pgdg-centos91-9.1-4.noarch.rpm
Resolving yum.pgrpms.org... 98.129.198.114
Connecting to yum.pgrpms.org|98.129.198.114|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4925 (4.8K) [application/x-redhat-package-manager]
Saving to: `pgdg-centos91-9.1-4.noarch.rpm.1'
100%[=========================================================================>] 4,925 26.1K/s in 0.2s
2012-03-29 02:19:28 (26.1 KB/s) - `pgdg-centos91-9.1-4.noarch.rpm.1' saved [4925/4925]
[root@localhost ~]# rpm -i pgdg-centos91-9.1-4.noarch.rpm
경고: pgdg-centos91-9.1-4.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 442df0f8
[root@localhost ~]# yum install postgresql91-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.daum.net
* extras: ftp.daum.net
* updates: ftp.daum.net
pgdg91 | 2.8 kB 00:00
pgdg91/primary_db | 79 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package postgresql91-server.x86_64 0:9.1.3-1PGDG.rhel5 set to be updated
--> Processing Dependency: postgresql91 = 9.1.3-1PGDG.rhel5 for package: postgresql91-server
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql91-server
--> Running transaction check
---> Package postgresql91.x86_64 0:9.1.3-1PGDG.rhel5 set to be updated
---> Package postgresql91-libs.x86_64 0:9.1.3-1PGDG.rhel5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================================
Package Arch Version Repository Size
===================================================================================================================
Installing:
postgresql91-server x86_64 9.1.3-1PGDG.rhel5 pgdg91 5.2 M
Installing for dependencies:
postgresql91 x86_64 9.1.3-1PGDG.rhel5 pgdg91 1.6 M
postgresql91-libs x86_64 9.1.3-1PGDG.rhel5 pgdg91 216 k
Transaction Summary
===================================================================================================================
Install 3 Package(s)
Upgrade 0 Package(s)
Total download size: 7.0 M
Is this ok [y/N]: Y
Downloading Packages:
(1/3): postgresql91-libs-9.1.3-1PGDG.rhel5.x86_64.rpm | 216 kB 00:01
(2/3): postgresql91-9.1.3-1PGDG.rhel5.x86_64.rpm | 1.6 MB 00:01
(3/3): postgresql91-server-9.1.3-1PGDG.rhel5.x86_64.rpm | 5.2 MB 00:01
-------------------------------------------------------------------------------------------------------------------
Total 1.5 MB/s | 7.0 MB 00:04
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : postgresql91-libs 1/3
Installing : postgresql91 2/3
Installing : postgresql91-server 3/3
Installed:
postgresql91-server.x86_64 0:9.1.3-1PGDG.rhel5
Dependency Installed:
postgresql91.x86_64 0:9.1.3-1PGDG.rhel5 postgresql91-libs.x86_64 0:9.1.3-1PGDG.rhel5
Complete!
[root@localhost ~]# service postgresql-9.1 initdb
데이타베이스를 초기화함: [ OK ]
[root@localhost ~]# service postgresql-9.1 start
postgresql-9.1 서비스를 시작 중: [ OK ]
[root@localhost ~]# chkconfig postgresql-9.1 on
--2012-03-29 02:19:26-- http://yum.pgrpms.org/reporpms/9.1/pgdg-centos91-9.1-4.noarch.rpm
Resolving yum.pgrpms.org... 98.129.198.114
Connecting to yum.pgrpms.org|98.129.198.114|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4925 (4.8K) [application/x-redhat-package-manager]
Saving to: `pgdg-centos91-9.1-4.noarch.rpm.1'
100%[=========================================================================>] 4,925 26.1K/s in 0.2s
2012-03-29 02:19:28 (26.1 KB/s) - `pgdg-centos91-9.1-4.noarch.rpm.1' saved [4925/4925]
[root@localhost ~]# rpm -i pgdg-centos91-9.1-4.noarch.rpm
경고: pgdg-centos91-9.1-4.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 442df0f8
[root@localhost ~]# yum install postgresql91-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.daum.net
* extras: ftp.daum.net
* updates: ftp.daum.net
pgdg91 | 2.8 kB 00:00
pgdg91/primary_db | 79 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package postgresql91-server.x86_64 0:9.1.3-1PGDG.rhel5 set to be updated
--> Processing Dependency: postgresql91 = 9.1.3-1PGDG.rhel5 for package: postgresql91-server
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql91-server
--> Running transaction check
---> Package postgresql91.x86_64 0:9.1.3-1PGDG.rhel5 set to be updated
---> Package postgresql91-libs.x86_64 0:9.1.3-1PGDG.rhel5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================================
Package Arch Version Repository Size
===================================================================================================================
Installing:
postgresql91-server x86_64 9.1.3-1PGDG.rhel5 pgdg91 5.2 M
Installing for dependencies:
postgresql91 x86_64 9.1.3-1PGDG.rhel5 pgdg91 1.6 M
postgresql91-libs x86_64 9.1.3-1PGDG.rhel5 pgdg91 216 k
Transaction Summary
===================================================================================================================
Install 3 Package(s)
Upgrade 0 Package(s)
Total download size: 7.0 M
Is this ok [y/N]: Y
Downloading Packages:
(1/3): postgresql91-libs-9.1.3-1PGDG.rhel5.x86_64.rpm | 216 kB 00:01
(2/3): postgresql91-9.1.3-1PGDG.rhel5.x86_64.rpm | 1.6 MB 00:01
(3/3): postgresql91-server-9.1.3-1PGDG.rhel5.x86_64.rpm | 5.2 MB 00:01
-------------------------------------------------------------------------------------------------------------------
Total 1.5 MB/s | 7.0 MB 00:04
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : postgresql91-libs 1/3
Installing : postgresql91 2/3
Installing : postgresql91-server 3/3
Installed:
postgresql91-server.x86_64 0:9.1.3-1PGDG.rhel5
Dependency Installed:
postgresql91.x86_64 0:9.1.3-1PGDG.rhel5 postgresql91-libs.x86_64 0:9.1.3-1PGDG.rhel5
Complete!
[root@localhost ~]# service postgresql-9.1 initdb
데이타베이스를 초기화함: [ OK ]
[root@localhost ~]# service postgresql-9.1 start
postgresql-9.1 서비스를 시작 중: [ OK ]
[root@localhost ~]# chkconfig postgresql-9.1 on
[root@localhost ~]# cd /var/lib/pgsql/9.1/data
[root@localhost data]# ls
PG_VERSION pg_clog pg_log pg_serial pg_tblspc postgresql.conf
base pg_hba.conf pg_multixact pg_stat_tmp pg_twophase postmaster.opts
global pg_ident.conf pg_notify pg_subtrans pg_xlog postmaster.pid
[root@localhost data]#
[root@localhost data]# ls
PG_VERSION pg_clog pg_log pg_serial pg_tblspc postgresql.conf
base pg_hba.conf pg_multixact pg_stat_tmp pg_twophase postmaster.opts
global pg_ident.conf pg_notify pg_subtrans pg_xlog postmaster.pid
[root@localhost data]#
[root@localhost data]# vi postgresql.conf
....
...
# - Connection Settings -
#listen_addresses = 'localhost' # what IP address(es) to listen on;
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
#listen_addresses = 'localhost' # what IP address(es) to listen on;
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
....
...
[root@localhost data]# vi pg_hba.conf
....
...
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
#host all all 127.0.0.1/32 ident
host all all 0.0.0.0/0 md5
# IPv6 local connections:
host all all ::1/128 md5
...
...
[root@localhost data]# service postgresql-9.1 restart
postgresql-9.1 서비스를 중지 중: [ OK ]
postgresql-9.1 서비스를 시작 중: [ OK ]
[root@localhost data]# su postgres
postgresql-9.1 서비스를 중지 중: [ OK ]
postgresql-9.1 서비스를 시작 중: [ OK ]
[root@localhost data]# su postgres
bash-3.2$ createuser -P ls_admin
Enter password for new role:
비밀번호 확인:
Shall the new role be a superuser? (y/n) y
CREATE ROLE
bash-3.2$
Enter password for new role:
비밀번호 확인:
Shall the new role be a superuser? (y/n) y
CREATE ROLE
bash-3.2$
bash-3.2$ dropuser ls_admin
DROP ROLE