暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

CentOS8.4 源码安装PostgreSQL12.8

原创 贾勇智 2021-10-07
1266

1.下载PostgreSQL源码

https://www.postgresql.org/ftp/source/v12.8/


2.安装依赖包:

yum groupinstall "Development tools"

yum install -y bison flex readline-devel zlib-devel


3.安装PostgreSQL

    

    1.解压安装包

    tar -xvf postgresql-12.8.tar.gz

    cd postgresql-12.8/


    2.配置编译:

    ./configure --prefix=/opt/pg12/ --with-pgport=1921


    3.编译

    gmake world

    PostgreSQL, contrib, and documentation successfully made. Ready to install.  <----出现此行,表示编译成功。


    4.安装

    gmake install-world

    PostgreSQL, contrib, and documentation installation complete. <----出现此行,表示安装成功。

    

    5.查看安装的版本

    /opt/pg12/bin/postgres  --version

    postgres (PostgreSQL) 12.8


    6.设置软链接,避免升级后调整大量脚本

    ln -s /opt/pg12 /opt/pgsql

    lrwxrwxrwx 1 root root  9 Oct  7 05:53 pgsql -> /opt/pg12


    7.将/opt/pgsql/bin路径加入到用户PATH

    PATH=$PATH:$HOME/bin:/opt/pgsql/bin

    生效:

    source .bash_profile

    验证有效性:

    [root@pg02 ~]# psql

    psql: error: could not connect to server: No such file or directory

        Is the server running locally and accepting

        connections on Unix domain socket "/tmp/.s.PGSQL.1921"?


至此,PostgreSQL12.8以源码方式安装完成。


参考官方文档:

https://www.postgresql.org/docs/12/install-procedure.html

最后修改时间:2021-10-07 21:16:24
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论