1、新建/etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main
// lsb_release -cs 查看当前系统的分发版本
deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main // #20.04 ->focal
或 一步操作
echo "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
2、导入存储库签名密钥
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
3、更新程序包列表
sudo apt update
4、安装
sudo apt install postgresql-9.5 postgresql-9.5-postgis-2.5 postgis
5、配置/etc/postgresql/9.5/main/postgresql.conf /etc/postgresql/9.5/main/pg_hba.conf
postgresql.conf -> port=5432 listen_addresses = '*'
pg_hba.conf -> host all all 0.0.0.0/0 trust
6、重启postgresql服务
sudo service postgresql restart
网友评论