无法在Ubuntu 18.04中安装postgreSQL 9.6

我正在尝试通过Ubuntu软件中心在Ubuntu 18.04中安装postgreSQL 9.6并从终端输入

sudo apt-get install postgresql-9.6

根据官方文档https://www.postgresql.org/download/linux/ubuntu/

 Create the file /etc/apt/sources.list.d/pgdg.list and add a line for the repository 

deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main

 Import the repository signing key, and update the package lists wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update 

要安装的版本是10

有帮助吗?

提前致谢。

 postgresql: 

已安装:(无)候选人:10 + 191.pgdg18.04 + 1版本表:10 + 191.pgdg18.04 + 1 500 500 http://apt.postgresql.org/pub/repos/apt bionic-pgdg / main amd64软件包500 http://apt.postgresql.org/pub/repos/apt bionic-pgdg / main i386软件包10 + 190 500 500 http://gr.archive.ubuntu.com/ubuntu bionic / main amd64软件包500 http ://gr.archive.ubuntu.com/ubuntu bionic / main i386软件包

如果我检查postgresql文件夹在哪里,似乎我有两个版本,9.6和10

/ usr / lib中/ PostgreSQL的

最后,为了安装postgres 9.6,我完全按照后续步骤卸载了postgresql(任何版本和文件相关)。

 sudo apt-get --purge remove postgresql dpkg -l | grep postgres (to look for postgresfiles in the system) sudo rm -rf postgresql ... (remove all the files that appeared in the list after running the previous command) 

最后使用下一个命令手动安装postgreSQL:

 sudo apt-get install postgresql-9.6 

我希望它可以帮助那些可能遇到同样问题的人。