2017년 11월 26일 일요일

PostgreSQL 소스 설치 (Ubuntu Server 16.04)

PostgreSQL 를 Ubuntu Server 16.04 에 설치할 때,
에러 없이 한번에 주루룩 설치하면 좋겠지만,
현실은 에러 메세지를 몇번 해결해 줘야 한다.

설치 진행 중에 나타나는 에러와 해결 방법을 적어보았다.

PostgreSQL 을 다운로드 하자.
% wget https://ftp.postgresql.org/pub/source/v9.6.5/postgresql-9.6.5.tar.gz

압축을 해제 하자.
% tar vxzf postgresql-9.6.5.tar.gz

디렉토리로 이동 하자.
% cd postgresql-9.6.5

설정을 진행 하자.
% ./configure --prefix=$HOME/postgresql --enable-debug

checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking which template to use... linux
checking whether to build with 64-bit integer date/time support... yes
checking whether NLS is wanted... no
checking for default port number... 5432
checking for block size... 8kB
checking for segment size... 1GB
checking for WAL block size... 8kB
checking for WAL segment size... 16MB
checking for gcc... no
checking for cc... no
configure: error: in `/home/ck0911/postgresql-9.6.5_3':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

컴파일러를 못 찾겠다는 에러다.
컴파일러를 설치 하자.
% sudo apt-get install gcc

configure: error: readline library not found
If you have readline already installed, see config.log for details on the
failure.  It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.

readline 라이브러리를 못 찾겠다는 에러다.
readline 라이브러리를 설치 하자.
% sudo apt-get install libreadline-dev

configure: error: zlib library not found
If you have zlib already installed, see config.log for details on the
failure.  It is possible the compiler isn't looking in the proper directory.
Use --without-zlib to disable zlib support.

zlib 라이브러리를 못 찾겠다는 에러다.
zlib 라이브러리를 설치 하자.
% sudo apt-get install zlib1g-dev

configure: using CFLAGS=-Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2
configure: using CPPFLAGS= -D_GNU_SOURCE
configure: using LDFLAGS=  -Wl,--as-needed
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: creating src/include/pg_config_ext.h
config.status: creating src/interfaces/ecpg/include/ecpg_config.h
config.status: linking src/backend/port/tas/dummy.s to src/backend/port/tas.s
config.status: linking src/backend/port/dynloader/linux.c to src/backend/port/dynloader.c
config.status: linking src/backend/port/sysv_sema.c to src/backend/port/pg_sema.c
config.status: linking src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.c
config.status: linking src/backend/port/dynloader/linux.h to src/include/dynloader.h
config.status: linking src/include/port/linux.h to src/include/pg_config_os.h
config.status: linking src/makefiles/Makefile.linux to src/Makefile.port

설정이 완료 되었다.
컴파일을 해보자.
% make

The program 'make' can be found in the following packages:
 * make
 * make-guile
Try: sudo apt install <selected package>

make 를 못 찾겠다는 에러다.
make 를 설치 하자.
% sudo apt-get install make

ERROR: `bison' is missing on your system. It is needed to create the
file `gram.c'. You can either get bison from a GNU mirror site
or download an official distribution of PostgreSQL, which contains
pre-packaged bison output.

bison 을 못 찾겠다는 에러다.
bison 을 설치 하자.
% sudo apt-get install bison

ERROR: `flex' is missing on your system. It is needed to create the
file `bootscanner.c'. You can either get flex from a GNU mirror site
or download an official distribution of PostgreSQL, which contains
pre-packaged flex output.

flex 를 못 찾겠다는 에러다.
flex 를 설치 하자.
% sudo apt-get install flex

All of PostgreSQL successfully made. Ready to install.

컴파일이 완료 되었다.
install 을 하자.
% make install

PostgreSQL installation complete.

설치가 완료 되었다.
initdb 를 실행시켜서 DB 가 잘 생성되는지 확인한다.
% initdb

The files belonging to this database system will be owned by user "ck0911".
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.

creating directory /home/ck0911/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... 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:

    pg_ctl -D /home/ck0911/postgresql/data -l logfile start

db 가 잘 생성되었다. 이제 PostgreSQL 을 사용하면 된다.

※ 한꺼번에 설치하고자 할 때는
% sudo apt-get install gcc libreadline-dev zlib1g-dev make bison flex

※ xml library 도 설치해 주는것이 좋다.
% sudo apt-get install libxml2-dev





출처
https://askubuntu.com/questions/89389/how-to-solve-configure-error-readline-library-not-found
https://askubuntu.com/questions/508934/how-to-install-libpng-and-zlib

댓글 없음:

댓글 쓰기

화곡 어쩌라고, 굴사냥

석화찜(굴찜)을 먹으러 여의도로 갔다 그런데 재료가 모두 소진되었다고 마감이라고 한다 응? 다들 굴에 미쳤나? 굴을 찾아 헤매다 보니, 화곡까지 가게 되었다. 화곡은 처음 가본다. 첫인상은 "술집 겁네 많네" 피똥쌀때까지 마실 수 있...