Ubuntu 20.04安装Postgresql

1.下载源码

访问https://www.postgresql.org/ftp/source/找到需要的版本并下载:
wget https://ftp.postgresql.org/pub/source/v11.11/postgresql-11.11.tar.gz

2.解压

这里解压到用户的opt路径下
tar xvf postgresql-11.11.tar.gz -C ~/opt/

3.配置

3.1.进入解压后的路径

cd ~/opt/postgresql-11.11

3.2.执行

./configure --prefix=/home/zhang/opt/postgresql
这里制定安装路径是/home/zhang/opt/postgresql,如果不加则默认安装到/usr/local/pgsql
如果出现如下错误:

...
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.
Use --without-readline to disable readline support.

则需要安装相关依赖:
sudo apt install libreadline-dev<

你可能感兴趣的:(postgresql)