首页 > 解决方案 > error while running the comannd 'psql' Error: You must install at least one postgresql-client- package

问题描述

when I run vagrant ssh and login successfully then try ~$psql command I get this error Error: You must install at least one postgresql-client-<version> package. I saw a similar question here and i run this command:

~$ sudo apt-get install postgresql-client

the output:

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?

I tried the suggested fix missing too but didn't work.

how can I install a postgresql package successfully? and mainly how can I get $psql command to give me the desired output showed in the picture?

desired output

(Edit) I tried the first answe suggestion:

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?

Then tried the solutions mentioned 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

I don't understand so i dont know whats next?

标签: postgresqlpsycopg2psqlvagrant-ssh

解决方案


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

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


推荐阅读