postgresql - 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?
(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?
解决方案
看起来你在安装几个包时遇到了一些麻烦404 Not Found
。
执行sudo apt-get update
然后重试安装。
推荐阅读
- javascript - 按正态分布(高斯分布)对数字数组进行排序
- c++ - std::string 移动构造函数是否真的移动?
- angular - 在 Angular 中使用 ::ng-deep 推荐
- javascript - 在谷歌地图信息窗口中添加输入和提交字段
- python - 如果索引包含某个字符串,则定义颜色
- kubernetes - 实时监控 k8s 容器中的 CPU 使用率/CPU 限制
- python - 从 Python 脚本中激活 virtualenv
- javascript - 没有表单的 ASP.NET Core Antiforgery Token
- python - 如何搜索列表的第一个单元格,每个列表都是字典中的值?
- c# - 保存 jpeg 时 System.Drawing.dll 中的访问冲突异常