본문 바로가기
server/Cent_os

postgresql93+Postgis install from CentOS6



Geoserver 구축시 공간 데이터베이스는 데이터베이스 안에 도형 레코드들을 저장할 수 있을 뿐만 아니라 이 도형들을 이용해서 레코드를 쿼리하거나 추출할 수 있는 기능도 제공합니다.. postgresql 설치를 진행 하고 해당 확장 모듈을 설치 하는 방법을 설명 하겠습니다.



#postgresql 9.3 Repo rpm 파일 설치 후 postgresql9.3 Server 설치 및, init db 를 통하여 DB초기화를 진행


[root@localhost ~]#yum install postgresql93-server -y
[root@localhost ~]#/etc/init.d/postgresql-9.3 initdb
[root@localhost ~]#/etc/init.d/postgresql-9.3 start
[root@localhost ~]#chkconfig postgresql-9.3 on

# 설치시 기본적으로 생성된 postgres 계정으로 DB계정 postgres  에 대하여 비밀번호 1234 설정 진행 

[root@localhost ~]# su - postgres
-bash-4.1$ psql
psql (9.3.19)
Type "help" for help.
postgres=#  alter user postgres with password '1234';         
postgres=# \q
-bash-4.1$ exit
logout
# 외부에서 pgadmin 등으로 작업을 진행 하기 위해서 binding ip 및 접속방법을 md5 hash 로 변경 진행 

[root@localhost ~]# vim /var/lib/pgsql/9.3/data/pg_hba.conf
#host    all             all             127.0.0.1/32            password
host    all             all             0.0.0.0/0            md5
[root@localhost ~]#vim /var/lib/pgsql/9.3/data/postgresql.conf
listen_addresses = '*'          # what IP address(es) to listen on
[root@localhost ~]#/etc/init.d/postgresql-9.3 restart    


# PostGIS 설치를 위해서 epel repo 설치 및 postgis 를 설치 

[root@localhost ~]#yum install epel* -y
[root@localhost ~]#yum install postgis2_93* -y
[root@localhost ~]#yum install pgrouting_93* -y

# Postgresql cli 로 진입하여 template1 에 postgis 설치 및 해당 template 을 이용 하여 testgis 라는 테스트 db를 생성 
[root@localhost ~]# su - postgres
-bash-4.1$ psql
psql (9.3.19)
Type "help" for help.

postgres=# \c template1

postgres=# CREATE EXTENSION postgis;

postgres=# createdb testgis -T template1;

postgres=# \c testgis
You are now connected to database "testgis" as user "postgres".






반응형