CentOS
登录到官方网站( https://www.postgresql.org/download/linux/redhat/ ),找到需要安装的版本和操作系统版本,并安装官方源:
上图中给出的是安装PG服务端的命令,若仅需要安装PG客户端,那么在安装源之后,执行以下指令即可:
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install postgresql13 -y
#我这里安装的PG13版本的源,所以指定下版本,若不指定版本则会安装9.2版本
Ubuntu
执行如下安装命令:
sudo apt-get update
sudo apt-get install postgresql-client
Debian
执行如下安装命令:
sudo apt-get update
sudo apt-get