Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Installed postgresql through RH 7.2

Status
Not open for further replies.

taneujin

MIS
Aug 14, 2001
61
0
0
SG
I selected all the postgresql packages before RH7.2 installation started. RH7.2 installation completed without any problems. So I proceeded to check if postgresql is installed.

#su - postgres
$ postgres

Then it said that it could not find
/var/lib/data/pg_ctrl

Did I miss out on some packages or skipped some steps?

Please help.
 
postgres used to install into /var/lib but these days it usually ends up in /usr/local/pgsql. You need to find out where the postgresql binaries are located. This can be done by using rpm to interrogate the package as follows

rpm -ql postgres | grep pg_ctrl

If this fails then use

find / -name pg_ctrl 2>/dev/null

 
I thought this command
#su - postgres
$ postgres
would get it working.

In fact, I used the same 2 discs to install the same RH7.2 with postgresql on another machine, everything went fine and all the files are in /var/lib.

 
I found the pg_ctl. Its located in /usr/bin.
When I typed
# ./pg_ctl start
I get the following messages.

"pg_ctl: no database directory or environment variable $PGDATA is specified"

Is there something I missed out here also?
 
Hi taneujin,

From the root command line type "setup" and a menu will appear on your screen. Then select "services" and a list of available servers will appear in a scoll list. Scroll down the list until you come to postgres and make sure it is selected. Then reboot your system and postgres should automatically be started as a process of starting your system.
Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
I have no idea about postgres...sorry.

Can you tell me how I can check if postgresql is really running/functional?

I have done the above step (setup) and made sure it was checked (it wasn't checked).

I do not know what I should do next to see if its really running well.
 
To check whether postgreSQL is running you use the following command...

ps -ef | grep post

If postgreSQL is running you should see a postmaster task in the output. You could also try running psql - if postgreSQL is running you should get an error back saying that a database named as your userid is not present.

The way postgreSQL starts is via a script called postgresql located in the /etc/rc.d/init.d directory. You run

/etc/rc.d/init/d/postgresql start to start the system and /etc/rc.d/init/d/postgresql stop to stop it.

Normally there are soft links to this script in the /etc/rc3.d and other directories, these are named S##postgres, where ## is a number, to start the system at that run-level and K##postgres to stop it at that run-level.

Presumably the rpm install process has done the initdb required to set up the database templates etc. (I normally compile & install from sources)

Cheers - Gavin
 
Great!
I have checked and I think its working.

But, may I know why it prompted me
/var/lib/data/pg_ctrl is not found (1st post)

when I first typed postgres as postgres user?
 
It would appear that the script postgres is incorrect and needs to be corrected. Find out postgres's seatch path by typing

echo $PATH

then look for a script called postgres in each of the directories listed, when you find it you need to edit it to correct the path error.

Also run env | grep \/var\/lib\/data to see if the path is contained in an environment variable.
 
I have tried to startup postgres from the setup menu and it worked.

When I went back to the data directory (after postgres has started) there were quite a number of files.

But when I do not startup postgres, there are no files there.

May I know why?

As for the path, its correct.
Its in /var/lib/data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top