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 http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -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
psql

Create a database called 'oranges'

#while still logged into postgres:

create database oranges;

#check it created successfully
\l

# exit postgres
\q
# exit postgres user
exit
COPIED

SNAPPED!

Comments

Popular posts from this blog

Append to a json file python

Setup Mailhog mail server on Ubuntu