Install Postgres 9.1:
user@machine:~$ sudo apt-get install postgresql-9.1
Add postgres binaries to the PATH :
user@machine:~$ sudo gedit /etc/bash.bashrc
#Add these lines at the end
export PATH=$PATH:/usr/lib/postgresql/9.1/bin/
export PGDATA=/usr/local/pgsql/data
Save & Exit. Ok, now you can run postgres --version and other postgres executables.
Also, you've defined the default data folder, you will need that soon.
Setup postgres user, and data folder :
Postgresql server should be started by his own system user, and it have been createdby the installation but using a random password. Now you'll change that password.
Change postgres password :
user@machine:~$ su postgres
In case you cant login with su use sudo to reset password fro postgres user
user@machine:~$sudo passwd postgres
postgres@machine:~$psql
postgres# alter user postgres with password '<Your new password>';
press ctrl+d to exit
Init postgres data structure, and create the storage folder
user@machine:~$ sudo mkdir /usr/local/pgsql
user@machine:~$ sudo mkdir /usr/local/pgsql/data
user@machine:~$ sudo chown postgres /usr/local/pgsql
user@machine:~$ sudo chown postgres /usr/local/pgsql/data
user@machine:~$ su postgres
Init the data folder
postgres@machine:~$ initdb -D /usr/local/pgsql/data
Note: Make sure this is the same directory as your PGDATA variable
Enable remote connections:
postgres@machine:~$ vi /usr/local/pgsql/data/postgresql.conf
change this to #listen_addresses='localhost' # what IP address(es) to listen on;
listen_addresses='*' # what IP address(es) to listen on;
Enable remote connections Settings:
postgres@machine:~$ vi /usr/local/pgsql/data/pg_hba.conf
Allow any user from any host with IP address 192.168.0.x to connect
Change this to CIDR-ADDRESS for all database into 192.168.0.0/24
Start server:
First stop postgres database in case it is running because for some other process altering
postgres@machine:~$/etc/init.d/postgresql stop
postgres@machine:~$ postgres &
user@machine:~$ sudo apt-get install postgresql-9.1
Add postgres binaries to the PATH :
user@machine:~$ sudo gedit /etc/bash.bashrc
#Add these lines at the end
export PATH=$PATH:/usr/lib/postgresql/9.1/bin/
export PGDATA=/usr/local/pgsql/data
Save & Exit. Ok, now you can run postgres --version and other postgres executables.
Also, you've defined the default data folder, you will need that soon.
Setup postgres user, and data folder :
Postgresql server should be started by his own system user, and it have been createdby the installation but using a random password. Now you'll change that password.
Change postgres password :
user@machine:~$ su postgres
In case you cant login with su use sudo to reset password fro postgres user
user@machine:~$sudo passwd postgres
postgres@machine:~$psql
postgres# alter user postgres with password '<Your new password>';
press ctrl+d to exit
Init postgres data structure, and create the storage folder
user@machine:~$ sudo mkdir /usr/local/pgsql
user@machine:~$ sudo mkdir /usr/local/pgsql/data
user@machine:~$ sudo chown postgres /usr/local/pgsql
user@machine:~$ sudo chown postgres /usr/local/pgsql/data
user@machine:~$ su postgres
Init the data folder
postgres@machine:~$ initdb -D /usr/local/pgsql/data
Note: Make sure this is the same directory as your PGDATA variable
Enable remote connections:
postgres@machine:~$ vi /usr/local/pgsql/data/postgresql.conf
change this to #listen_addresses='localhost' # what IP address(es) to listen on;
listen_addresses='*' # what IP address(es) to listen on;
Enable remote connections Settings:
postgres@machine:~$ vi /usr/local/pgsql/data/pg_hba.conf
Allow any user from any host with IP address 192.168.0.x to connect
Change this to CIDR-ADDRESS for all database into 192.168.0.0/24
Start server:
First stop postgres database in case it is running because for some other process altering
postgres@machine:~$/etc/init.d/postgresql stop
postgres@machine:~$ postgres &
Post a Comment
Post a Comment