PostgreSQL是一款一直被人们忽视的伟大的关系型数据库。
PostgreSQL源码目录结构:文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
# tree -L 1 postgresql-9.3.4
postgresql-9.3.4
|-- COPYRIGHT
|-- GNUmakefile
|-- GNUmakefile.in
|-- HISTORY
|-- INSTALL
|-- Makefile
|-- README
|-- aclocal.m4
|-- config
|-- config.log
|-- config.status
|-- configure 源码安装配置脚本
|-- configure.in
|-- contrib 已经打包到pg源码中的第三方插件源码,非常实用
|-- doc 文档
`-- src 源代码文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
前提条件:文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
1. GUN make版本不低于3.80文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
2. GUN Readline库文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
3. zlib库文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
4. perl的完整包,包括libperl库,头文件。否则报以下错误:文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
*** Cannot build PL/Perl because libperl is not a shared library.
*** You might have to rebuild your Perl installation. Refer to
*** the documentation for details.文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
5. Python相关库文件和模块,libpython库,distutils模块。Python版本不低于2.3或3.1,否则报以下错:文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
*** Cannot build PL/Python because libpython is not a shared library.
*** You might have to rebuild your Python installation. Refer to
*** the documentation for details.文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
同时,请注意:在编译安装Python时,务必加上--enable-shared编译参数,在有些系统下,操作系统不会创建分享库,centos系统便是如此的,会报找不到模块的错误。文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
安装:文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
# http://ftp.postgresql.org/pub/source/v9.3.4/postgresql-9.3.4.tar.gz # tar zxvf postgresql-9.3.4.tar.gz # cd postgresql-9.3.4 # ./configure 默认会安装在/usr/local/pgsql目录下 # gmake # gmake install # adduser postgres # mkdir /usr/local/pgsql/data # chown postgres /usr/local/pgsql/data # su - postgres $ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data $ /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 & $ /usr/local/pgsql/bin/createdb test $ /usr/local/pgsql/bin/psql test
设置环境变量:文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
# vim /etc/ld.so.conf.d/pgsql.conf文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
/usr/local/pgsql/lib文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
# ldconfig文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
# vim /root/.bash_profile文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
PATH=/usr/local/pgsql/bin:$PATH
export PATH文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
# source /root/.bash_profile文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
PostgreSQL使用下节介绍。文章源自运维生存时间-https://www.ttlsa.com/database/postgresql-install/
评论