CentOS 7에서, 인터넷이 되지 않는 환경에서 PostgreSQL, PostGIS 설치 절차

인터넷이 되지 않은 환경에서 PostgreSQL과 PostGIS를 설치하는 절차에 대해 정리한 글을 Keep해 둡니다. Windows에서 pgAdmin으로 접속하여 ‘CREATE EXTENSION postgis’ 명령 처리에 대한 내용까지 확인하였습니다.

먼저 PostgreSQL 설치 절차입니다.

# postgresq RPM Install
rpm -Uvh pgdg-centos94-9.4-2.noarch.rpm
rpm -ivh postgresql94-libs-9.4.9-1PGDG.rhel7.x86_64
rpm -ivh postgresql94-9.4.9-1PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql94-server-9.4.9-1PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql94-devel-9.4.9-1PGDG.rhel7.x86_64.rpm
rpm -ivh libxslt-1.1.28-5.el7.x86_64.rpm
rpm -ivh postgresql94-contrib-9.4.9-1PGDG.rhel7.x86_64.rpm

# init DB
./postgresql194-setup initdb

# OS start, start PostgreSQL Server
systemctl enable postgresql-9.4

# Start Postgresql service
systemctl enable postgresql-9.4.service
systemctl start postgresql-9.4.service

# Firewall allow port 5432
firewall-cmd --zone=public --add-port=5432/tcp

# allow connection for all client IP
vi postgresql.conf
listen_addresses = "*"

# Configuring PostgreSQL Authentication
su - postgres
psql
\password postgres
\q

# edit pg_hba.conf
local all all peer
-> Do change
local all all md5

host all all 127.0.0.1/32 ident
-> Do change
host all all 0.0.0.0/0 md5

host all all ::1/128 ident
-> Do change
host all all ::1/128 md5

# restart Postgresql service
systemctl stop postgresql-9.4.service
systemctl start postgresql-9.4.service

다음은 PostGIS 설치 절차입니다.

# proj 설치
tar zxf proj-4.8.0.tar.gz
cd proj-4.8.0
./configure
make && make install

# geos 컴파일
tar xvf geos-3.4.2.tar.bz2
cd geos-3.4.2
./configure
make && make install

# libxml 설치 (rpm에서 package 총돌시 --replacefiles 옵션을 사용)
rpm -ivh ./libxml2-2.9.1-5.el7_1.2.x86_64.rpm
rpm -ivh ./xz-libs-5.1.2-12alpha.el7.x86_64.rpm
rpm -ivh ./xz-devel-5.1.2-12alpha.el7.x86_64.rpm
rpm -ivh ./zlib-libs-1.2.7-15.el7.x86_64.rpm
rpm -ivh ./zlib-devel-1.2.7-15.el7.x86_64.rpm
rpm -ivh ./libxml2-devel-2.9.1-5.el7_1.2.x86_64.rpm

# json 설치
rpm -ivh ./json-c-0.11-4.el7_0.x86_64.rpm

# gdal 컴파일
tar zxf gdal-1.9.2.tar.gz
cd gdal-1.9.2.tar.gz
./configure
make && make install

# postgis 컴파일
tar zxf postgis-2.0.3SVN.tar.gz
cd postgis-2.1.8
./configure --with-pgconfig=/usr/pgsql-9.4/bin/pg_config --with-raster
make && make install

# 모듈 파일(.so) 업데이트
echo /usr/local/lib >> /etc/ld.so.conf
ldconfig

# postgis 배포
cd extensions/postgis
make clean
make && make install
cd ..
cd postgis_topology
make clean
make && make install

# restart Postgresql service
systemctl restart postgresql-9.4.service

인터넷이 되지 않는 환경에서 PostgreSQL과 PostGIS 설치를 하는 분들에게 도움이 되시기 바랍니다.

jQuery 선택자 컨닝 페이퍼 2

filter

filter 함수는 이미 선택된 항목에 대해서 다시 한번 더 선택을 하고자 할 때 사용합니다.

$('h1').css('background', '#ff0000').filter(':even').css({'color', '#00ff00');

인자를 함수 객체를 던져 처리하는 형태도 가능하며, 아래의 예는 h1 요소 중 짝수번째 요소들에 대한 처리입니다.

$('h1').filter(
    function(index) {
        return (index % 2) == 0;
    }
).css({'color', '#00ff00'});

eq, first, last

요소에 대한 위치 순서로 선택하는 선택자 함수입니다.

$('p').eq(3).css('color', '#00ff00'); // 4번째 요소
$('p').first().css('color', '#ff0000'); // 첫번째 요소
$('p').last().css('color', '#0000ff'); // 마지막 요소
$('p'').eq(-1).css('color', '#ff00ff'); // 끝에서 첫번째 요소

add

이미 선택된 요소들에 다른 요소를 추가하는 함수입니다.

$('p').css('color', '#ff0000').add('span').css('background', '#ffff00');

is

해당 요소가 선택 조건에 맞는지를 검사합니다.

$('h1').each(
    function() {
        if($(this).is('.a')) {
            $(this).css('color', '#ff0000');
        }
    }
);

find

특정 태그 또는 클래스를 갖는 요소를 선택하는 함수입니다.

var doc = $('

...

...

...
'); doc.find('p').each( function(index) { $(this).css('background', '#0000ff'); } );