PostgreSQL 이 어떤건지, 어떤 역사를 가지고 있는지에 대해서 알아봤으니 이제 설치를 해보도록 합시다.
나는 개발자가 아니기에 PostgreSQL 문서중 Server Admin 에 대한 내용을 중점으로 다루도록 하겠습니다.
설치는 AWS Amazon Linux 기준으로 진행하도록 하겠습니다.
가장 쉬운 방법인 "yum" 을 통한 설치를 하게되면 PostgreSQL 9.2.22 버전이 설치 됩니다.
우선 PostgreSQL 다운로드 해보도록 하자
https://www.postgresql.org/download/
여러가지 Download Link 가 있다.
[BSD]
FreeBSD
- https://www.postgresql.org/download/freebsd/
- https://www.freebsd.org/cgi/ports.cgi?query=postgresql&stype=name&sektion=databases
OpenBSD
- https://www.postgresql.org/download/openbsd/
- http://www.openbsd.org/faq/faq15.html
[Linux]
Redhat Family Linux (including CentOS/Fedora/Scientfic/Oracle variants)
- https://www.postgresql.org/download/linux/redhat/
Debian GNU/Linux and derivatives]
- https://www.postgresql.org/download/linux/debian/
Ubuntu Linux and derivatives
- https://www.postgresql.org/download/linux/ubuntu/
SuSE and OpenSuSE
- https://www.postgresql.org/download/linux/suse/
Other Linux
- https://www.postgresql.org/download/linux/
[macOS]
- https://www.postgresql.org/download/macosx/
[Solaris]
- https://www.postgresql.org/download/solaris/
[Windows]
- https://www.postgresql.org/download/windows/
위의 링크는 Binary Packages 형태의 설치 가이드 입니다.
하지만 저는 기본적으로 소스설치 기준으로 설치를 진행해보도록 하겠습니다.
[Source]
- https://www.postgresql.org/ftp/source/
- https://git.postgresql.org/gitweb/?p=postgresql.git;a=summary
Git 으로 설치하는것과 Make 를 이용한 설치 두가지중 Make 를 이용한 설치를 우선적으로 해보도록 하겠습니다.
"https://www.postgresql.org/ftp/source/v10.0/" 여기에서 파일을 다운로드 하시면 됩니다.
[root@ip-10-90-10-49 postgresql]# wget https://ftp.postgresql.org/pub/source/v10.0/postgresql-10.0.tar.gz
--2017-10-27 03:10:39-- https://ftp.postgresql.org/pub/source/v10.0/postgresql-10.0.tar.gz
Resolving ftp.postgresql.org (ftp.postgresql.org)... 87.238.57.227, 174.143.35.246, 204.145.124.244, ...
Connecting to ftp.postgresql.org (ftp.postgresql.org)|87.238.57.227|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25830653 (25M) [application/x-gzip]
Saving to: ‘postgresql-10.0.tar.gz’
postgresql-10.0.tar.gz 100%[======================================================================>] 24.63M 4.69MB/s in 6.8s
2017-10-27 03:10:48 (3.62 MB/s) - ‘postgresql-10.0.tar.gz’ saved [25830653/25830653]
[root@ip-10-90-10-49 postgresql]#
[root@ip-10-90-10-49 postgresql-10.0]# ./configure && make && make install
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 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 `/root/postgresql/postgresql-10.0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[root@ip-10-90-10-49 postgresql-10.0]#
메뉴얼에 나와있는대로 ./configure 를 진행하였으나 오류가 발생하였습니다. 위의 메시지를 잘보시면 gcc, cc 가 no 라는 메시지를 발견할수 있습니다. gcc 및 기타 개발관련 Package 를 설치해 줍니다.
[root@ip-10-90-10-49 postgresql-10.0]# yum groupinstall 'Development Tools'
다시 설치를 하다보니 이번에는 readline 에서 오류가 발생하는군요
checking for library containing readline... no
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.
[root@ip-10-90-10-49 postgresql-10.0]#
http://rpmfind.net/linux/rpm2html/search.php?query=readline-devel
readline 라이브러리는 "readline-devel" 설치하면 해결이 될듯 합니다.
[root@ip-10-90-10-49 postgresql-10.0]# yum install readline-devel
checking for inflate in -lz... no
configure: error: zlib library not found
설치가 잘 됩니다.
make[1]: Leaving directory `/root/postgresql/postgresql-10.0/src'
make -C config install
make[1]: Entering directory `/root/postgresql/postgresql-10.0/config'
/bin/mkdir -p '/usr/local/pgsql/lib/pgxs/config'
/usr/bin/install -c -m 755 ./install-sh '/usr/local/pgsql/lib/pgxs/config/install-sh'
/usr/bin/install -c -m 755 ./missing '/usr/local/pgsql/lib/pgxs/config/missing'
make[1]: Leaving directory `/root/postgresql/postgresql-10.0/config'
PostgreSQL installation complete.
[root@ip-10-90-10-49 postgresql-10.0]#
설치가 잘 완료되었습니다.
Amazon Linux 에서 PostgreSQL을 설치할때에 3가지를 추가 설치 하였습니다.
'Development Tools'
readline-devel
zlib-devel
PostgreSQL 을 설치하기 위한 기본 라이브러리 리스트가 있을듯 하지만 추 후 추가 하도록 하겠습니다.
다음 해야할 일은 "PostgreSQL" 을 운영하기 위한 user 의 등록과 서비스 올리기 입니다.
[root@ip-10-90-10-49 postgresql-10.0]# useradd postgres
postgres 유저를 생성합니다.
[root@ip-10-90-10-49 postgresql-10.0]# mkdir /usr/local/pgsql/data
'Database > PostgreSQL' 카테고리의 다른 글
6. PostgreSQL 커널 리소스 관리 (0) | 2017.11.03 |
---|---|
5. PostgreSQL 데몬구동 설정 및 운영 (0) | 2017.10.31 |
4. PostgreSQL 설치 시 요구사항 (0) | 2017.10.31 |
2. PostgreSQL 의 역사 (0) | 2017.10.27 |
1. PostgreSQL ? (0) | 2017.10.26 |