Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including
Stack Overflow
, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this community
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I'm trying to install postgreSQL 9.6 in Ubuntu 18.04 via Ubuntu Software Centre and type from terminal
sudo apt-get install postgresql-9.6
according to official documentation
https://www.postgresql.org/download/linux/ubuntu/
Create the file /etc/apt/sources.list.d/pgdg.list and add a line for the repository
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main
Import the repository signing key, and update the package lists
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
The version to be installaed is 10
Any help?
Thanks in advance.
postgresql:
Installed: (none)
Candidate: 10+191.pgdg18.04+1
Version table:
10+191.pgdg18.04+1 500
500 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 Packages
500 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main i386 Packages
10+190 500
500 http://gr.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
500 http://gr.archive.ubuntu.com/ubuntu bionic/main i386 Packages
If I check where are the postgresql folders, it seems that I have both versions, 9.6 and 10
/usr/lib/postgresql
–
–
–
–
After few months I had to erase and install from scratch, so in order to install postgresql 9.6 I followed next steps:
Important notes: If you have already installed postgresql 10 and you want 9.6, you need to remove postgresql 10 completely and then manually install postgresql 9.6, so follow method 2.
Method 1
Step 1
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
Step 2
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
Step 3.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install postgresql-9.6
Method 2
In order to install postgres 9.6 having already postgres 10 or other version different from 9.6 installed, you need first to uninstall postgresql (any version and file related) completely following the next steps.
sudo apt-get --purge remove postgresql
dpkg -l | grep postgres (to look for postgresfiles in the system)
sudo rm -rf postgresql ... (remove all the files that appeared in the list after running the previous command)
Finally install manually postgreSQL with the next command:
sudo apt-get install postgresql-9.6
I hope it can help somebody that could have the same problem.
Not completely the same in my case when trying to replace postgresql 10 with postgresql 9.4.
I removed the old unwanted packages by
dpkg -l | grep postgres | cut -d' ' -f3 | xargs sudo apt --purge remove -y
But while I am trying to remove the packages, I also encounter several issues, I terminate the process before it reaches the 100% and the following commands are used to fix the issues along the way.
sudo lsof /var/lib/dpkg/lock-frontend
sudo kill -9 <PID>
sudo dpkg --configure -a
# if necessary, rerun the removing command above
And start the installation as:
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 install -y postgresql-9.4