Skip to main content

postgresSQL 9.2.4 설치

  1. 설치정보
    • Postgressql : 9.2.4
    • OS : Centos 5.10
  2. postgressql 컴파일때 필요한 패키지 설치
    $> yum -y install compat-readline43 readline-devel crypto-utils.* openssl* readline-devel pam-devel
  3. 압축 해제하고 , 컴파일 -> 설치 들어가기
    $> tar -zxvf postgresql-9.2.4.tar.gz
    $> cd postgresql-9.2.4
    ./configure \
    -&#45enable-nls=’ko’ \
    -&#45enable-depend \
    -&#45enable-thread-safety \
    --mandir=/usr/share/man \
    --with-includes=/usr/include \
    --with-pam \
    --with-openssl \
    --without-tcl \
    --without-perl \
    --without-python
    $> gmake ; gmake install
  4. postgres사용자 추가
    $> groupadd dba
    $> adduser -d /usr/local/pgsql -g dba -c “PostgreSQL Master User” -m -s $> /bin/bash postgres
    $> mkdir /usr/local/pgsql/data
    $> chown postgres /usr/local/pgsql/data
    $> chown -R postgres:dba /usr/local/pgsql
    $> cd /usr/local/pgsql
    $> chown -R root lib include
  5. 추가된 postgres sql 사용자에 대해서 postgessql 사용할수 있게 설정
    $> su – postgres
    $> echo "
    export MANPATH=\$HOME/man
    export PGDATA=/usr/local/pgsql/data
    export PATH=$PATH:/usr/local/pgsql/bin" >> /usr/local/pgsql/.bash_profile
    $> source /usr/local/pgsql/.bash_profile
    $> exit
  6. postgressql DB초기화 하기
    $> su - postgres -c "/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data"
  7. 재부팅 이후에도 실행할 수 있게 rc.local에 등록하기
    $> echo 'su – postgres -c "/usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data/" &' >> /etc/rc.d/rc.local
  8. 네트워크에서 5432번 포트 열려있는지 확인
    $> netstat -antp
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    ...
    tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 22435/postgres
    ...