How to install postgresql in fedora core

Here i share how i install postgresql in fedora core. I spent full day to find out a solution. Hope this help

1) First please get a PostgeSQL source code n compile it for installation or using yum command in fedora core.

a) Regarding PostgeSQL source code Compilation, please visit here
http://www.mkyong.com/database/how-to-compile-postgresql-database-source-code-in-linux/

b) Regarding Yum command, change to root and issue following command, it will connect to internet and download postgresql core files.

yum -y install postgresql postgresql-server php-pgsql 

install-postgres-in-fedora-step1

2) Create a database cluster with initdb -D /usr/local/pgsql/data command, before that please create a /usr/local/pgsql/data folder and assign ‘postgres’ user to own it. ‘postgres’ is the default user for postgresql.

mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
initdb -D /usr/local/pgsql/data

install-postgres-in-fedora-step2

3) Start postgresql server

pg_ctl /usr/local/pgsql/data -l -logfile start

if you want stop postgres server , please issue following command.

pg_ctl /usr/local/pgsql/data -l -logfile stop

4)Create a database

createdb new_db

5)Access with psql

psql new_db

6) Issue a select version(); command, if it show postgresql version, it’s means you are successfully installed postgresql in fedora already.

install-postgres-in-fedora-step3

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
9 Comment threads
1 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
10 Comment authors
MichitechiswellChrisBlakenegativeØne Recent comment authors
newest oldest most voted
techiswell
Guest
techiswell

su – postgres

is erroring, as postgres user is not created. what to do to solve the same?

Michi
Guest
Michi

You have to use “sudo su – postgres”

Chris
Guest
Chris

Your Spring tutorials have saved me at work, and now youve helped me with a personal project.
Many Many thanks

Blake
Guest
Blake

Your step #3 is missing the “-D” before the file path. It’s listed in your screenshot, but not your text.

Thanks for the write-up

negativeØne
Guest
negativeØne

Great article! Good job!

andrew
Guest
andrew

Very helpful. thanks.

andreas
Guest
andreas

Thanks a lot ….

chidveer
Guest
chidveer

THANXXXXXXXXXXXXXXXXXXXX

A LOTTTTTTTTTTTT…………………..

Naruto Shippuden Music Download
Guest
Naruto Shippuden Music Download

Hi there Expert, I fell lucky that I located this post while browsing for naruto shippuden music download. I am with you on the topic of nnial 2007 – salvatore iaconesi – del.icio.us poetry. Ironically, I was just putting a lot of thought into this last Thursday.