登录到postgresql的官方网站,选择相应的版本:
采用下面的步骤安装:
# Create the file repository configuration: sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' # Import the repository signing key: wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - # Update the package lists: sudo apt-get update # Install the latest version of PostgreSQL. # If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql': sudo apt-get install postgresql
安装完成后查询相关的包
postgres@scutech:~$ dpkg -l|grep postg ii pgdg-keyring 2018.2 all keyring for apt.postgresql.org ii postgresql 12+215.pgdg18.04+1 all object-relational SQL database (supported version) ii postgresql-12 12.3-1.pgdg18.04+1 amd64 object-relational SQL database, version 12 server ii postgresql-client-12 12.3-1.pgdg18.04+1 amd64 front-end programs for PostgreSQL 12 ii postgresql-client-common 215.pgdg18.04+1 all manager for multiple PostgreSQL client versions ii postgresql-common 215.pgdg18.04+1 all PostgreSQL database-cluster manager postgres@scutech:~$