linux源码安装postgresql(Centos平台/Pg12.2为例

1. 官网上下载linux的Pg12.2:http://www.postgres.cn/v2/download并解压

2. cd potgresql-12.2

3. ./configure --prefix=/opt/pgsql #拟安装至/opt/pgsql

执行前先安装gcc,readline,readline-devel,zlib,zlib-devel
yum -y install -y readline,如果直接yum install下完了还会报错:

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.

修改权限chmod -R 777 ./configure再执行
成功:

4. make world

执行前先安装libxslt,还要安装依赖yum install xsltproc docbook-xsl docbook-xml
如果yum install epel-release后使用yum异常,修改repo文件后记得reboot即可,但这里不需要epel-release,直接安装libxslt,没安装libxslt会报错:

xsltproc is missing on your system.

没安装依赖会报错:

 /usr/bin/xsltproc --path . --stringparam pg.version '12.2'  stylesheet.xsl postgres.sgml
 error : No such file or directory
 warning: failed to load external entity 
 http://docbook.sourceforge.net/release/xsl/current/xhtml/param.xsl"
 compilation error: file http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook-no-doctype.xsl line 21 element include
 xsl:include : unable to load http://docbook.sourceforge.net/release/xsl/current/xhtml/param.xsl
 error : No such file or directory
 warning: failed to load external entity "http://docbook.sourceforge.net/release/xsl/current/common/labels.xsl"
 compilation error: file http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook-no-doctype.xsl line 26 element include
 xsl:include : unable to load http://docbook.sourceforge.net/release/xsl/current/common/labels.xsl

成功:

5. make install-world

十分的顺利啊哈哈哈哈哈哈哈哈
6. adduser postgres #增加新用户;
mkdir /opt/pgsql/data #创建数据库目录;
chown -R postgres:postgres /opt/pgsql/datasu - postgres #使用postgres帐号操作


7. /opt/pgsql/bin/initdb -D /opt/pgsql/data #初始化数据库
8. /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start #启动数据库
/opt/pgsql/bin/createdb genericdb #假定数据库名为gerericdb)
/opt/pgsql/bin/psql genericdb # (进入数据库内部)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值