Skip to content
mengfung.com
writing

CentOS 6.3 & Postgresql 9.2

 ·  1 min read

Notes for installing Postgres on a fresh CentOS minimal install.

> cd /usr/local/src

# i followed this
# http://wiki.postgresql.org/wiki/YUM_Installation#Configure_your_YUM_repository
# postgres repo
curl -O http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm
> rpm -ivh pgdg-centos92-9.2-6.noarch.rpm
> yum list postgres*-server
> yum install postgresql92-server.x86_64

# initialize 
> service postgresql-9.2 initdb

# on startup
> chkconfig postgresql-9.2 on

# check
> chkconfig --list

# control service  -> start, stop, restart, reload
# service postgresql-9.2 
> service postgresql-9.2 start
 
# assuming you are logged in as root if not su to root then su to postgres user
> su postgres

# psql prompt
> psql

# list all databases
> l

# create user
> CREATE USER mfung WITH PASSWORD 'superpassword';

# create database
> CREATE DATABASE mengsdb WITH OWNER mfung;

> l

# you can use this to allow user to createdb
> alter user mfung createdb;

# db privileges look here:
# http://www.postgresql.org/docs/8.3/static/sql-grant.html