PostgresQL on Fedora

Installing PostgreSQL on Fedora Core

This will install the PostgreSQL database server and the component required to write PHP scripts that communicate with postgres. We use yum to handle dependencies and gather all of the required packages. For more information on PostgreSQL, see

1. Install PostgreSQL and the component that allows php to talk to PostgreSQL.

 yum -y install postgresql postgresql-server php-pgsql 

2. Configure the new service to start automatically

  /sbin/chkconfig postgresql on
/sbin/chkconfig postgresql initdb
/sbin/service postgresql start

3. Start the postgresql interactive shell and create your first user and database.

 su - postgres         [The dash is important!]

psql template1 [template1 is a database that is included by default with PostgreSQL.]

psql# create user web_user;
psql# create database web_database owner web_user;
psql# \q

Edit the postgres host based access configuration file:


Modify the local line to use "trust" based authentication rather than "identity". Please review the PostgreSQL documentation before making this change and take the security

local	all		all			trust

Restart the database service.

 /sbin/service postgresql restart

4. Test your connection.

 psql -U web_user web_database

5. Following the above steps, the database location on Fedora is /var/lib/pgsql/data.