Tuesday, December 13, 2011

Postgresql 8.4.7 on CentOS 6.0 (64 Bit)

Install Postgresql
# yum install postgresql-server postgresql-devel postgresql-contrib postgresql#
# chmod 777 -R /tmp <-- make sure you do this !!!!
# /etc/rc.d/init.d/postgresql initdb
Initializing database: [ OK ]
# /etc/init.d/postgresql start
Starting postgresql service: [ OK ]
# /etc/init.d/postgresql stop
Stopping postgresql service: [ OK ]
Edit postgresql configuration
# mcedit /var/lib/pgsql/data/postgresql.conf
# line 59: listen all
listen_addresses = '*'
# line 334: change log format
log_line_prefix = '%t %u %d '
port = 5432

Make sure postgresql will start when computer on
# chkconfig postgresql on
Testing postgresql
# su - postgres
-bash-4.1$ psql -c "alter user postgres with password '
XXX'"
ALTER ROLE

-bash-4.1$ createdb testdb
-bash-4.1$ psql -l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
: postgres=CTc/postgres
testdb | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
(4 rows)

testdb-# \q
-bash-4.1$ dropdb testdb
-bash-4.1$
-bash-4.1$ exit
logout
When you see no error, then your postgresql will running smoothly on your computer :)

Done

No comments: