Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot install postgres on Ubuntu (E: Unable to locate package postgresql)

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

terminal install logs


Update:

I've done entered those commands and got this.

after update and apt-cache

after update and apt-cache

What should I do now?

like image 610
Lucas Perry Avatar asked Nov 22 '18 16:11

Lucas Perry


1 Answers

sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `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
like image 101
Tarique Avatar answered Sep 20 '22 19:09

Tarique