Install Postgres specific version Ubuntu

In this guide we'll install Postgresql 9.6.11. If you need to install another version, just replace "9.6.11" with your desired version.

First remove any existing version:

sudo apt-get --purge remove postgresql
dpkg -l | grep postgres 
sudo rm -rf postgresql

Install postgres - specific version

sudo sh -c 'echo "deb `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
wget -q -O - | sudo apt-key add -
sudo apt-get update  
sudo apt-get upgrade 
sudo apt-get install postgresql-9.6.11

Change default password. By default, the postgres user password will default to the ubuntu user password.

sudo passwd postgres

Changing password in postgres

ALTER USER postgres WITH PASSWORD 'pass123';

connect to postgres

sudo su - postgres

# login to postgres

Create a database called 'oranges'

#while still logged into postgres:

create database oranges;

#check it created successfully

# exit postgres
# exit postgres user



Popular posts from this blog

Append to a json file python

Setup Mailhog mail server on Ubuntu