Configuring PostgreSQL on linux red hat.


I'm trying to install PostgreSQL onto my linux Red Hat test environment.  I downloaded all the required RPMs then looked at the PostgressQL documentation on hte site.

The docs there seem to be for people who are making the binaries from sourse code.  They mayke no reference to how to install PostgreSQL on red hat using the rpms.

Anyway.   I installed the  database using these commands:

rpm -i postgresql-libs-7.4.3-2PGDG.i686.rpm
 rpm -i postgresql-7.4.3-2PGDG.i686.rpm
rpm -i postgresql-server-7.4.3-2PGDG.i686.rpm

thats all  I have done.  when I run createdb or  psql I get the error message:

createdb: could not connect to database template1: could not connect to server:
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

I know this is a common error during configuration, but when I look at the documentation for this it doesnt make much sense because is does not seem to be correct for someone installing the rpms for red-hat.

Do I need to set environment variables somehow?

Thanks in advance

Who is Participating?
rjkimbleConnect With a Mentor Commented:
I suggest you run the following command to start PostgreSQL:

/etc/init.d/postgresql start

You should edit pg_hba.conf and postgresql.conf first. The former sets up your server's security, and the latter sets up your server's configuration. In particular, if you intend to connect to your server over TCP/IP, you need to ensure that postgresql.conf has the following line:

tcpip_socket = true

You should find both files in /var/lib/pgsql/data/ or whatever is appropriate for your installation.
earth man2Connect With a Mentor Commented:
use command    initdb   first.
earth man2Commented:
set environment variable PGDATA to point to (eg) /var/lib/pgsql/data
>> use command    initdb   first.

Good point. On my Mandrake 10.0 and SuSE 9.1 boxes, /etc/init.d/postgresql start will run initdb if necessary. However, on my Debian box, you would have to run initdb first if the installation process didn't do so. If you installed PostgreSQL using the standard Red Hat package, my guess is that /etc/init.d/postgresql start will run initdb if necessary. Still, it can't hurt to make sure that it has been run.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.