当我运行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命令给我显示图片中所需的输出?
(编辑)我尝试了第一个答案建议:
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
我不明白,所以我不知道下一步是什么?
看起来你在安装几个包404 Not Found
时遇到了一些麻烦。
做sudo apt-get update
然后重试安装。