Friday, 18 November 2011

Installing Postgresql in CentOS

Install
yum install postgresql84
yum install postgresql84-server
yum install postgresql-odbc.x86_64
yum install postgresql-jdbc.x86_64

#If you want to use modules as part of the tablefunc.sql
yum install postgresql84-contrib.x86_64


Initialize
service postgresql initdb

Start
/etc/init.d/postgresql start

Settings
vi /var/lib/pgsql/data/postgresql.conf
 Add --> listen_addresses = '*'
 to make it listen to inbound connections
vi /var/lib/pgsql/data/pg_hba.conf
 Add  --> host    all         all         10.0.0.0/8            ident
 to make allow for local subnet


Create a DB
su - postgres

createdb qainfo

Install tablefunc
cd /usr/share/pgsql/contrib
in a specific database
psql -d qainfo <tablefunc.sql
over all
psql <tablefunc.sql


Create a DB user
su - postgres
psql
create user <<USERNAME>>;
GRANT ALL PRIVILEGES ON DATABASE <<DBNAME>> to <<USERNAME>>;

Where USERNAME should match a Unix/Linux user.

Use DB
#As <<USERNAME>>
psql qainfo
create table test ( name varchar(40));
insert into test values ('abc');
insert into test values ('123');
insert into test values ('you');
insert into test values ('me');
select * from test;

No comments:

Post a Comment