数据库
首页 > 数据库> > Ubuntu 20.04安装下安装postgresql-10

Ubuntu 20.04安装下安装postgresql-10

作者:互联网

源码方式安装
1、1、@TOC下载
先去下载,这里是官网地址,因为老的数据库是 10.1,所以为了迁移数据不出问题,就安装个10.1版本的,这里下载 postgresql-10.1.tar.gz,上传到服务器中
https://www.postgresql.org/ftp/source/v10.1/
在这里插入图片描述
2、@[TOC](切换到 root用户)

su root

3、@TOC

tar -zxf postgresql-10.1.tar.gz

4、@TOC
安装所需要的依赖

apt-get install libreadline-dev
apt-get install zlib1g
apt-get install zlib1g.dev
cd postgresql-10.1/

执行编译命令

./configure

执行后会报错 configure: error: readline library not found
这里执行命令即可

apt-get install  libreadline6-dev

这里执行编译命令make后报错

make

/usr/include/unistd.h:1107:9: note: previous declaration of ‘copy_file_range’ was here
1107 | ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
| ^~~~~~~~~~~~~~~

sed -i "s/copy_file_range/copy_file_chunk/g" /root/postgresql-10.1/src/bin/pg_rewind/copy_fetch.c 

执行该命令替换内容后再次执行 make 命令后再执行 make install

make install

执行完后会提示安装成功 PostgreSQL installation complete

在这里插入图片描述
5、新增pgsql 用户

在这里插入代码片

标签:10.1,postgresql,get,make,install,copy,安装,20.04
来源: https://blog.csdn.net/wangxinxinsj/article/details/123579637