0

When I run vagrant ssh and login successfully then try the ~$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 ran 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 the $psql command to give me the desired output showed in the picture?

desired output

(Edit) I tried the first answer's 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 don't know what's next.

dda
  • 6,030
  • 2
  • 25
  • 34
Aya Muhammad
  • 73
  • 1
  • 11
  • Installing PostgreSQL 9.1 or 9.3 is certainly *not* desirable at this point. You seem to have network problems. I suggest that you try the packages from the PostgreSQL site. – Laurenz Albe Feb 18 '19 at 04:21
  • would you please tell me how to do that in an {answer} form? – Aya Muhammad Feb 18 '19 at 18:55
  • I only have a [link](https://www.postgresql.org/download/linux/ubuntu/). – Laurenz Albe Feb 18 '19 at 19:09
  • how do I import the singing key repository? I'm so beginner to be able to proceed? I did half of the steps but now need to know how to import ... would you explain in an answer? I'll accept it if it worked, i'd be grateful if it didnt work to – Aya Muhammad Feb 18 '19 at 21:00
  • 1
    You just have to literally copy and paste the command from the site. I won't write an answer because I don't know what went wrong, and I don't want to literally copy the very detailed instructions from the PostgreSQL site. – Laurenz Albe Feb 18 '19 at 21:25
  • Detailed but not very detailed, they said create file and add the content to this file (I did), then they said import signing key -and- run the following command. I got stuck here because I don't know how to import a siging key, I only know how to copy this command and run it in git-bash terminal (which I tried and it says command not found). If you know how to import sining key please don't hesitate to share the information.. I will update the question with these steps that I tried and didn't work. – Aya Muhammad Feb 19 '19 at 20:48

1 Answers1

2

looks like you had some trouble installing several packages 404 Not Found.

Do sudo apt-get update and then retry the install.

Jasen
  • 11,837
  • 2
  • 30
  • 48