【问题标题】:error while running the comannd 'psql' Error: You must install at least one postgresql-client-<version> package运行命令“psql”时出错错误:您必须至少安装一个 postgresql-client-<version> 软件包
【发布时间】:2019-07-11 08:28:05
【问题描述】:

当我运行vagrant ssh 并成功登录然后尝试~$psql 命令我收到此错误Error: You must install at least one postgresql-client-&lt;version&gt; package. 我看到一个类似的问题here 我运行这个命令:

~$ sudo apt-get install postgresql-client

输出:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libpq5 postgresql-client-9.1
Suggested packages:
  postgresql-9.1 postgresql-doc-9.1
The following NEW packages will be installed:
  libpq5 postgresql-client postgresql-client-9.1
0 upgraded, 3 newly installed, 0 to remove and 66 not upgraded.
Need to get 1,057 kB/1,063 kB of archives.
After this operation, 3,448 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libpq5 amd64 9.1.5-0ubuntu12.04
  404  Not Found [IP: 91.189.91.23 80]
Err http://security.ubuntu.com/ubuntu/ precise-security/main libpq5 amd64 9.1.5-0ubuntu12.04
  404  Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com/ubuntu/ precise-security/main postgresql-client-9.1 amd64 9.1.5-0ubuntu12.04
  404  Not Found [IP: 91.189.88.149 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/postgresql-9.1/libpq5_9.1.5-0ubuntu12.04_amd64.deb  404  Not Found [IP: 91.189.88.149 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/postgresql-9.1/postgresql-client-9.1_9.1.5-0ubuntu12.04_amd64.deb  404  Not Found [IP: 91.189.88.149 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

我也尝试了建议的修复,但没有奏效。

如何成功安装 postgresql 包? 主要是如何让 $psql 命令给我图片中显示的所需输出?

(编辑)我尝试了第一个答案建议:

vagrant@precise64:~$ apt-get update
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

然后尝试here提到的解决方案:

vagrant@precise64:~$ ps aux | grep apt
vagrant   1144  0.0  0.2  11676   948 pts/0    S+   18:59   0:00 grep --color=auto apt

我不明白,所以我不知道接下来会发生什么?

【问题讨论】:

  • 此时安装 PostgreSQL 9.1 或 9.3 肯定是可取的。你好像有网络问题。我建议你试试 PostgreSQL 网站上的软件包。
  • 您能告诉我如何以 {answer} 形式执行此操作吗?
  • 我只有一个link
  • 如何导入歌唱密钥库?我这么初学者可以继续吗?我做了一半的步骤,但现在需要知道如何导入......你会在答案中解释一下吗?如果有效我会接受,如果无效,我将不胜感激
  • 您只需从网站上复制并粘贴命令即可。我不会写答案,因为我不知道出了什么问题,而且我不想从字面上复制 PostgreSQL 网站上非常详细的说明。

标签: postgresql psycopg2 psql vagrant-ssh


【解决方案1】:

您在安装多个软件包时遇到了一些问题404 Not Found

执行sudo apt-get update,然后重试安装。

【讨论】:

  • 我只是运行这个命令并编辑了问题请检查输出? @jasen
  • 必须是 root - sudo 是必需的。
猜你喜欢
  • 2011-07-15
  • 1970-01-01
  • 2015-04-02
  • 2020-02-04
  • 1970-01-01
  • 2017-01-01
  • 2015-05-23
  • 2022-12-11
  • 1970-01-01
相关资源
最近更新 更多