Skip to main content

postgresSQL 9.4.26 설치

패키지 설치진행

  1. db실행 사용자 및 data 디렉토리 생성
    $> useradd psql
    $> mkdir /home/data
    $> chown -R psql: /home/data
  2. source 파일 다운로드
    $> wget https://ftp.postgresql.org/pub/source/v9.4.26/postgresql-9.4.26.tar.gz --no-check-certificate
  3. depencency 패키지 설치
    $> yum install \
    readline-devel \
    zlib-devel \
    openssl-devel \
    tcl-devel -y
  4. 컴파일 후 설치진행
    $> ./configure --prefix=/usr/local/psql --with-openssl --with-tcl
    $> make -j 4
    $> make -j 4 install

DB 실행

  1. psql 실행
    $> su - psql
    $> cd /usr/local/psql/bin
    $> ./initdb -D /home/data
    
    The files belonging to this database system will be owned by user "psql".
    This user must also own the server process.
    
    The database cluster will be initialized with locale "ko_KR.UTF-8".
    The default database encoding has accordingly been set to "UTF8".
    initdb: could not find suitable text search configuration for locale "ko_KR.UTF-8"
    The default text search configuration will be set to "simple".
    
    Data page checksums are disabled.
    
    fixing permissions on existing directory /home/data ... ok
    creating subdirectories ... ok
    selecting default max_connections ... 100
    selecting default shared_buffers ... 128MB
    selecting default timezone ... ROK
    selecting dynamic shared memory implementation ... posix
    creating configuration files ... ok
    creating template1 database in /home/data/base/1 ... ok
    initializing pg_authid ... ok
    initializing dependencies ... ok
    creating system views ... ok
    loading system objects' descriptions ... ok
    creating collations ... ok
    creating conversions ... ok
    creating dictionaries ... ok
    setting privileges on built-in objects ... ok
    creating information schema ... ok
    loading PL/pgSQL server-side language ... ok
    vacuuming database template1 ... ok
    copying template1 to template0 ... ok
    copying template1 to postgres ... ok
    syncing data to disk ... ok
    
    WARNING: enabling "trust" authentication for local connections
    You can change this by editing pg_hba.conf or using the option -A, or
    --auth-local and --auth-host, the next time you run initdb.
    
    Success. You can now start the database server using:
    
        ./postgres -D /home/data
    or
        ./pg_ctl -D /home/data -l logfile start
  2. 프로세스 실행
    $ /usr/local/psql/bin/postgres -D /home/data/ >logfile  2>&1 &
  3. 프로세스 실행상태 확인
    $> ps -ef | grep post
    psql     16193 16108  0 10:54 pts/0    00:00:00 /usr/local/psql/bin/postgres -D /home/data/
    psql     16195 16193  0 10:54 ?        00:00:00 postgres: checkpointer process
    psql     16196 16193  0 10:54 ?        00:00:00 postgres: writer process
    psql     16197 16193  0 10:54 ?        00:00:00 postgres: wal writer process
    psql     16198 16193  0 10:54 ?        00:00:00 postgres: autovacuum launcher process
    psql     16199 16193  0 10:54 ?        00:00:00 postgres: stats collector process
    psql     16201 16108  0 10:54 pts/0    00:00:00 grep --color=auto post
    
     netstat -antp | grep postgres
    (Not all processes could be identified, non-owned process info
     will not be shown, you would have to be root to see it all.)
    tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      16193/postgres
    tcp6       0      0 ::1:5432                :::*                    LISTEN      16193/postgres