0

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.

5
  • Why would you do this? Commented Nov 1, 2013 at 14:25
  • To setup development and testing environments quickly without affecting the existing setup and also installing customized packages
    – vfclists
    Commented Nov 1, 2013 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. Commented Nov 1, 2013 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
    Commented Nov 1, 2013 at 23:05
  • At enterprisedb.com/products-services-training/pgbindownload there are ZIP distributions for Linux as well.
    – user1822
    Commented Nov 7, 2013 at 7:16

1 Answer 1

1

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.

2
  • Is that the postgresql.conf the standard packages install at /etc/postgresql? I don't want to involve that one.
    – vfclists
    Commented Nov 10, 2013 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. Commented Nov 11, 2013 at 2:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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