install psql on ubuntu 16.04
Postgres installation on ubunut 16.04
if youre using the root user
apt-get update
update the ubuntu repository
apt-get upgrade
upgrade the package to the latest version
its updating the packages now
Once its update and the packages will upgrade now
sudo apt-get upgrade
now going to download the postgres 9.5 in ubunutu
type the below command
apt-get install postgresql postgresql-contrib
Once it will done ,This will showing the configuration file file path and data path also in terminal
now we are going to login to the postgres9.5
for login with postgres need to use this command
su postgres (via this user only we able to access the database )
Type with psql and enter it will allow to login to psql terminal
need to change the password for connect from the client tool like (Pg Admin) for change the password for postgres
#\password postgres
now we need to change the configuration settings in configuration files in postgresql .
With out changes we able to connect the psql from local host only but we have the pg admin in some another system in same network
for editing configuration files I am using the filezilla client
my linux ip address is – 192.168.2.6
connect the psql server via filezilla and goto the following path
/etc/postgresql/9.5/main/pg_hba_conf
Find the below line and add the following line the conf file
here my network is range is 192.168.2.1 to 192.168.2.255 so I will added below if have the two network means you may given to network ip ,for example if youre connected through vpn means the ip will assign 192.168.3.1 series you have to enter the
192.168.3.1/24 in the configuration file
Find the following line and edit below
In the same path postgresql.conf file is there click on edit and find the
listen_address = 'localhost' and change as a listen_address='*'
need to remove the # before the line
now we need to restart the postgres9.5
now we able to connect from the pgadmin
click on the save
now we able to run the query
Please refer the following youtube link for install psql on ubuntu 16.04
Comments
Post a Comment