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 <>;
GRANT ALL PRIVILEGES ON DATABASE <> to <>;

Where USERNAME should match a Unix/Linux user.

Use DB
#As <>
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;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s