Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

This is not a question with a concrete answer, I know, but one that seeks experienced views...

The OS environment I run is as vanilla as possible so it's often undesirable to install things into root paths (/var /lib /whatever). However, installation at the user level is very desirable: in fact, I've installed PostgreSQL (8.4) in /home/postgres to upgrade/get past the Solaris installed version (8.3); I'll do the same for 9 when the time comes.

There are tools like pgStatspack and check_postgres.sql but other/popular diagnostic tools out there expect the DBA to also be root. They seem like very useful tools with their pretty graphs and come-hither features but I'm unable to accomodate them.

Simply put, I do not have root nor do I want root: I have a 'postgres' user, everything is currently owned by it, and PostgreSQL runs happily.

But for third-party tools, can I live this way or are my efforts to continue down this non-root path misdirected?

Thanks.

share|improve this question

migrated from stackoverflow.com Aug 7 '11 at 8:56

This question came from our site for professional and enthusiast programmers.

    
I think it's a nice question. +1. –  Sayem Ahmed Aug 5 '11 at 17:44
    
I've been using self-compiled binaries since Postgres95 and I've never run into this issue. Shouldn't these tools respect the setting of PG_DATA etc? –  Alex Howansky Aug 5 '11 at 17:53
    
I'm sure they would respect things like PG_DATA as that's internal to PostgreSQL. I'm referring to third-party tools that need to install things into /var or /lib or some other root level to operate. –  Joe Creighton Aug 5 '11 at 18:09
    
What tools exactly need to be installed by root? I'm wondering if you can build them from source to get around that limitation. for instance you can build slony from source rather easily and install it, all without being root. –  Scott Marlowe Aug 5 '11 at 21:47

1 Answer 1

From experience, root is not really needed to operate postgres. We have Postgres (8.3 at the moment) installed on a linux (Debian) system under user/group postgres/postgres. We did custom install (not from a debian package, but compiled from sources) - and specified to install various binaries, libraries, data directory, etc.

Once installed, it's happily sitting in /home/postgres with directory structure being

/home/postgres/8.3
                  /bin
                  /conf
                  /data
                  /lib

and so on. The only things that required root to install were scripts in /etc/init.d to start/stop the database when system enters/leaves runlevels. Temporary file location as well unix socket location can all be specified in the config file, which itself can be anywhere on the file system - you just specify the location when you start/stop the server. Pretty much all other locations are specified in the config file or via environment variables.

I've been managing this database for the past year and never needed root for anything. As the user postgres owns all the binaries, the actual server process is owned by user postgres. As the port is 5432, no root is needed to bind to it.

I haven't tried using any fancy utilities (I'm old school and prefer command line), but pgadmin running on my mac os x laptop works happily with this installation (via ssh-mapped port).

We further have apache web server set up in a similar manner - but that requires root for start/stop in order to bind to port 80. PHP programs running in this apache server can happily talk to the postgres database.

So, the short answer to your question: 'yes, it is possible to have postgres run without ever needing root'.

share|improve this answer
    
I think we're in the same boat with regards to a custom install under /home/postgres: it works well for me, too. I've clarified my question. –  Joe Creighton Aug 5 '11 at 18:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.