Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save devdattaT/6b794a2157a32669d8650d549bec125b to your computer and use it in GitHub Desktop.
Save devdattaT/6b794a2157a32669d8650d549bec125b to your computer and use it in GitHub Desktop.
Upgrading Postgresql Client to 10.x on Ubuntu
Upgrading Postgresql Client to 10.x on Ubuntu
==
We need to first check which Postgresql components are currently installed. This can be done by running a command like:
`dpkg -l | grep postgres`
This returned:
`
ii postgresql-client 9.5+173ubuntu0.1 all front-end programs for PostgreSQL (supported version)
ii postgresql-client-9.5 9.5.12-0ubuntu0.16.04 amd64 front-end programs for PostgreSQL 9.5
ii postgresql-client-common 173ubuntu0.1 all manager for multiple PostgreSQL client versions
`
You can remove them by the following command:
`sudo apt-get --purge remove postgresql-client postgresql-client-9.5 postgresql-client-common`
Now we are ready to install the latest version of the client. To do this, we need to add the correct Postgresql APT Repository. Details are given on [this page](https://www.postgresql.org/download/linux/ubuntu/)
In my case, I was using Ubuntu 16.4, hence I added the repository by using:
`sudo add-apt-repository 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main'`
Then Add the key & update using :
`wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update`
Finally install the client using `sudo apt-get install postgresql-client-10`
Once the installation is complete, you can check the version of the installed client by using ` psql --version`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment