Unable to install postgreSQL 9.6 in Ubuntu 18.04
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
apt 18.04 postgresql
add a comment |
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
apt 18.04 postgresql
1
I don't think you can install version 9.6 from Ubuntu Software, so you need to add a repository. You have included the exact instructions to do so: 1) create a file containing one line of text, then 2) import a key using thewget
command. What exactly goes wrong?
– Jos
Jul 4 '18 at 10:17
@Jos after I typed sudo apt-cache policy postgresql, it appears the the response I've attached above
– webtechnelson
Jul 4 '18 at 10:36
It seems that you have successfully installed version 9.6. Now it's a good idea to remove version 10 withsudo apt remove postgresql-10
.
– Jos
Jul 4 '18 at 10:47
@Jos I have removed postgres 10, following the command you suggest and then I ran sudo apt-get install postgresql-9.6, the folder 9.6 appears in /usr/lib/postgresql, however, when I type in terminal sudo apt-cache policy postgresql, it says there is no postgresql installed. postgresql: Installed: (none) Candidate: 10+191.pgdg18.04+1
– webtechnelson
Jul 4 '18 at 11:48
add a comment |
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
apt 18.04 postgresql
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
apt 18.04 postgresql
apt 18.04 postgresql
edited Jul 4 '18 at 10:39
webtechnelson
asked Jul 4 '18 at 10:08
webtechnelsonwebtechnelson
118110
118110
1
I don't think you can install version 9.6 from Ubuntu Software, so you need to add a repository. You have included the exact instructions to do so: 1) create a file containing one line of text, then 2) import a key using thewget
command. What exactly goes wrong?
– Jos
Jul 4 '18 at 10:17
@Jos after I typed sudo apt-cache policy postgresql, it appears the the response I've attached above
– webtechnelson
Jul 4 '18 at 10:36
It seems that you have successfully installed version 9.6. Now it's a good idea to remove version 10 withsudo apt remove postgresql-10
.
– Jos
Jul 4 '18 at 10:47
@Jos I have removed postgres 10, following the command you suggest and then I ran sudo apt-get install postgresql-9.6, the folder 9.6 appears in /usr/lib/postgresql, however, when I type in terminal sudo apt-cache policy postgresql, it says there is no postgresql installed. postgresql: Installed: (none) Candidate: 10+191.pgdg18.04+1
– webtechnelson
Jul 4 '18 at 11:48
add a comment |
1
I don't think you can install version 9.6 from Ubuntu Software, so you need to add a repository. You have included the exact instructions to do so: 1) create a file containing one line of text, then 2) import a key using thewget
command. What exactly goes wrong?
– Jos
Jul 4 '18 at 10:17
@Jos after I typed sudo apt-cache policy postgresql, it appears the the response I've attached above
– webtechnelson
Jul 4 '18 at 10:36
It seems that you have successfully installed version 9.6. Now it's a good idea to remove version 10 withsudo apt remove postgresql-10
.
– Jos
Jul 4 '18 at 10:47
@Jos I have removed postgres 10, following the command you suggest and then I ran sudo apt-get install postgresql-9.6, the folder 9.6 appears in /usr/lib/postgresql, however, when I type in terminal sudo apt-cache policy postgresql, it says there is no postgresql installed. postgresql: Installed: (none) Candidate: 10+191.pgdg18.04+1
– webtechnelson
Jul 4 '18 at 11:48
1
1
I don't think you can install version 9.6 from Ubuntu Software, so you need to add a repository. You have included the exact instructions to do so: 1) create a file containing one line of text, then 2) import a key using the
wget
command. What exactly goes wrong?– Jos
Jul 4 '18 at 10:17
I don't think you can install version 9.6 from Ubuntu Software, so you need to add a repository. You have included the exact instructions to do so: 1) create a file containing one line of text, then 2) import a key using the
wget
command. What exactly goes wrong?– Jos
Jul 4 '18 at 10:17
@Jos after I typed sudo apt-cache policy postgresql, it appears the the response I've attached above
– webtechnelson
Jul 4 '18 at 10:36
@Jos after I typed sudo apt-cache policy postgresql, it appears the the response I've attached above
– webtechnelson
Jul 4 '18 at 10:36
It seems that you have successfully installed version 9.6. Now it's a good idea to remove version 10 with
sudo apt remove postgresql-10
.– Jos
Jul 4 '18 at 10:47
It seems that you have successfully installed version 9.6. Now it's a good idea to remove version 10 with
sudo apt remove postgresql-10
.– Jos
Jul 4 '18 at 10:47
@Jos I have removed postgres 10, following the command you suggest and then I ran sudo apt-get install postgresql-9.6, the folder 9.6 appears in /usr/lib/postgresql, however, when I type in terminal sudo apt-cache policy postgresql, it says there is no postgresql installed. postgresql: Installed: (none) Candidate: 10+191.pgdg18.04+1
– webtechnelson
Jul 4 '18 at 11:48
@Jos I have removed postgres 10, following the command you suggest and then I ran sudo apt-get install postgresql-9.6, the folder 9.6 appears in /usr/lib/postgresql, however, when I type in terminal sudo apt-cache policy postgresql, it says there is no postgresql installed. postgresql: Installed: (none) Candidate: 10+191.pgdg18.04+1
– webtechnelson
Jul 4 '18 at 11:48
add a comment |
2 Answers
2
active
oldest
votes
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.
add a comment |
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
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1052079%2funable-to-install-postgresql-9-6-in-ubuntu-18-04%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
add a comment |
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.
add a comment |
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.
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.
edited Nov 17 '18 at 17:43
answered Jul 4 '18 at 14:15
webtechnelsonwebtechnelson
118110
118110
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
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
edited 28 mins ago
answered 34 mins ago
HearenHearen
1137
1137
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1052079%2funable-to-install-postgresql-9-6-in-ubuntu-18-04%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I don't think you can install version 9.6 from Ubuntu Software, so you need to add a repository. You have included the exact instructions to do so: 1) create a file containing one line of text, then 2) import a key using the
wget
command. What exactly goes wrong?– Jos
Jul 4 '18 at 10:17
@Jos after I typed sudo apt-cache policy postgresql, it appears the the response I've attached above
– webtechnelson
Jul 4 '18 at 10:36
It seems that you have successfully installed version 9.6. Now it's a good idea to remove version 10 with
sudo apt remove postgresql-10
.– Jos
Jul 4 '18 at 10:47
@Jos I have removed postgres 10, following the command you suggest and then I ran sudo apt-get install postgresql-9.6, the folder 9.6 appears in /usr/lib/postgresql, however, when I type in terminal sudo apt-cache policy postgresql, it says there is no postgresql installed. postgresql: Installed: (none) Candidate: 10+191.pgdg18.04+1
– webtechnelson
Jul 4 '18 at 11:48