Jump to content

Postgres installation

From TetraWiki
Revision as of 06:12, 14 September 2012 by Raunaq (talk | contribs)

Postgres installation


1)Ist install java,php,php-pgsql,phpPgadmin,http

2)install jboss final(ot transfer from other place where jboss run)

3)path of jboss /usr/bin/jboss_6.0___

4)also transfer jboss start/stop script from /etc/init.d/jboss

5)Now after all this install postgresql


INSTALL THESE PACKAGES

yum install postgresql84-server-8.4.9-1.el5_7.1
yum install postgresql84-libs-8.4.9-1.el5_7.1
yum install postgresql-libs-8.1.23-1.el5_6.1
yum install postgresql84-contrib-8.4.9-1.el5_7.1


NOW RUN THIS COMMAND TO CREATE DATA DIR IN /var/lib/pgsql/ dir.A

service postgresql initdb


AFTER RUNNING ABOVE COMMAND YOU GET A DIR /var/lib/pgsql/data

Now Start Postgresql

/etc/init.d/postgresql start
chkconfig postgresql on
chkconfig httpd on


Login in Postgresql

su - postgres

-bash-3.2$ psql postgres
postgres=#CREATE DATABASE aimil WITH TEMPLATE = template0 OWNER = postgres
ENCODING = 'UTF8';
ABOVE COMMAND CREATES A DATABASE OF NAME(WHATEVER YOU GIVE "HERE i GIVE
DATABASE NAME aimil") WITH UNICODE UTF8
postgres=#ALTER USER postgres with PASSWORD 'password';  (HERE GIVE
PASSWORD TO USER POSTGRES)
postgres=#quit (to logout)
-bash-3.2$psql -l  (to check database list)
logout and come back on root prompt


vim /var/lib/pgsql/data/pg_hba.conf go in last and add global ip of tetra there with md5 encription

local   all         all                               md5
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
host    all         all         122.160.21.105/24         md5
host    all         all         203.122.16.189/32          md5
host    all         all         192.168.0.0/24          md5

save and quit


vim /var/lib/pgsql/data/postgresql.conf

 listen_addresses = '*'  put * in place of 'localhost'
port = 5432                    remove #
max_connections = 100          remove #

save and quit


vim /etc/httpd/conf.d/phpPgAdmin.conf

Allow from all  (allow all here)


vim /etc/phpPgAdmin/config.inc.php change true in false here

$conf['extra_login_security'] = false;
/etc/init.d/postgresql restart
/etc/init.d/httpd restart


NOW IF YOU HAVE TO TAKE ANY DUMP OF OTHER POSTGRESQL DATABASE go to that server

  1. su - postgres
pg_dump databaseName > databaseName.sql

make tar of databaseName.sql and transfer on new postgresql server.

On new server where you install new postgresql or where you want to upload this database and type


  1. su - postgres
psql -d databasename -f databaseName.sql