需要软件:postgresql-9.1.6.tar.gz
useradd postgres 创建postgres用户
tar -zxf postgresql-9.1.6.tar.gz 解压postgresql
cd postgresql-9.1.6 进入postgres目录
./configure --prefix=/service/db/postgres \
--with-pgport=1949 \
--with-segsize=8 \
--with-wal-segsize=64 \
--with-wal-blocksize=64 \
--with-perl --with-python \
--with-openssl \
--with-pam \
--with-ldap \
--with-libxml \
--with-libxslt \
--enable-thread-safety
make 编译
make install 编译安装
切换到postgres用户
编辑postgres家目录的bash_profile
添加配置信息
PATH=$PATH:$HOME/bin
export PGHOME=/service/db/postgres/
export PGDATA=/service/db/pgdata/
export PATH=$PATH:$HOME/bin:$PGHOME/bin
source ~/.bash_profile重新刷新配置信息
initdb
初始化postgres数据库 成功会有ok
cd /usr/local/src/postgresql-9.1.6/contrib/start-scripts/
进入源码包目录下的contrib-scripts
chmod a+x linux 给目录下面的linux添加执行权限
cp linux /etc/init.d/postgresql 复制到/etc/init.d/ 命名为postgresql
添加配置信息
prefix=/service/db/postgres 指定postgre路径
PGDATA="/service/db/pgdata" 指定pgdata路径
service postgresql start 启动postgresql
chkconfig --add postgresql 设置开机自启动
ln -s /service/db/postgres/bin/psql /usr/bin/ 添加一个软连接
psql -h 127.0.0.1 -d postgres -U postgres 测试没问题,安装完成
yum -y install perl-ExtUtils-Embed readline-devel openssl-devel pam-devel libxml2-devel libxslt-devel openldap-devel openldap python-devel
错误:configure: error: could not determine flags for linking embedded Perl.
This probably means that ExtUtils::Embed or ExtUtils::MakeMaker is not installed.
解决:yum install perl-ExtUtils-Embed
错误:configure: error: readline library not found
解决:yum -y install -y readline-devel
错误:configure: error: library ‘crypto‘ is required for OpenSSL
解决:yum -y install openssl-devel
错误:configure: error: library ‘pam‘ is required for PAM
解决: yum -y install pam-devel
错误:configure: error: library ‘xml2‘ (version >= 2.6.23) is required for XML support
解决:yum -y install libxml2-devel
错误:configure: error: library ‘xslt‘ is required for XSLT support
解决: yum -y install libxslt-devel
错误:configure: error: header file <ldap.h> is required for LDAP
解决: yum -y install openldap openldap-devel
错误:configure: error: header file <Python.h> is required for Python
解决:yum -y install python-devel
原文:http://www.cnblogs.com/xuliangwei/p/6337942.html