-1

I am downloading PostgreSQL on my Ubuntu version 18.04 and getting these errors while installing Postgresql version 12.

I have ran following command

sudo apt-get install postgresql postgresql-client

Error

How to resolve these errors.

  • What are these pictures, if we are not in kindergarten? There is no such package in the specified repository. Update your database: `sudo apt-get update` – mr mcwolf Jul 17 '23 at 12:04
  • Use [this](http://us.archive.ubuntu.com/ubuntu/) repository. – mr mcwolf Jul 17 '23 at 12:10
  • Check if the package exists in your repositories by running `apt list `, for example `apt list postgresql`. If it does not show up, then update your repositories with `sudo apt-get update`. – Jesse Jul 17 '23 at 12:12

4 Answers4

1

Try to run sudo apt-get update before the installation, and if it didn't work

I would recommend you download the PostgreSQL from the source by following below instructions:

Installation of PostgreSQL from Source:

First, we will install PostgreSQL from the source. The following instructions are valid for PostgreSQL versions 11 and 12.

You can also take help from the following link PostgreSQL Documentation:

Download the files in your specified folder

wget https://ftp.postgresql.org/pub/source/v11.18/postgresql-11.18.tar.gz && tar -xvf postgresql-11.18.tar.gz && rm -f postgresql-11.18.tar.gz

The command will download and extract the tar files for Linux users from Source in the working directory. Installing PG: Now we will move toward installing PG

cd postgresql-11.18

# configure by setting flags
./configure --enable-debug --enable-cassert --prefix=$(path) CFLAGS="-ggdb -Og -fno-omit-frame-pointer"

# now install
make install

In the above command, the prefix flag will contain the path where you would like to install the PSQL. Replace your path with the path in the parenthesis.

Talha Munir
  • 121
  • 5
  • Well, I think it should not smell like a chat gpt. I installed Postgres at the start of this year and these were the instructions that I followed. and that is why I wrote them over here. – Talha Munir Jul 18 '23 at 05:53
  • I provided a solution to the problem as well, see the very first line of the answer. It says to run sudo apt-get update and follow the installation process!! and if it didn't work you can use the below instructions. – Talha Munir Jul 18 '23 at 05:54
0

Try the following command

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql-12

or simply paste this in a .sh file and run that sh file with sudo, postgresql 12 would be installed successfully.

Sarthak
  • 380
  • 7
0

If you want to install PostgreSQL using package management, run sudo apt install postgresql-12 postgresql-server-dev-12.

Carla
  • 326
  • 1
  • 7
0

Try to run this:

sudo apt install postgresql-12 postgresql-server-dev-12

OR

Download the desired version from here and unzip it using tar keyword in your desired directory.

After that, you will see Makefile in that unzipped folder, now run make install to install it on your system.

After successful installation, verify it using psql --version.

I hope this answers your question.