So I'm having this problem where for some reason I can't install any package on my ubuntu system. I'm currently on Ubuntu 16.10.
terminal install logs

Update:
I've done entered those commands and got this.
after update and apt-cache

What should I do now?
25 Answers
sudo apt-get install wget ca-certificates wget --quiet -O - | sudo apt-key add - sudo sh -c 'echo "deb `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' sudo apt-get update sudo apt-get install postgresql postgresql-contrib After installing the PostgreSQL database server, by default, it creates a user ‘postgres’ with role ‘postgres’. Also creates a system account with the same name ‘postgres’. So to connect to Postgres server, log in to your system as user postgres and connect database.
sudo su - postgres psql 2First do
sudo apt-get update You should get no errors upon updating. In case you do, then you might have issues with your firewall, or something blocking you from updating repositories. Check the output carefully.
And then search for the correct (exact!) package name using this command:
apt-cache search postgresql As a last resort you could add external 3rd Party repository as described in this answer. Just remember to use your distribution name instead of "xenial".
1It's Working
It should work.
$ sudo apt-get install postgresql postgresql-client 0If you are getting (E: Unable to locate package postgresql-12) while migrating following step may helps you:
sudo apt-get -y install bash-completion wget wget --quiet -O - | sudo apt-key add - sudo apt-get update sudo apt-get -y install postgresql-12 postgresql-client-12 sudo systemctl status postgresql ref:install postgres12 in ubuntu-18.04
Following Commands worked for me: sudo apt-get install wget ca-certificates
wget --quiet -O - | sudo apt-key add -
sudo sh -c 'echo "deb lsb_release -cs-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt install postgresql-11 libpq-dev