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

Ubuntu源码安装PostgreSQL

PostgreSQL学习 2019-11-13
1972

1、从www.postgresql.org下载PostgreSQL源代码11.5

2、用apt安装编译工具gcc、readline和zlib的开发包

3、在源码目录中执行

./configure --prefix=/opt/pg

make

make install

4、进入源码的contrib目录执行

make all

make install

5、初始化数据库

useradd postgres

mkdir opt/data

chown -R postgres.postgre opt/data

su - postgres

/opt/pg/bin/initdb -D /opt/data -E utf8

6、在/etc/profile文件设置环境变量

export PATH=/opt/pg/bin:$PATH

export PGDATA=/opt/data

export PGDATABASE=web

export PGUSER=postgres

export PGPORT=5432

export LD_LIBRARY_PATH=/opt/pg/lib:$LD_LIBRARY_PATH

7、启动数据库

su - postgres

pg_ctl start

8、停止数据库

su - postgres

pg_ctl stop 

最后修改时间:2019-12-24 10:55:31
文章转载自PostgreSQL学习,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论