运行命令'psql'时出错错误:您必须安装至少一个postgresql-client- 包

问题描述 投票:0回答:1

当我运行vagrant ssh并成功登录然后尝试~$psql命令我得到此错误Error: You must install at least one postgresql-client-<version> 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命令给我显示图片中所需的输出?

desired output

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

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 psycopg2 psql vagrant-ssh
1个回答
0
投票

看起来你在安装几个包404 Not Found时遇到了一些麻烦。

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

© www.soinside.com 2019 - 2024. All rights reserved.