AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1159299
Accepted
André Carvalho
André Carvalho
Asked: 2019-07-19 09:58:42 +0800 CST2019-07-19 09:58:42 +0800 CST 2019-07-19 09:58:42 +0800 CST

为什么我的 Ubuntu 18.04 中有两个 PostgreSQL 版本?

  • 772

每次我在 Ubuntu 18.04 中安装 PostgreSQL(即使我要求apt-get使用 a 专门安装版本 11 sudo apt-get install postgresq-11)我都会在我的系统中获得版本 10 和版本 11。

andre@linuxrocks:/var/lib/postgresql$ ls -la
total 48
drwxr-xr-x  5 postgres postgres  4096 jul 18 01:17 .
drwxr-xr-x 86 root     root      4096 jul  5 14:54 ..
drwxr-xr-x  3 postgres postgres  4096 abr 16 10:19 10
drwxr-xr-x  3 postgres postgres  4096 jul 13 00:37 11

数据库中的对象在这两个文件夹中重复。

postgres=# \! find ~ -type f -name 16563
/var/lib/postgresql/11/main/base/13132/16563
/var/lib/postgresql/10/main/base/16385/16563

我有两个postgresql.conf,每个文件夹中都有一个,尽管 DBMS 似乎只从 11 个文件夹中的一个中获取其配置。

ps -f -u postgres在我查看所有 PostgreSQL 进程并看到我的系统创建了重复的进程(一个来自 10 文件夹,另一个来自 11)之后,我发现了这种奇怪的行为。所以我已经清除并重新安装了 PostgreSQL(使用sudo apt-get install postgresq-11),现在我不再有重复的进程了。

andre@linuxrocks:~$ ps -f -u postgres
UID        PID  PPID  C STIME TTY          TIME CMD
postgres  1595     1  0 14:30 ?        00:00:00 /usr/lib/postgresql/11/bin/postgres -D /var/lib/postgresql/11/mai
postgres  1684  1595  0 14:30 ?        00:00:00 postgres: 11/main: logger   
postgres  1692  1595  0 14:30 ?        00:00:00 postgres: 11/main: checkpointer   
postgres  1693  1595  0 14:30 ?        00:00:00 postgres: 11/main: background writer   
postgres  1694  1595  0 14:30 ?        00:00:00 postgres: 11/main: walwriter   
postgres  1695  1595  0 14:30 ?        00:00:00 postgres: 11/main: autovacuum launcher   
postgres  1696  1595  0 14:30 ?        00:00:00 postgres: 11/main: stats collector   
postgres  1697  1595  0 14:30 ?        00:00:00 postgres: 11/main: logical replication launcher   
postgres 11074 11073  0 14:33 pts/0    00:00:00 bash
postgres 11078 11074  0 14:33 pts/0    00:00:00 /usr/lib/postgresql/11/bin/psql
postgres 11091  1595  0 14:33 ?        00:00:00 postgres: 11/main: postgres postgres [local] idle

即便如此,我有两个文件夹和重复的对象。为什么会这样?

apt process postgresql duplicate
  • 1 1 个回答
  • 1279 Views

1 个回答

  • Voted
  1. Best Answer
    user535733
    2019-07-19T10:38:25+08:002019-07-19T10:38:25+08:00

    简短的回答:发生这种情况是因为您在从其他一些非 Ubuntu 源安装版本 11 之前没有卸载版本 10(Ubuntu 18.04)。

    查看 Ubuntu 存储库中版本 10 和 11 的可用性:

    $ rmadison postgresql-10
     postgresql-10 | 10.3-1                | bionic
     postgresql-10 | 10.5-1                | cosmic
     postgresql-10 | 10.9-0ubuntu0.18.04.1 | bionic-security
     postgresql-10 | 10.9-0ubuntu0.18.04.1 | bionic-updates
     postgresql-10 | 10.9-0ubuntu0.18.10.1 | cosmic-security
     postgresql-10 | 10.9-0ubuntu0.18.10.1 | cosmic-updates
    
    $ rmadison postgresql-11
     postgresql-11 | 11.2-1                | disco
     postgresql-11 | 11.4-0ubuntu0.19.04.1 | disco-security
     postgresql-11 | 11.4-0ubuntu0.19.04.1 | disco-updates
     postgresql-11 | 11.4-1.1~build1       | eoan
    
    $ snap search postgresql
    Name                                 Version   Publisher      Notes    Summary
    postgresql95                         9.5.13    cmd✓           -        PostgreSQL is a powerful, open source object-relational database system.
    postgresql96                         9.6.9     cmd✓           -        PostgreSQL is a powerful, open source object-relational database system.
    postgresql10                         10.4      cmd✓           -        PostgreSQL is a powerful, open source object-relational database system.
    postgresql93                         9.3.23    cmd✓           -        PostgreSQL is a powerful, open source object-relational database system.
    postgresql94                         9.4.18    cmd✓           -        PostgreSQL is a powerful, open source object-relational database system.
    

    从中,我们学到了两件事:

    1) 版本 10 和 11 有不同的包名。这意味着您可以并排安装多个版本。这似乎是你所做的。您可以简单地删除大部分您的postgresql-10或postgresql-10-*包裹。(警告- 滥用通配符会损坏您的系统;始终--simulate先运行并仔细阅读您的输出,以确保它只删除您想要的内容)

    2) 任何官方 Ubuntu 来源均不提供 18.04 版本 11。这意味着您添加了一些非 Ubuntu 源。所以在删除版本 10 时要加倍小心:我们不知道你添加了什么,从哪里添加,或者它拖入了哪些其他非 Ubuntu 依赖项。

    • 0

相关问题

  • 如何编写 shell 脚本来安装应用程序列表?

  • 如何查看存档中可用的软件包的所有版本?

  • 是否可以说出我安装的哪些软件包不在原版安装中?

  • 如何删除 PPA?

  • 使用 apt-get upgrade 时如何强制安装内核更新?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve