Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I need to be able to run PostgreSQL databases outside the standard installation directories, ie run the existing postgres or pg_ctl process pointing to the alternative ports, configuration and data directories and get it running, with permissions etc working okay.

I don't want it to depend on the existing package based installation setup's structures in /etc/postgresql and /var/run/postgresql and the postgres user, but use their executables if possible.

I will not be using initdb much. The data will be unzipped from other installations. The only thing required is database compatibility with the existing package based installations, which I may be able to install if they are absent. Using executables of my own will be the last resort, due to the possibility of unexpected local dependencies.

Windows appears well covered in that respect with some downloads at EnterpriseDB but there doesn't seem so much available for Linux.

share|improve this question
    
Why would you do this? –  dezso Nov 1 '13 at 14:25
    
To setup development and testing environments quickly without affecting the existing setup and also installing customized packages –  vfclists Nov 1 '13 at 14:56
    
How about setting up some virtual machines? For example, we have a VirtualBox image available for every dev, with PostgreSQL installed from packages (which are basically the standard ones). This way I have about 7 instances, only one locally and the others virtualized. When I kill one of these (as it happened already due to pg_xlog diskspace problems), I just reimport the image and that it is. –  dezso Nov 1 '13 at 16:58
    
@dezso It isn't for development alone. It is for the ability to put bundle executables and all related for an application into a single directory for easy management. I have used VMs and they do tend to proliferate –  vfclists Nov 1 '13 at 23:05
    
At enterprisedb.com/products-services-training/pgbindownload there are ZIP distributions for Linux as well. –  a_horse_with_no_name Nov 7 '13 at 7:16
add comment

1 Answer

up vote 0 down vote accepted

pg_ctl allows for a -D option which allows you to point at your data wherever it is.

I do this all the time for development environments and fun things like setting up intracomputer replication environments for testing. It works fine.

The one thing you really need to be careful about is the configuration. After unzipping you should probably edit the postgresql.conf appropriately.

share|improve this answer
    
Is that the postgresql.conf the standard packages install at /etc/postgresql? I don't want to involve that one. –  vfclists Nov 10 '13 at 18:44
    
I believe debian and ubuntu put the file in /etc/postgresql/[version]/[cluster]/ so you should have multiple postgresql.conf files in /etc. –  Chris Travers Nov 11 '13 at 2:23
add comment

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.